/* 后宫名册·手机竖屏版（js/screens/harem.js renderHarem）。
   电脑一屏摊开：位分、夜、选秀、梦中人在左，嫔妃卡在右。手机分三页，一页只放一类事：
   嫔妃（默认，卡片一人一张，动作在拇指够得着的卡底）/ 位分（位分梯、子嗣）/ 本月（夜、选秀、梦中人）。
   页头（题、小字、页签）吸顶，合上贴底。电脑上不变：页签藏着，分块不加样式。 */

.hp-tabs, .hp-dstrip { display: none; }

@media (max-width: 860px) {
  /* ——整页：页头吸顶，正文在 modal-box 里滚，合上贴底—— */
  .modal-wrap.ov-page.harem .modal-box,
  .ui-frame .modal-wrap.ov-page.harem .modal-box { padding: 0; }
  .modal-wrap.ov-page.harem .hp { min-height: 100%; }

  .hp-head { position: sticky; top: 0; z-index: 4; background: #140d09; box-shadow: 0 6px 16px rgba(0, 0, 0, 0.45); }
  .hp-banner { height: calc(var(--safe-t) + 66px); border-bottom: 0; }
  .hp-ban-text { padding-top: var(--safe-t); background: linear-gradient(0deg, rgba(10, 6, 4, 0.9), rgba(10, 6, 4, 0.35)); }
  .modal-wrap.ov-page.harem .hp-ban-text .box-title { margin: 0; font-size: 24px; line-height: 1.2; }
  .hp-ban-text p { margin-top: 3px; font-size: 12.5px; line-height: 1.4; letter-spacing: 0.02em; }

  /* 页签：三等分，选中的压一道金线 */
  .hp-tabs { display: grid; grid-template-columns: repeat(3, 1fr); border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
  .hp-tabs button {
    position: relative; display: flex; align-items: center; justify-content: center; gap: 6px; min-height: 46px; padding: 0 4px;
    border: 0; background: transparent; color: var(--dim); font: 400 18px/1 var(--f-brush); letter-spacing: 0.25em; text-indent: 0.25em;
  }
  .hp-tabs button:active { background: rgba(201, 161, 74, 0.1); }
  .hp-tabs button.on { color: var(--gold-bright); background: linear-gradient(180deg, transparent, rgba(240, 138, 160, 0.1)); }
  .hp-tabs button.on::after { content: ""; position: absolute; left: 22%; right: 22%; bottom: 0; height: 2px; border-radius: 2px; background: var(--gold-bright); box-shadow: 0 0 8px rgba(242, 207, 122, 0.6); }
  .hp-tabs i { min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; background: rgba(240, 138, 160, 0.22); color: #ffd0da; font: 600 12px/18px var(--f-serif); letter-spacing: 0; text-indent: 0; text-align: center; }
  .hp-tabs i.dot { min-width: 0; width: 8px; height: 8px; padding: 0; background: #f08aa0; box-shadow: 0 0 6px rgba(240, 138, 160, 0.9); }

  /* ——正文：一次只露一页—— */
  .hp-body { display: block; padding: 12px 14px 20px; }
  .hp[data-tab="list"] .hp-side { display: none; }
  .hp:not([data-tab="list"]) .hp-list { display: none; }
  .hp-side .hp-blk { display: none; }
  .hp[data-tab="ladder"] .hp-blk[data-pane="ladder"],
  .hp[data-tab="month"] .hp-blk[data-pane="month"] { display: block; animation: hpIn 0.22s ease-out; }
  @keyframes hpIn { from { opacity: 0; transform: translateY(6px); } }
  .hp-side .hp-blk { margin-bottom: 12px; padding: 12px 12px 14px; border: 1px solid rgba(240, 180, 192, 0.16); border-radius: 6px; background: linear-gradient(160deg, rgba(60, 20, 28, 0.3), rgba(16, 8, 10, 0.55)); }
  .hp-side h4 { margin: 0 0 10px; font-size: 18px; }

  /* 位分梯 */
  .hp-ladder { gap: 4px; }
  .hl-row { grid-template-columns: 4.2em 2.8em minmax(0, 1fr); min-height: 38px; align-items: center; padding: 6px 10px; font-size: 14.5px; }
  .hl-rank { font-size: 17px; }
  .hl-cap { font-size: 12px; }
  .hl-who { gap: 4px 12px; }
  .hp-kids { padding-left: 20px; font-size: 14.5px; line-height: 1.9; }

  /* 本月夜、选秀、梦中人 */
  .hn { gap: 8px 10px; padding: 10px 12px; font-size: 14.5px; }
  .hn .gbtn { min-height: 40px; }
  .hp-nights, .hp-draft, .hp-dream { font-size: 14.5px; }
  .hp-draft p, .hp-dream p { font-size: 14px; line-height: 1.7; }
  .hp-draft .gbtn, .hp-dream .gbtn:not(.ghost) { width: 100%; min-height: 46px; margin-top: 4px; }
  .hp-dream .note .gbtn { width: auto; min-height: 36px; margin: 6px 0 0 6px; }

  /* ——嫔妃卡：头像压名号，出身两行，动作落在卡底—— */
  .hp-list { display: flex; flex-direction: column; gap: 12px; padding: 0; }
  .hp-nudge { padding: 8px 12px; font-size: 13px; line-height: 1.6; }
  .hc { grid-template-columns: 58px minmax(0, 1fr); grid-auto-flow: row; gap: 4px 12px; padding: 12px; }
  .hc-main { display: contents; }
  .hc-av { grid-column: 1; grid-row: 1 / span 2; width: 58px; height: 58px; align-self: center; }
  .hc-name { grid-column: 2; grid-row: 1; align-self: end; gap: 2px 8px; margin: 0; }
  .hc-name b { font-size: 21px; }
  .hc-name small { font-size: 13px; }
  .hc-tag { padding: 1px 7px; font-size: 12px; }
  .hc-favor { grid-column: 2; grid-row: 2; align-self: start; margin: 0; font-size: 13.5px; }
  .pips i { width: 10px; height: 10px; }
  .hc-line, .hc-heart, .hc-acts { grid-column: 1 / -1; }
  .hc-line { margin: 4px 0 0; font-size: 13.5px; line-height: 1.6; display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; overflow: hidden; }
  .hc-line.dim { margin-top: 0; -webkit-line-clamp: 1; }
  .hc.open .hc-line { -webkit-line-clamp: unset; }
  .hc-heart { margin: 2px 0 0; gap: 6px; }
  .hh.on { min-height: 32px; padding: 4px 10px; font-size: 13px; }
  .hh { padding: 4px 8px; font-size: 13px; }
  .hc-acts { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 8px; margin-top: 8px; padding-top: 10px; border-top: 1px dashed rgba(240, 180, 192, 0.18); }
  .hc-acts .gbtn.small { min-height: 46px; padding: 4px 8px; font-size: 15px; letter-spacing: 0.14em; }
  .hc-acts .gbtn[data-cost]:not([data-cost=""])::after { content: attr(data-cost); font: 400 11px/1.3 var(--f-serif); letter-spacing: 0.02em; opacity: 0.7; }
  .hc-acts .gbtn:last-child:nth-child(odd) { grid-column: 1 / -1; }
  .hc-acts:empty { display: none; }
  .hc.is-cold .hc-acts { border-top-color: rgba(140, 160, 180, 0.2); }

  /* 梦中人入口：嫔妃页顶上一条（首屏可见），本月页那块完整的在手机上让位 */
  .hp-dreamblk { display: none !important; }
  .hp-dstrip { display: flex; align-items: center; gap: 10px; min-height: 56px; padding: 8px 10px 8px 12px; border: 1px solid rgba(240, 138, 160, 0.4); border-radius: 6px; background: linear-gradient(100deg, rgba(110, 34, 53, 0.55), rgba(30, 12, 18, 0.7)); }
  .hp-dstrip > i { flex: none; display: grid; place-items: center; width: 32px; height: 32px; border-radius: 50%; border: 1px solid rgba(240, 180, 192, 0.5); font: normal 18px/1 var(--f-brush); color: #f6d8de; }
  .hp-dstrip p { flex: 1; min-width: 0; margin: 0; font-size: 13px; line-height: 1.5; color: #f0dccd; }
  .hp-dstrip p b { color: var(--gold-bright); font-weight: 600; }
  .hp-dstrip .gbtn { flex: none; min-height: 44px; padding: 4px 14px; white-space: nowrap; letter-spacing: 0.08em; }
  .hp-dstrip.fresh { border-color: var(--gold-bright); box-shadow: 0 0 14px rgba(242, 207, 122, 0.3); }
  .hp-dstrip.wait > i { animation: breathe 1.8s ease-in-out infinite; }

  /* ——合上：贴底一条，矮一点，把屏幕让给名册—— */
  .modal-wrap.ov-page.harem .modal-box .hp .row.end { margin: 0; padding: 8px 14px calc(8px + var(--safe-b)); }
  .modal-wrap.ov-page.harem .modal-box .hp .row.end .gbtn { min-height: 46px; }
}

@media (prefers-reduced-motion: reduce) {
  .hp-side .hp-blk { animation: none !important; }
}
