/* ===== 杂志排印风 · Editorial ===== */
scene {
  display: block;
  max-width: 880px;
  margin: 20px auto;
  padding: clamp(18px, 4vw, 32px);
  background:
    repeating-linear-gradient(0deg, transparent, transparent 31px, rgba(42,42,40,0.05) 31px, rgba(42,42,40,0.05) 32px),
    #FAF7F2;
  border: 1px solid #2A2A28;
  border-left: 6px solid #2A2A28;
  border-radius: 0;
  position: relative;
  overflow: visible;
  color: #2A2A28;
}
scene::before {
  content: '"';
  position: absolute;
  top: -18px;
  right: 14px;
  font-family: Georgia, serif;
  font-size: 120px;
  line-height: 1;
  color: rgba(42,42,40,0.06);
  pointer-events: none;
}

/* ===== 顶栏 ===== */
scene loc {
  display: block;
  padding: 12px 0 12px 22px;
  margin: 0 0 22px 0;
  border-top: 2px solid #2A2A28;
  border-bottom: 1px solid #2A2A28;
  color: #2A2A28;
  font-family: Georgia, "Times New Roman", "Songti SC", serif;
  font-size: clamp(12px, 2.2vw, 14px);
  font-weight: 600;
  letter-spacing: 1.5px;
  white-space: pre-line;
  line-height: 1.7;
  position: relative;
}
scene loc::before {
  content: '';
  position: absolute;
  left: 0;
  top: 18px;
  width: 12px;
  height: 12px;
  background: linear-gradient(135deg, #1E5BA8 33%, #D63384 33%, #D63384 66%, #7952B3 66%);
}

/* ===== 正文 ===== */
scene text {
  display: block;
  line-height: 1.85;
  color: #2A2A28;
  margin-bottom: 18px;
  font-size: clamp(14px, 2.5vw, 16px);
  font-family: Georgia, "Songti SC", serif;
}
scene text p { margin: 0 0 14px 0; }
scene text p:last-child { margin-bottom: 0; }

/* ===== 角色行为（蓝 · 竖线标记）===== */
scene pu {
  color: #1E5BA8;
  text-decoration: none;
  font-weight: 600;
  padding-left: 9px;
  border-left: 2px solid #1E5BA8;
  transition: border-width 0.2s ease, padding-left 0.2s ease;
}
scene pu:hover {
  border-left-width: 5px;
  padding-left: 12px;
}

/* ===== 角色台词（玫红 · 装饰引号）===== */
scene pq {
  color: #D63384;
  font-weight: 600;
  quotes: none;
  position: relative;
  padding: 0 2px;
}
scene pq::before { content: '『'; color: #D63384; opacity: 0.7; font-weight: 400; }
scene pq::after  { content: '』'; color: #D63384; opacity: 0.7; font-weight: 400; }

/* ===== 心里话 / 内心独白（紫 · 斜体批注）===== */
scene pe {
  color: #5E3F99;
  font-style: italic;
  font-weight: 500;
  font-family: Georgia, "Songti SC", serif;
  background: none;
  padding: 0 2px;
  border-radius: 0;
  letter-spacing: 0.4px;
  border-bottom: 1px dotted rgba(94, 63, 153, 0.45);
  transition: color 0.25s ease, border-color 0.25s ease;
}
scene pe::before {
  content: '⟨ ';
  font-style: normal;
  color: rgba(94, 63, 153, 0.6);
  font-weight: 400;
  letter-spacing: 0;
}
scene pe::after {
  content: ' ⟩';
  font-style: normal;
  color: rgba(94, 63, 153, 0.6);
  font-weight: 400;
  letter-spacing: 0;
}
scene pe:hover {
  color: #4A2F7F;
  border-bottom-color: rgba(94, 63, 153, 0.9);
}

/* ===== 手机消息（墨青绿 · 电报终端风）===== */
scene pm {
  color: #2C5F5D;
  font-weight: 500;
  font-family: "SF Mono", "Menlo", Consolas, "Courier New", "Microsoft YaHei", monospace;
  font-size: 0.9em;
  letter-spacing: 0.3px;
  padding: 0 4px 1px 4px;
  border-bottom: 1px solid rgba(44, 95, 93, 0.45);
  transition: color 0.25s ease, border-color 0.25s ease;
}
scene pm::before {
  content: '▌';
  color: rgba(44, 95, 93, 0.85);
  margin-right: 5px;
  font-weight: 700;
  font-family: monospace;
}
scene pm::after {
  content: '◂';
  color: rgba(44, 95, 93, 0.5);
  margin-left: 4px;
  font-size: 0.85em;
}
scene pm:hover {
  color: #1A3D3B;
  border-bottom-color: rgba(44, 95, 93, 1);
}

/* ===== 折叠区块 ===== */
scene details {
  background: rgba(255,255,255,0.45);
  border: 1px solid #2A2A28;
  border-radius: 0;
  margin-bottom: 12px;
  overflow: hidden;
}
scene details summary {
  padding: 11px 16px 11px 38px;
  cursor: pointer;
  font-family: Georgia, "Songti SC", serif;
  font-weight: 700;
  color: #2A2A28;
  font-size: clamp(13px, 2.3vw, 15px);
  letter-spacing: 1.5px;
  user-select: none;
  list-style: none;
  position: relative;
  background: linear-gradient(90deg, rgba(42,42,40,0.03), transparent);
}
scene details summary::-webkit-details-marker { display: none; }
scene details summary::before {
  content: '§';
  position: absolute;
  left: 16px;
  top: 50%;
  transform: translateY(-50%);
  color: #D63384;
  font-weight: 400;
  font-size: 16px;
  transition: transform 0.3s ease, color 0.3s ease;
}
scene details[open] summary::before {
  transform: translateY(-50%) rotate(90deg);
  color: #1E5BA8;
}
scene details[open] summary { border-bottom: 1px solid #2A2A28; }

/* 让房屋图纸所在的 details 可以让弹窗溢出 */
scene details:has(.house-map) { overflow: visible; }

/* ===== 内容容器 ===== */
scene c {
  display: block;
  padding: 12px 16px;
  color: #2A2A28;
  font-family: Georgia, "Songti SC", serif;
  font-size: clamp(13px, 2.2vw, 14px);
  line-height: 1.75;
  white-space: pre-line;
  animation: edFade 0.35s ease;
}
@keyframes edFade {
  from { opacity: 0; transform: translateY(-4px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ===== 小节标题 <b> ===== */
scene c b {
  display: block;
  color: #2A2A28;
  font-weight: 700;
  font-family: Georgia, serif;
  font-size: 12.5px;
  letter-spacing: 2px;
  text-transform: uppercase;
  padding: 6px 0 3px 11px;
  margin: 12px 0 -10px 0;
  border-left: 4px solid #2A2A28;
  background: linear-gradient(90deg, rgba(42,42,40,0.07), transparent 70%);
}
scene c b:first-child { margin-top: 0; }

/* ===== 嵌套折叠 ===== */
scene details details {
  border: none;
  border-top: 1px dashed rgba(214,51,132,0.4);
  border-bottom: 1px dashed rgba(214,51,132,0.4);
  margin: 12px 0;
  background: linear-gradient(135deg, rgba(214,51,132,0.04), rgba(121,82,179,0.04));
  overflow: visible;
}
scene details details summary {
  padding: 9px 42px 9px 32px;
  font-size: 13px;
  color: #D63384;
  letter-spacing: 1.5px;
  background: transparent;
  border-bottom: none !important;
}
scene details details summary::before {
  content: '§';
  color: #D63384;
  left: 14px;
}
scene details details[open] summary::before {
  color: #D63384;
}
scene details details summary::after {
  content: '🔒';
  position: absolute;
  right: 14px;
  top: 50%;
  transform: translateY(-50%) rotate(0deg);
  font-size: 14px;
  transition: transform 0.4s ease, content 0.3s;
  filter: grayscale(0.3);
}
scene details details:hover summary::after {
  content: '🔓';
  transform: translateY(-50%) rotate(-12deg);
  filter: grayscale(0);
}
scene details details > c {
  filter: blur(8px) saturate(0.85);
  opacity: 0.55;
  user-select: none;
  transition: filter 0.5s ease, opacity 0.5s ease;
  position: relative;
}
scene details details > c::before {
  content: '✦ 悬停以查看 ✦';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  color: #D63384;
  font-family: Georgia, serif;
  font-size: 13px;
  letter-spacing: 3px;
  font-weight: 700;
  filter: blur(0);
  background: rgba(250,247,242,0.85);
  padding: 4px 14px;
  border: 1px solid rgba(214,51,132,0.5);
  pointer-events: none;
  transition: opacity 0.3s ease;
  z-index: 2;
}
scene details details:hover > c {
  filter: blur(0) saturate(1);
  opacity: 1;
  user-select: text;
}
scene details details:hover > c::before {
  opacity: 0;
}

/* ========== 房屋布局图 · 建筑图纸风 ========== */
scene .house-map {
  display: grid;
  gap: 3px;
  padding: 18px 12px 12px 12px;
  margin: 8px 0 14px 0;
  background-color: #FAF7F2;
  background-image:
    linear-gradient(rgba(42,42,40,0.055) 1px, transparent 1px),
    linear-gradient(90deg, rgba(42,42,40,0.055) 1px, transparent 1px);
  background-size: 12px 12px;
  background-position: 0 0;
  border: 2px solid #2A2A28;
  position: relative;
  grid-auto-columns: minmax(0, 1fr);
  grid-auto-rows: minmax(72px, auto);
}
scene .house-map::before {
  content: '⌂ PLAN';
  position: absolute;
  top: -10px;
  left: 14px;
  padding: 2px 9px;
  background: #FAF7F2;
  color: #2A2A28;
  font-family: Georgia, serif;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 3px;
  border: 1px solid #2A2A28;
  z-index: 6;
}
scene .house-map::after {
  content: 'N ↑';
  position: absolute;
  top: -10px;
  right: 14px;
  padding: 2px 9px;
  background: #FAF7F2;
  color: #2A2A28;
  font-family: Georgia, serif;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 2px;
  border: 1px solid #2A2A28;
  z-index: 6;
}

/* 房间通用样式 · 极简两元素居中 */
scene .house-map .room {
  position: relative;
  border: 1.5px solid #2A2A28;
  padding: 8px 6px;
  min-width: 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  font-family: Georgia, "Songti SC", serif;
  color: #2A2A28;
  transition: transform 0.25s ease, box-shadow 0.25s ease;
  cursor: pointer;
  text-align: center;
  outline: none;
  -webkit-tap-highlight-color: transparent;
}
scene .house-map .room:hover,
scene .house-map .room:focus {
  transform: translate(-1px, -1px);
  box-shadow: 3px 3px 0 rgba(42,42,40,0.4);
  z-index: 50;
}
scene .house-map .room:focus-visible {
  outline: 2px dashed rgba(30,91,168,0.5);
  outline-offset: 2px;
}
scene .house-map .room .r-icon {
  font-size: 24px;
  line-height: 1;
  opacity: 0.9;
}
scene .house-map .room .r-name {
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.5px;
  line-height: 1.2;
}

/* ===== 悬浮说明卡（桌面端 · 紧贴房间顶部弹出）===== */
scene .house-map .room .r-pop {
  position: absolute;
  bottom: 100%;
  left: 50%;
  transform: translateX(-50%) scale(0.92);
  transform-origin: bottom center;
  width: max-content;
  min-width: 180px;
  max-width: 240px;
  padding: 12px 14px;
  background: #FAF7F2;
  border: 2px solid #2A2A28;
  box-shadow: 3px 3px 0 rgba(42,42,40,0.5);
  z-index: 100;
  visibility: hidden;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.22s ease, transform 0.22s ease, visibility 0s linear 0.22s;
  display: flex;
  flex-direction: column;
  gap: 8px;
  text-align: left;
  cursor: default;
}
scene .house-map .room:hover .r-pop,
scene .house-map .room:focus .r-pop {
  visibility: visible;
  opacity: 1;
  transform: translateX(-50%) scale(1);
  pointer-events: auto;
  transition-delay: 0s;
}

/* 弹窗内 · 标题行（图标 + 别称 + 类型标签） */
scene .house-map .room .r-pop-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: Georgia, "Songti SC", serif;
  font-size: 14px;
  font-weight: 700;
  color: #2A2A28;
  padding-bottom: 7px;
  border-bottom: 1.5px solid #2A2A28;
  letter-spacing: 0.5px;
  line-height: 1.3;
}
scene .house-map .room .r-pop-emoji {
  font-size: 18px;
  flex-shrink: 0;
}
scene .house-map .room .r-pop-tag {
  margin-left: auto;
  font-family: Georgia, serif;
  font-size: 9.5px;
  letter-spacing: 1.5px;
  color: #D63384;
  border: 1px solid #D63384;
  padding: 1px 6px;
  font-weight: 700;
  text-transform: uppercase;
  flex-shrink: 0;
  font-style: normal;
}
scene .house-map .room .r-pop-detail {
  font-family: Georgia, "Songti SC", serif;
  font-size: 12px;
  line-height: 1.65;
  color: rgba(42,42,40,0.88);
  font-style: italic;
  letter-spacing: 0.2px;
  white-space: normal;
  word-break: break-word;
}

/* 房间配色 */
scene .house-map .r-bedroom    { background: #F0E4C8; }
scene .house-map .r-bedroom2   { background: #EAD8B4; }
scene .house-map .r-bedroom3   { background: #E4CDA0; }
scene .house-map .r-livingroom { background: #DCE4EF; }
scene .house-map .r-kitchen    { background: #F2D9BC; }
scene .house-map .r-diningroom { background: #F0DCE6; }
scene .house-map .r-bathroom   { background: #D6E5E3; }
scene .house-map .r-study      { background: #E5DDEE; }
scene .house-map .r-cloakroom  { background: #EFD8DC; }
scene .house-map .r-balcony    { background: #DFEACD; }
scene .house-map .r-corridor   { background: #E8E3D5; }
scene .house-map .r-storage    { background: #DED7C2; }
scene .house-map .r-garage     { background: #C8CDD3; }
scene .house-map .r-garden     { background: #CBE0BC; }

/* 玩家当前房间 · 玫红脉动 */
scene .house-map .room.current {
  border: 2.5px solid #D63384;
  z-index: 3;
  animation: roomPulse 2.2s ease-in-out infinite;
}
@keyframes roomPulse {
  0%,100% { box-shadow: 0 0 0 2px rgba(214,51,132,0.18), 3px 3px 0 rgba(42,42,40,0.28); }
  50%     { box-shadow: 0 0 0 6px rgba(214,51,132,0.28), 3px 3px 0 rgba(42,42,40,0.28); }
}
scene .house-map .room.current::after {
  content: '📍 YOU';
  position: absolute;
  bottom: -10px;
  right: 6px;
  padding: 1px 8px;
  background: #D63384;
  color: #FAF7F2;
  font-family: Georgia, serif;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 2px;
  border: 1.5px solid #2A2A28;
  z-index: 5;
}

/* ===== 移动端适配 ===== */
@media (max-width: 600px) {
  scene { margin: 12px; padding: 16px; border-left-width: 5px; }
  scene loc { letter-spacing: 1px; padding-left: 20px; }
  scene details summary { padding-left: 34px; letter-spacing: 1px; }
  scene details details summary { padding-left: 28px; padding-right: 36px; }
  scene c { padding: 10px 14px; }
  scene c b { font-size: 12px; letter-spacing: 1.5px; }

  /* 房屋图纸 */
  scene .house-map {
    padding: 14px 6px 8px 6px;
    gap: 2px;
    min-height: 0;
  }
  scene .house-map .room {
    padding: 5px 3px;
    gap: 2px;
  }
  scene .house-map .room .r-icon { font-size: 18px; }
  scene .house-map .room .r-name { font-size: 10.5px; letter-spacing: 0.2px; }
  scene .house-map .room.current::after { font-size: 9px; padding: 1px 6px; letter-spacing: 1.5px; }

  /* 弹窗改为屏幕居中 + 全屏遮罩（100vmax 阴影技巧） */
  scene .house-map .room .r-pop {
    position: fixed;
    top: 50%;
    left: 50%;
    bottom: auto;
    transform: translate(-50%, -50%) scale(0.9);
    transform-origin: center center;
    width: min(82vw, 340px);
    max-width: 82vw;
    min-width: 0;
    padding: 16px 18px;
    gap: 12px;
    box-shadow:
      4px 4px 0 rgba(42,42,40,0.4),
      0 0 0 100vmax rgba(42,42,40,0);
    transition: opacity 0.28s ease, transform 0.28s ease, box-shadow 0.28s ease, visibility 0s linear 0.28s;
    z-index: 1000;
  }
  scene .house-map .room:hover .r-pop,
  scene .house-map .room:focus .r-pop {
    transform: translate(-50%, -50%) scale(1);
    box-shadow:
      4px 4px 0 rgba(42,42,40,0.4),
      0 0 0 100vmax rgba(42,42,40,0.55);
  }
  scene .house-map .room .r-pop-title { font-size: 15px; }
  scene .house-map .room .r-pop-emoji { font-size: 20px; }
  scene .house-map .room .r-pop-detail { font-size: 12.5px; }
}