/* 寰宇：手绘世界地图 + 名录。手机：标题、大洲、地图（固定，约占 46% 屏高）、名录（滚动）自上而下；
 * 桌面：地图占左边大半，名录是右边 344px 的一栏。 */
#page-world { overflow: hidden; }
.wm { display: flex; flex-direction: column; height: 100%; }
.wm-head { flex: none; flex-wrap: nowrap; align-items: baseline; gap: 10px; margin: 0; padding: calc(10px + var(--sat)) calc(14px + var(--sar)) 5px calc(14px + var(--sal)); }
.wm-head h2 { font-size: 22px; white-space: nowrap; }
.wm-head p { flex: 1; min-width: 0; font-size: 12.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.wm-head p b, .wm-list-head small b { font: 600 13.5px var(--latin); color: var(--ink-soft); }
.wm-head p span b { color: var(--seal); }
.wm-chips { flex: none; display: flex; gap: 7px; overflow-x: auto; scrollbar-width: none; padding: 3px calc(14px + var(--sar)) 10px calc(14px + var(--sal)); }
.wm-chips::-webkit-scrollbar { display: none; }

/* ------------------------------------------------------------ 地图 */
.wm-map { position: relative; flex: 0 0 46%; min-height: 230px; overflow: hidden; background: var(--paper); border-top: 1.5px solid var(--ink-line); border-bottom: 1.5px solid var(--ink-line); }
.wm-canvas { position: absolute; inset: 0; display: block; width: 100%; height: 100%; touch-action: none; cursor: grab; outline-offset: -3px; }
.wm-canvas.can-pick { cursor: pointer; } .wm-canvas.dragging { cursor: grabbing; }
.wm-loading { position: absolute; inset: 0; display: grid; place-items: center; padding: 0 20px; pointer-events: none; }
.wm-map.ready .wm-loading { display: none; }
.wm-tip { position: absolute; left: 0; top: 0; z-index: 4; pointer-events: none; padding: 3px 10px; border-radius: 6px; background: rgba(58, 42, 30, .9); color: var(--card); font-size: 13px; letter-spacing: .06em; white-space: nowrap; opacity: 0; transition: opacity .12s; }
.wm-tip.on { opacity: 1; }
.wm-tools { position: absolute; right: calc(8px + var(--sar)); top: 8px; z-index: 3; display: flex; flex-direction: column; gap: 6px; }
.wm-tools .icon-btn { width: 36px; min-height: 36px; background: var(--card); }
.wm-glyph { font: 400 21px/1 var(--latin); margin-top: -2px; }
.wm-tools .wm-zoom { display: none; }   /* 手机上用双指和双击缩放，只留“回到全图” */
.wm-legend { position: absolute; left: calc(8px + var(--sal)); bottom: 8px; z-index: 2; display: flex; align-items: center; gap: 11px; padding: 2px 11px 2px 10px; pointer-events: none;
  background: rgba(251, 246, 234, .88); border: 1px solid var(--line-strong); border-radius: 999px; font-size: 11.5px; letter-spacing: .06em; color: var(--ink-soft); }
.wm-legend span { display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; }
.wm-legend i { width: 8px; height: 8px; margin: 0 1px; transform: rotate(45deg); border-radius: 1px; background: #ead8cb; box-shadow: 0 0 0 1.2px var(--ink-line); }
.wm-legend i.on { background: var(--seal); }
.wm-legend b { display: grid; place-items: center; width: 15px; height: 15px; border-radius: 50%; background: var(--ink-soft); color: #fff5e6; font: 600 9.5px var(--latin); box-shadow: 0 0 0 1px var(--ink-line); }
.wm-legend-seal { display: none !important; }

/* 选中后的小卡片：手机上停靠在地图的上沿或下沿，桌面上跟着图钉 */
.wm-pop { position: absolute; left: calc(8px + var(--sal)); right: calc(8px + var(--sar)); bottom: 8px; z-index: 5; display: grid; grid-template-columns: 86px minmax(0, 1fr) auto; column-gap: 10px; align-items: center; padding: 7px 9px 8px 7px; }
.wm-pop[data-side=top] { bottom: auto; top: 8px; }
.wm-pop-in { animation: wm-in .26s ease both; }
.wm-pop-off { visibility: hidden; }
@keyframes wm-in { from { opacity: 0; } to { opacity: 1; } }
.wm-pop-thumb { display: block; aspect-ratio: 42 / 30; border-radius: 9px; background: radial-gradient(ellipse at 50% 62%, #fffaf0 0%, var(--paper-deep) 80%); }
.wm-pop-thumb img { display: block; width: 100%; height: 100%; object-fit: contain; padding: 4px 3px 0; }
.wm-pop-text { display: grid; min-width: 0; line-height: 1.5; padding-right: 2px; }
.wm-pop-text > * { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.wm-pop-text small { display: flex; align-items: center; gap: 6px; font-size: 11.5px; letter-spacing: .12em; color: var(--sub); }
.wm-pop-text small i { flex: none; width: 7px; height: 7px; margin-left: 2px; background: var(--chip); transform: rotate(45deg); box-shadow: 0 0 0 1px rgba(58, 42, 30, .55); }
.wm-pop-text small .seal { font-size: 10.5px; letter-spacing: .1em; padding: 0 5px; line-height: 1.5; }
.wm-pop-text strong { font-size: 16.5px; font-weight: 600; letter-spacing: .08em; line-height: 1.3; white-space: normal; display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; }
.wm-pop-text span { font-size: 12.5px; color: var(--ink-soft); }
.wm-pop-text .wm-pop-period { color: var(--sub); font-size: 12px; }
.wm-pop-go { align-self: end; min-height: 36px; padding: 4px 9px 4px 13px; }
.wm-pop-close { position: absolute; right: 3px; top: 2px; width: 30px; min-height: 30px; color: var(--sub); }

/* ------------------------------------------------------------ 名录 */
.wm-side { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.wm-list-head { flex: none; display: flex; align-items: baseline; gap: 10px; min-height: 40px; padding: 8px calc(14px + var(--sar)) 6px calc(16px + var(--sal)); border-bottom: 1px dashed var(--line-strong); }
.wm-list-head h3 { display: flex; align-items: center; gap: 8px; font-size: 15px; font-weight: 600; letter-spacing: .2em; }
.wm-list-head h3 i, .wm-group-title i { flex: none; width: 8px; height: 8px; background: var(--chip, var(--gold)); transform: rotate(45deg); border-radius: 1.5px; box-shadow: 0 0 0 1.2px rgba(58, 42, 30, .6); }
.wm-list-head small { flex: 1; font-size: 12.5px; color: var(--sub); }
.wm-list-head .btn { align-self: center; margin: -4px -6px -4px 0; color: var(--jade-deep); }
.wm-list { flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain; -webkit-overflow-scrolling: touch; padding: 2px calc(8px + var(--sar)) 22px calc(8px + var(--sal)); }
.wm-group-title { display: flex; align-items: center; gap: 8px; width: 100%; margin: 12px 0 2px; padding: 3px 8px; border: 0; background: none; text-align: left; font-size: 13px; font-weight: 600; letter-spacing: .2em; color: var(--ink-soft); }
button.wm-group-title { cursor: pointer; border-radius: 8px; } button.wm-group-title:hover { background: rgba(58, 42, 30, .06); }
.wm-group-title small { font: 400 12px var(--latin); letter-spacing: 0; color: var(--sub); }
.wm-group-title::after { content: ""; flex: 1; order: 3; border-top: 1px dashed var(--line-strong); }
.wm-group-title .ico { order: 4; color: var(--faint); }
.wm-list .wonder-card.row { min-height: 56px; }
.wm-list .wonder-card.row .wc-thumb { width: 72px; }
.wm-list .wonder-card.row.on { background: rgba(185, 69, 47, .09); box-shadow: inset 0 0 0 1.5px rgba(185, 69, 47, .4); }

/* ------------------------------------------------------------ 桌面 */
@media (min-width: 900px) {
  .wm { display: grid; grid-template-columns: minmax(0, 1fr) 344px; grid-template-rows: auto auto minmax(0, 1fr); }
  .wm-head { grid-column: 1; align-items: flex-end; gap: 16px; padding: 20px 8px 4px 26px; }
  .wm-head h2 { font-size: 30px; }
  .wm-head p { font-size: 13.5px; padding-bottom: 5px; }
  .wm-chips { grid-column: 1; padding: 8px 8px 12px 26px; flex-wrap: wrap; overflow: visible; }
  .wm-map { grid-column: 1; min-height: 0; margin: 0 4px 20px 24px; border: 1.5px solid var(--ink-line); border-radius: var(--wob-a); box-shadow: 0 3px 0 var(--edge), 0 12px 28px rgba(80, 55, 30, .1); }
  .wm-tools { right: 12px; top: auto; bottom: 12px; flex-direction: row; }
  .wm-tools .wm-zoom { display: inline-flex; }
  .wm-tools .icon-btn { width: 38px; min-height: 38px; }
  .wm-legend { left: 12px; bottom: 12px; font-size: 12px; }
  .wm-legend-seal { display: inline-flex !important; }
  .wm-side { grid-column: 2; grid-row: 1 / 4; margin: 20px 20px 20px 14px; overflow: hidden; background: var(--card); border: 1.5px solid var(--ink-line); border-radius: var(--wob-a); box-shadow: 0 3px 0 var(--edge), 0 12px 28px rgba(80, 55, 30, .1); }
  .wm-list-head { min-height: 48px; padding: 12px 14px 9px 18px; border-bottom: 1.5px solid var(--line); }
  .wm-list-head h3 { font-size: 16px; }
  .wm-list { padding: 2px 8px 20px; }
  .wm-pop { left: 0; top: 0; right: auto; bottom: auto; width: 360px; grid-template-columns: 104px minmax(0, 1fr) auto; padding: 9px 10px 10px 9px; will-change: transform; }
  .wm-pop[data-side=top] { top: 0; }
  .wm-pop::after { content: ""; position: absolute; left: var(--nub, 50%); width: 12px; height: 12px; margin-left: -6px; background: var(--card); border: 1.5px solid var(--ink-line); transform: rotate(45deg); }
  .wm-pop[data-side=above]::after { bottom: -7.5px; border-left-color: transparent; border-top-color: transparent; box-shadow: 2.2px 2.2px 0 var(--edge); }
  .wm-pop[data-side=below]::after { top: -7.5px; border-right-color: transparent; border-bottom-color: transparent; }
  .wm-pop-text strong { font-size: 17.5px; }
}
/* 手机横屏：地图在左，名录在右 */
@media (max-width: 899px) and (orientation: landscape) and (max-height: 520px) {
  .wm { display: grid; grid-template-columns: minmax(0, 1fr) 280px; grid-template-rows: auto auto minmax(0, 1fr); }
  .wm-head, .wm-chips, .wm-map { grid-column: 1; }
  .wm-map { min-height: 0; border-bottom: 0; border-right: 1.5px solid var(--ink-line); }
  .wm-side { grid-column: 2; grid-row: 1 / 4; }
}
