@media (min-width: 769px) {
  #arch-subtabs { flex-wrap: wrap; }
  #arch-subtabs .arch-subtab { padding-inline: clamp(8px, 1.1vw, 20px); }
}

.map-directory { display: grid; gap: 21px; padding-block: 4px 20px; }
.map-region { min-width: 0; }
.map-region h3 {
  margin-bottom: 9px;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--line);
  color: var(--text-dim);
  font-size: 14px;
  font-weight: 700;
}
.map-region-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 205px), 1fr));
  gap: 8px;
}
.map-entry {
  display: grid;
  grid-template-columns: clamp(72px, 8vw, 110px) minmax(0, 1fr);
  align-items: center;
  gap: 11px;
  min-width: 0;
  min-height: 52px;
  padding: 5px 10px 5px 5px;
  color: var(--text);
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-control);
  font: inherit;
  font-size: 15px;
  font-weight: 700;
  text-align: left;
  cursor: pointer;
}
.map-entry:hover { border-color: var(--accent-dim); background: var(--bg-hover); }
.map-entry.selected { border-color: var(--accent); color: var(--accent-glow); background: var(--accent-soft); }
.map-entry img, .map-reference img { display: block; width: 100%; height: auto; }
.map-entry img { border-radius: 3px; }
.map-entry span { overflow-wrap: anywhere; }
.map-detail, .map-plan { display: grid; gap: 10px; min-width: 0; }
.map-detail { gap: clamp(13px, 2vw, 19px); }
.map-detail h2 { color: var(--text); font-size: clamp(23px, 2.4vw, 34px); line-height: 1.2; }
.map-help, .map-plan-head { color: var(--text-mute); font-size: 14px; line-height: 1.55; }
.map-field-controls { display: flex; flex-wrap: wrap; gap: 4px clamp(12px, 2vw, 22px); border-bottom: 1px solid var(--line); }
.map-field-controls button {
  min-height: 44px;
  padding: 0 2px;
  color: var(--text-dim);
  background: none;
  border: 0;
  border-bottom: 2px solid transparent;
  font: inherit;
  font-size: clamp(12px, 1.3vw, 15px);
  font-weight: 700;
  cursor: pointer;
}
.map-field-controls button:hover { color: var(--text); }
.map-field-controls button[aria-pressed="true"] { color: var(--accent-glow); border-bottom-color: var(--accent); }
.map-field-controls button:focus-visible, .map-archive-reference summary:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.map-archive-field { display: grid; min-width: 0; gap: 12px; }
.map-archive-board .map-redraw { gap: 14px; }
.map-archive-board .map-redraw-stage { background: var(--bg-deep); border-radius: var(--radius-control); }
.map-archive-board .map-redraw-key { row-gap: 8px; }
.map-archive-reference { border-top: 1px solid var(--line); }
.map-archive-reference summary { width: fit-content; min-height: 44px; padding-block: 11px; color: var(--accent-glow); font-size: 14px; cursor: pointer; }
.map-archive-reference img { display: block; width: 100%; height: auto; border-radius: var(--radius-control); }
.map-archive-reference figcaption { padding-top: 6px; color: var(--text-dim); font-size: 13px; }
.map-board {
  display: grid;
  grid-template-columns: minmax(20px, .65fr) repeat(var(--map-cols), minmax(0, 1fr));
  width: min(100%, 525px);
  gap: 2px;
  padding: 6px;
  background: var(--bg-deep);
  border: 1px solid var(--border);
  border-radius: var(--radius-control);
}
.map-axis { display: grid; place-items: center; color: var(--text-mute); font-size: 12px; font-variant-numeric: tabular-nums; }
.map-cell {
  position: relative;
  display: grid;
  place-items: center;
  aspect-ratio: 1;
  min-width: 0;
  background: var(--bg-panel);
  border: 1px solid var(--line);
  border-radius: 2px;
}
.map-unit-portrait {
  position: absolute;
  transform: translate(-50%, -50%);
  aspect-ratio: 1;
  border-radius: 50%;
  overflow: hidden;
  color: #fff;
}
.map-unit-initial {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  line-height: 1;
  visibility: hidden;
}
.map-unit-portrait:has(img[hidden]) .map-unit-initial { visibility: visible; }
.map-unit-portrait img {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: var(--portrait-image);
  max-width: none;
  height: var(--portrait-image);
  object-fit: cover;
}
.map-unit-ground, .map-unit-ring { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }
.map-board { user-select: none; }
.map-plan, .map-hp-view {
  overscroll-behavior: contain;
  --map-exit: #ffe6a3;
  --map-exit-dark: #60431f;
}
.map-redraw { display: grid; gap: 6px; user-select: none; }
.map-redraw-stage { position: relative; }
.map-redraw-art { display: block; width: 100%; height: auto; }
.map-redraw-key { display: flex; flex-wrap: wrap; gap: 4px 14px; color: var(--text-dim); font-size: 12px; }
.map-redraw-key span { display: inline-flex; align-items: center; gap: 4px; }
.map-redraw-key svg { flex: none; width: 18px; height: 18px; }
.map-operator-layer { position: absolute; inset: 0; pointer-events: none; }
.map-operator-layer .map-unit {
  position: absolute;
  transform: translate(-50%, -50%);
  pointer-events: auto;
  width: 8.4%;
  aspect-ratio: 1;
}
.map-operator-layer .map-unit[data-row] { width: calc(100% * 96 / 920); }
.map-operator-layer .map-summon { filter: drop-shadow(0 1px 2px rgba(0, 0, 0, .5)); }
.map-operator-layer .map-marker {
  position: absolute;
  transform: translate(-50%, -50%);
  display: grid;
  place-items: center;
  width: 7%;
  aspect-ratio: 1;
  background: #1b2927;
  color: #b8f2d9;
  border-radius: 3px;
  white-space: nowrap;
}
.map-operator-layer .map-marker:has(.map-covenant-badge) { width: calc(100% * 96 / 920); background: transparent; }
.map-covenant-badge { display: grid; place-items: center; width: 100%; aspect-ratio: 1; color: #fff; }
.map-covenant-badge > * { grid-area: 1 / 1; }
.map-covenant-badge svg { width: 100%; height: 100%; }
.map-covenant-badge img { width: var(--map-glyph-size); aspect-ratio: 1; object-fit: contain; }
.map-covenant-badge img:not([hidden]) + span { display: none; }
.map-scene-key i {
  display: inline-grid;
  place-items: center;
  min-width: 1.45em;
  border: 1px solid currentColor;
  padding: 1px 2px;
  border-radius: 3px;
  font-style: normal;
  font-weight: 700;
  line-height: 1;
}
.map-scene-key { display: flex; align-items: center; gap: 4px; color: var(--text-mute); font-size: 12px; }
.map-reference { position: relative; }
.map-reference span, .map-gate-pin {
  position: absolute;
  transform: translate(-50%, -50%);
  padding-inline: 2px;
  border-radius: 3px;
  color: #fff;
  background: #10181c;
  font-size: clamp(8px, 1.1vw, 12px);
  font-variant-numeric: tabular-nums;
  line-height: 1.25;
}
.map-gate-pin {
  z-index: 1;
  padding: 2px 4px;
  box-shadow: 0 0 0 1px #0c1216;
  pointer-events: none;
}
.map-gate-blue { color: #daefff; background: #184c71; }
.map-gate-red { color: #ffe5dc; background: #7b3437; }
.map-gate-exit { color: var(--map-exit); background: var(--map-exit-dark); }
.map-filters {
  position: sticky;
  top: -21px;
  z-index: 20;
  display: flex;
  align-items: flex-end;
  flex-wrap: wrap;
  gap: 8px 14px;
  padding: 29px 0 26px;
  /* 显式宽度约束：防止 sticky 定位时因包含块计算异常导致宽度超出容器 */
  width: 100%;
  min-width: 0;
  box-sizing: border-box;
  background: linear-gradient(180deg, var(--bg-card) 0%, var(--bg-card) 40%, transparent 100%);
  pointer-events: none;
}
.map-filters > * { pointer-events: auto; }
.map-filters .map-switch-bar { flex: 1 1 100%; min-width: 0; }
#aegir-hp-open {
  display: inline-flex;
  align-items: center;
  width: auto;
  min-height: 44px;
  padding: 0 20px;
  border-radius: 999px;
  background: var(--bg-panel);
  font-weight: 700;
}
.map-switch-bar {
  position: relative;
  display: flex;
  overflow-x: auto;
  overflow-y: hidden;
  scrollbar-width: none;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--bg-panel);
  /* 防止作为 flex 容器时因子项 min-width:max-content 导致元素宽度超出父容器 */
  min-width: 0;
}
.map-switch-bar::-webkit-scrollbar { display: none; }
.map-switch-bar .map-switch-thumb {
  position: absolute;
  top: 0;
  left: 0;
  border-radius: 999px;
  background: var(--accent);
  transition: transform .22s ease, width .22s ease, height .22s ease;
}
.map-switch-bar .map-switch-opt {
  position: relative;
  z-index: 1;
  flex: 1 1 auto;
  min-width: max-content;
  min-height: 44px;
  padding: 0 8px;
  border: 0;
  background: none;
  color: var(--text-dim);
  font: inherit;
  font-size: 14px;
  font-weight: 700;
  line-height: 1.25;
  white-space: nowrap;
  cursor: pointer;
}
.map-switch-short { display: none; }
.map-switch-bar .map-switch-opt:hover { color: var(--text); }
.map-switch-bar .map-switch-opt[aria-pressed="true"] { color: #10181c; }
.map-switch-bar .map-switch-opt:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; border-radius: 12px; }
.map-switch {
  position: relative;
  display: inline-flex;
  width: min(100%, 340px);
  min-height: 44px;
  padding: 0;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--bg-panel);
  font: inherit;
  cursor: pointer;
}
.map-switch:hover { border-color: var(--accent-dim); }
.map-switch:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.map-switch-thumb {
  position: absolute;
  inset: 3px auto 3px 3px;
  width: calc(50% - 4px);
  border-radius: 999px;
  background: var(--accent);
  transition: transform .18s ease;
}
.map-switch[aria-checked="true"] .map-switch-thumb { transform: translateX(calc(100% + 2px)); }
.map-switch-option {
  position: absolute;
  top: 0;
  bottom: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 50%;
  color: var(--text-dim);
  font-size: 14px;
  font-weight: 700;
  transition: color .18s ease;
}
.map-switch-option-left { left: 0; }
.map-switch-option-right { right: 0; }
.map-switch[aria-checked="false"] .map-switch-option-left,
.map-switch[aria-checked="true"] .map-switch-option-right { color: #10181c; }
.map-selected-title { margin: 12px 0 6px; color: var(--text); font-size: clamp(26px, 3vw, 34px); line-height: 1.25; }
.map-results { display: grid; gap: 28px; }
.map-battle-group { display: grid; gap: 18px; min-width: 0; }
.map-battle-group + .map-battle-group { border-top: 1px solid var(--line); padding-top: 24px; }
.map-battle-group > h3 { margin: 0; color: var(--text); font-size: 24px; line-height: 1.35; }
.map-stage { display: grid; gap: 10px; min-width: 0; }
.map-stage + .map-stage { border-top: 1px solid var(--line); padding-top: 16px; }
.map-stage > h4 { margin: 0; color: var(--text); font-size: 20px; line-height: 1.4; }
.map-plan { gap: 6px; container-type: inline-size; }
.map-plan + .map-plan { margin-top: 8px; }
.map-plan-head { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px 12px; }
.map-plan-head-tools { display: inline-flex; align-items: center; gap: 10px; }
.map-mirror {
  min-height: 34px;
  padding: 4px 14px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--bg-panel);
  color: var(--text-dim);
  font: inherit;
  font-size: 13px;
  cursor: pointer;
}
.map-mirror:hover { color: var(--text); border-color: var(--accent-dim); }
.map-mirror[aria-pressed="true"] { color: var(--accent-glow); border-color: var(--accent); }
.map-mirror:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.map-plan > h5 { margin: 0; font-size: 18px; line-height: 1.5; color: var(--text); }
.map-plan figure { position: relative; margin: 0; min-width: 0; }
.map-plan :is(.map-board, .map-redraw) { width: min(100%, max(600px, 66.667%)); }
.map-plan .map-board { padding: 0; border: 0; background: none; }
@media (max-width: 768px) {
  .map-switch-bar .map-switch-opt { font-size: 12px; }
  .map-switch-full { display: none; }
  .map-switch-short { display: inline; }
  #aegir-positioning > .article-masthead { margin-bottom: 8px; }
  #aegir-positioning > .article-masthead + .article-section { margin-top: 0; }
  .map-filters {
    top: 0;
    display: grid;
    grid-template-columns: minmax(0, 340px) 1fr;
    gap: 8px;
    padding: 4px 0 12px;
  }
  .map-filters .map-switch-bar { grid-column: 1 / -1; }
  #aegir-hp-open { justify-self: start; white-space: nowrap; }
  .map-plan :is(.map-board, .map-redraw) { width: 100%; }
  .map-entry { grid-template-columns: clamp(96px, 28vw, 132px) minmax(0, 1fr); }
}

.map-plan-content { display: grid; gap: 16px; align-items: start; min-width: 0; }
.map-plan-content > figure { width: min(100%, max(600px, 66.667%)); }
.map-plan-content :is(.map-board, .map-redraw) { width: 100%; }
.map-plan-notes { min-width: 0; max-width: 72ch; font-size: 16px; line-height: 1.75; color: var(--text); }
.map-plan-notes h6 { margin: 0 0 8px; font-size: inherit; color: var(--text-dim); }
.map-plan-notes ul { margin: 0; padding-left: 1.2em; }
.map-plan-notes li + li { margin-top: 8px; }
.map-unit-index { position: absolute; right: 4%; bottom: -5%; display: grid; place-items: center; min-width: 1.2em; height: 1.2em; font: 700 clamp(11px, 2.2cqw, 17px)/1 sans-serif; color: #fff; background: var(--bg-deep, #10171b); border-radius: 50%; }
.map-formula { position: relative; width: min(100%, 440px); user-select: none; }
.map-formula .map-operator-layer :is(.map-unit, .map-marker) { width: calc(100% / var(--formula-cols)); }
.map-plan-formula > figure { width: 100%; }
@container (min-width: 760px) {
  .map-plan-formula { grid-template-columns: 440px minmax(0, 1fr); gap: 24px; }
}
@container (min-width: 900px) {
  .map-plan-content:not(.map-plan-formula) { grid-template-columns: max(600px, 66.667%) minmax(0, 1fr); gap: 24px; }
  .map-plan-content:not(.map-plan-formula) > figure { width: 100%; }
}

.map-plan figcaption { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
.map-plan a { justify-self: start; }
.map-entry:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.map-cell-route { background: #295846; }
.map-cell-floor { background: repeating-linear-gradient(135deg, #1b382f 0 4px, #254638 4px 8px); }
.map-cell-fence { background: #295846; border-color: #94d4ac; box-shadow: inset 0 0 0 1px #94d4ac; }
.map-cell-high, .map-cell-platform { background: #52476e; border-color: #8d7bac; }
.map-cell-high-blocked { background: repeating-linear-gradient(135deg, #30263d 0 4px, #483750 4px 8px); border-color: #765f81; }
.map-cell-obstacle, .map-cell-device { background: #3a4146; border-color: #535d64; }
.map-cell-blue { background: #203f54; color: #a9dfff; }
.map-cell-red { background: #6c363c; color: #ffd4cb; }
.map-cell-exit { background: #604629; color: #ffdbab; }
.map-cell-swamp { background: repeating-linear-gradient(135deg, #345245 0 5px, #48634a 5px 10px); }
.map-cell-special { background: #365a53; color: #cdf6e7; }
.map-cell-unknown { background: var(--bg-deep); color: var(--text-mute); }
.map-cell, .map-legend i { font-size: clamp(10px, 1.4vw, 15px); font-weight: 700; }
.map-legend { display: flex; flex-wrap: wrap; gap: 4px 12px; color: var(--text-dim); font-size: 13px; }
.map-legend span { display: inline-flex; align-items: center; gap: 5px; }
.map-legend i { display: inline-grid; place-items: center; width: 19px; height: 19px; border: 1px solid var(--border); border-radius: 3px; font-style: normal; }
.map-legend .map-cell-fence { border-color: #94d4ac; }
.map-legend .map-cell-high-blocked { border-color: #765f81; }
.map-reference-toggle > summary { width: fit-content; padding: 9px 3px; color: var(--accent-glow); cursor: pointer; }
.map-reference-toggle > div { max-width: 595px; }
.map-marker {
  color: var(--accent-glow);
  border-color: var(--accent);
  font-size: clamp(8px, 1.3vw, 13px);
  font-weight: 700;
  line-height: 1.15;
  text-align: center;
}
.map-plan-sources { display: flex; flex-wrap: wrap; gap: 0 18px; }
.map-plan-actions { display: flex; align-items: center; flex-wrap: wrap; gap: 4px 10px; color: var(--text-mute); font-size: 13px; }
.map-open-reference {
  justify-self: start;
  min-height: 44px;
  padding: 5px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-control);
  background: var(--bg-panel);
  color: var(--accent-glow);
  font: inherit;
  cursor: pointer;
}
.map-open-reference:hover { border-color: var(--accent); }
.map-open-reference:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.map-plan-actions .map-open-reference { border: 0; padding-inline: 0; background: none; text-decoration: underline; text-underline-offset: .2em; }
.map-plan-actions .map-open-reference:hover { color: var(--text); }
.map-image-dialog {
  width: min(1100px, calc(100% - 20px));
  max-width: none;
  max-height: calc(100vh - 20px);
  max-height: calc(100dvh - 20px);
  margin: auto;
  padding: 0;
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: var(--radius-panel);
  background: var(--bg-card);
}
.map-image-dialog[open] { display: flex; flex-direction: column; }
.map-image-dialog::backdrop { background: rgba(7, 12, 16, .82); }
.map-image-dialog header, .map-image-dialog footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 4px 12px;
  flex-wrap: wrap;
  padding: 8px 12px;
}
.map-image-dialog header h3 { flex: 1; min-width: 160px; font-size: clamp(15px, 2vw, 21px); }
.map-image-dialog a { color: var(--accent-glow); }
.map-image-stage { min-height: 0; overflow: auto; background: var(--bg-deep); }
.map-image-stage img:not([hidden]) { display: block; margin: auto; max-width: 100%; max-height: 72vh; max-height: 72dvh; object-fit: contain; }
.map-image-stage p { padding: 14px; color: var(--text-dim); }
#aegir-map-reference .map-legend { margin-block: 0 8px; }
/* ==== AEGIR-HP-001 阿戈尔血量面板 ==== */
/* bold 版（已选定）：青色描边 + 金色数值 + 光晕 */
.map-hp-view[data-v="bold"] { background: linear-gradient(180deg, #13222b, #0c141b); border-color: rgba(101, 187, 213, 0.4); box-shadow: 0 -14px 44px rgba(79, 214, 255, 0.14); }
.map-hp-view[data-v="bold"] .map-hp-temp[aria-checked="true"] { color: var(--gold); background: rgba(230, 183, 71, 0.12); border-color: rgba(230, 183, 71, 0.75); box-shadow: 0 0 14px rgba(230, 183, 71, 0.2); }
.map-hp-view[data-v="bold"] .map-hp-temp b { color: var(--gold); }
.map-hp-view[data-v="bold"] .map-hp-op-hp { color: var(--gold); font-size: 21px; text-shadow: 0 0 12px rgba(230, 183, 71, 0.22); }
.map-hp-view[data-v="bold"] .map-hp-op-avatar { border-color: rgba(101, 187, 213, 0.6); }
.map-hp-view[data-v="bold"] .map-hp-op.elite .map-hp-op-avatar { border-color: var(--gold); box-shadow: 0 0 0 1px rgba(230, 183, 71, 0.45), 0 0 18px rgba(230, 183, 71, 0.28); }
.map-hp-view[data-v="bold"] .map-hp-op-name i { color: var(--tier, var(--text-mute)); }
.map-hp-view[data-v="bold"] .map-hp-op-eat { font-weight: 700; }
.map-hp-view[data-v="bold"] .map-hp-grip { background: rgba(101, 187, 213, 0.55); }
.map-hp-view[data-v="bold"] .map-hp-head:hover .map-hp-grip { background: rgba(131, 211, 189, 0.8); }
.map-hp-view[data-v="bold"] .map-hp-op-formula { color: rgba(190, 214, 222, 0.82); }
.map-hp-view[data-v="bold"] .map-hp-op-eat.map-hp-eat-1 { color: var(--accent-glow); background: rgba(131, 211, 189, 0.16); }
.map-hp-view[data-v="bold"] .map-hp-op-eat.map-hp-eat-3 { color: var(--gold); background: rgba(230, 183, 71, 0.16); }
.map-hp-view[data-v="bold"] .map-hp-op-eat.map-hp-eat-5 { color: #14100a; background: var(--gold); box-shadow: 0 0 12px rgba(230, 183, 71, 0.35); }
.map-hp-view {
  --hp-min-height: 48px;
  --hp-head-height: 44px;
  --hp-edge-gap: 16px;
  overscroll-behavior: contain;
  position: sticky;
  bottom: calc(-1 * var(--hp-bottom-inset, 27px));
  z-index: 30;
  display: block;
  container-type: inline-size;
  box-sizing: border-box;
  height: var(--hp-expanded-height, var(--hp-min-height));
  min-height: var(--hp-min-height);
  max-height: var(--hp-expanded-height, var(--hp-min-height));
  overflow: clip;
  padding: 0;
  background: var(--bg-panel);
  border: 1px solid var(--border-strong);
  border-radius: 10px 10px 0 0;
  box-shadow: 0 -8px 24px rgba(0, 0, 0, 0.45);
  touch-action: pinch-zoom;
  user-select: none;
  -webkit-user-select: none;
}
.map-hp-view[hidden] { display: none; }
.map-hp-view img { -webkit-user-drag: none; }
.map-hp-view.is-dragging, .map-hp-view.is-dragging * { cursor: grabbing; }
.map-hp-view > .map-hp-head {
  height: var(--hp-head-height);
  box-sizing: border-box;
  align-items: center;
  margin: 0;
  padding: 0 12px;
}
.map-hp-close {
  position: absolute;
  top: 0;
  right: 8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 80px;
  min-height: 44px;
  padding: 0 10px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  box-shadow: none;
  color: var(--text-dim);
  font: inherit;
  font-size: 16px;
  white-space: nowrap;
  cursor: pointer;
}
.map-hp-close:hover, .map-hp-close:active { color: var(--accent-glow); background: transparent; border: 0; box-shadow: none; }
.map-hp-close:focus-visible { outline: 2px solid var(--accent); outline-offset: -3px; }
.map-hp-body {
  box-sizing: border-box;
  height: calc(var(--hp-expanded-height, var(--hp-min-height)) - var(--hp-head-height) - 2px);
  touch-action: pinch-zoom;
  overflow: auto;
  overscroll-behavior: contain;
  scrollbar-width: none;
  padding: 0 clamp(10px, 2vw, 24px) 14px;
}
.map-hp-body::-webkit-scrollbar { display: none; }
.map-hp-head {
  position: relative;
  display: flex;
  justify-content: center;
  margin: -10px -10px 4px;
  padding: 8px 10px 4px;
  cursor: ns-resize;
  touch-action: none;
  user-select: none;
}
.map-hp-grip {
  width: 44px;
  height: 4px;
  border-radius: 999px;
  background: var(--border-strong);
  transition: background 0.15s ease;
}
.map-hp-head:hover .map-hp-grip { background: var(--text-mute); }
.map-hp-training .map-hp-head { justify-content: flex-start; padding: 10px 14px; border-bottom: 1px solid var(--line); }
.map-hp-training .map-hp-title { flex: 1; min-width: 0; }
.map-hp-training .map-hp-title h3 { margin: 0; font-size: clamp(16px, 1.8vw, 19px); line-height: 1.3; }
.map-hp-training .map-hp-title p { margin: 2px 0 0; color: var(--text-mute); font-size: 12.5px; }
.map-hp-training .map-hp-nav {
  flex: none; width: 34px; height: 34px; border-radius: 50%;
  color: var(--text-dim); background: var(--bg-card); border: 1px solid var(--border-strong);
  font: inherit; font-size: 20px; line-height: 1; cursor: pointer;
}
.map-hp-layer-group { display: flex; align-items: center; gap: 9px; }
.map-hp-tool:focus-visible, .map-hp-temp:focus-visible, .map-hp-op:focus-visible, .map-hp-train-card:focus-visible, .map-hp-train-opt:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.map-hp-panel { display: grid; gap: 10px; }
.map-hp-controls {
  display: flex; align-items: center; gap: clamp(10px, 1.6vw, 22px); flex-wrap: wrap;
}
.map-hp-tool {
  min-height: 36px; padding: 0 14px; border-radius: 999px; cursor: pointer;
  color: var(--text-dim); background: transparent; border: 1px solid var(--border-strong);
  font: inherit; font-size: 13px; font-weight: 700;
}
.map-hp-tool:hover { color: var(--text); border-color: var(--accent-dim); }
.map-hp-tool[aria-pressed="true"] { color: var(--gold); background: var(--gold-soft); border-color: rgba(230, 183, 71, 0.55); }
.map-hp-tool-strong { color: var(--accent-glow); border-color: var(--accent-dim); }
.map-hp-temp {
  display: inline-flex; align-items: center; gap: 4px; min-height: 36px; padding: 0 14px; border-radius: 999px;
  color: var(--text-dim); background: transparent; border: 1px solid var(--border-strong);
  font: inherit; font-size: 13px; font-weight: 700; cursor: pointer;
}
.map-hp-temp:hover { color: var(--text); border-color: var(--accent-dim); }
.map-hp-temp:active { transform: scale(0.97); }
.map-hp-temp[aria-checked="true"] { color: var(--gold); background: var(--gold-soft); border-style: solid; border-color: rgba(230, 183, 71, 0.55); }
.map-hp-temp b { color: var(--accent-glow); font-variant-numeric: tabular-nums; }
.map-hp-layer-range input[type="range"] {
  -webkit-appearance: none;
  appearance: none;
  width: clamp(120px, 16vw, 200px);
  height: 4px;
  border-radius: 999px;
  background: var(--border-strong);
  cursor: pointer;
}
.map-hp-layer-range input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--accent);
  border: 2px solid var(--bg-panel);
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.4);
}
.map-hp-layer-range input[type="range"]::-moz-range-track { height: 4px; border-radius: 999px; background: var(--border-strong); }
.map-hp-layer-range input[type="range"]::-moz-range-thumb { width: 14px; height: 14px; border-radius: 50%; background: var(--accent); border: 2px solid var(--bg-panel); }
.map-hp-temp[aria-checked="true"] b { color: var(--gold); }
.map-hp-ops { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 4px 12px; }
.map-hp-op {
  display: grid; grid-template-columns: minmax(0, 1fr); justify-items: center; gap: 5px; padding: 10px 6px 9px; border-radius: 10px;
  color: var(--text); background: transparent; border: 0; font: inherit; cursor: pointer;
}
.map-hp-op:hover { background: var(--bg-hover); }
.map-hp-op.in-plan .map-hp-op-name { color: var(--accent-glow); }
.map-hp-op-avatar {
  position: relative; width: 62px; height: 62px; border-radius: 50%; overflow: hidden;
  background: var(--bg-card); border: 2px solid var(--border-strong);
}
.map-hp-op-avatar img { width: 100%; height: 100%; object-fit: cover; }
.map-hp-op-avatar { border-color: var(--blue); }
.map-hp-op.elite .map-hp-op-avatar { border-color: var(--gold); box-shadow: 0 0 0 1px rgba(230, 183, 71, 0.35), 0 0 10px rgba(230, 183, 71, 0.25); }
.map-hp-op-name { display: flex; align-items: baseline; gap: 5px; font-size: 14px; font-weight: 700; }
.map-hp-op-name i { color: var(--text-mute); font-size: 11.5px; font-style: normal; font-weight: 600; }
.map-hp-op-hprow { display: flex; max-width: 100%; flex-wrap: wrap; justify-content: center; align-items: center; gap: 0 8px; }
.map-hp-op-hp, .map-hp-op-eat, .map-hp-op-formula { font-family: var(--font-readout); }
.map-hp-op-hp { font-size: 20px; font-weight: 800; font-variant-numeric: tabular-nums; letter-spacing: -0.01em; }
.map-hp-op-eat { min-width: 34px; padding: 1px 10px; border-radius: 999px; font-size: 12px; font-weight: 800; font-variant-numeric: tabular-nums; text-align: center; }
.map-hp-eat-0 { color: var(--text-mute); background: rgba(137, 148, 138, 0.14); }
.map-hp-eat-1 { color: var(--accent-glow); background: var(--accent-soft); }
.map-hp-eat-3 { color: var(--gold); background: var(--gold-soft); }
.map-hp-eat-5 { color: #1d1710; background: var(--gold); }
.map-hp-op-formula {
  max-width: 100%; min-height: 3.1em; padding-top: 2px;
  color: var(--text-dim); font-size: 12px; line-height: 1.5; text-align: center;
  font-weight: 500; font-variant-numeric: tabular-nums;
}
.map-hp-op-formula > span { display: block; }
.map-hp-op-formula > span > span { white-space: nowrap; }
.map-hp-panel > .map-help { margin: 0; }
.map-hp-training {
  width: min(760px, 94vw); max-height: 90vh; padding: 0;
  border: 1px solid var(--border-strong); border-radius: 10px;
  background: var(--bg-panel); color: var(--text);
}
.map-hp-training::backdrop { background: rgba(9, 14, 17, 0.72); }
.map-hp-training .map-hp-head { padding: 10px 14px; border-bottom: 1px solid var(--line); }
.map-hp-train-body { padding: 14px clamp(12px, 2vw, 22px) 18px; overflow: auto; }
.map-hp-train-grid { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 4px 8px; }
.map-hp-train-card {
  display: grid; justify-items: center; gap: 4px; padding: 10px 4px; border-radius: 8px;
  color: var(--text); background: transparent; border: 0; font: inherit; cursor: pointer; text-align: center;
}
.map-hp-train-card:hover { background: var(--bg-hover); }
.map-hp-train-card small { color: var(--text-mute); font-size: 11px; line-height: 1.4; }
.map-hp-train-card .map-hp-op-avatar { width: 48px; height: 48px; }
.map-hp-train-name { font-size: 13px; font-weight: 700; }
.map-hp-train-editor { display: grid; gap: 14px; max-width: 560px; margin-inline: auto; }
.map-hp-train-op { display: flex; align-items: center; gap: 12px; }
.map-hp-train-op b { font-size: 17px; }
.map-hp-train-row { display: block; margin: 0; padding: 0; border: 0; }
.map-hp-train-row h4 { margin: 0 0 7px; color: var(--text-dim); font-size: 13px; }
.map-hp-train-row h4 small { color: var(--text-mute); font-weight: 500; }
.map-hp-train-opt {
  display: inline-flex; align-items: baseline; gap: 5px; margin: 0 8px 8px 0; padding: 5px 13px;
  border-radius: 6px; cursor: pointer; color: var(--text-dim);
  background: transparent; border: 1px solid var(--border-strong); font: inherit; font-size: 13px; font-weight: 700;
}
.map-hp-train-opt small { color: var(--text-mute); font-size: 11px; font-weight: 500; }
.map-hp-train-opt.active { color: var(--accent-glow); background: var(--accent-soft); border-color: var(--accent-dim); }
.map-hp-train-editor .map-help { margin: 0; }
@container (max-width: 600px) {
  .map-hp-ops { grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); }
  .map-hp-op { min-width: 0; padding: 8px 4px 7px; }
  .map-hp-op-avatar { width: 54px; height: 54px; }
  .map-hp-op-name { flex-wrap: wrap; justify-content: center; }
  .map-hp-op-hprow { gap: 6px; }
  .map-hp-view[data-v="bold"] .map-hp-op-hp { font-size: 18px; }
  .map-hp-op-formula { min-height: 0; }
}
@media (max-width: 680px) {
  .map-hp-ops, .map-hp-train-grid { grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); }
  .map-hp-op { padding: 8px 4px 7px; }
  .map-hp-op-avatar { width: 54px; height: 54px; }
  .map-hp-op-hp { font-size: 16.5px; }
  .map-hp-op-formula { min-height: 0; }
}
