/* 玩家管理：「我的」页入口 + 直属下级列表页。站内全局样式会清掉 p、dd 的外边距，这些元素的间距用内边距。
   本文件在暗夜引擎的忽略列表里（frontend/src/utils/displayMode.js），不会被改写，所以深浅两套颜色都写在这里的变量里。 */
.jg-ap-entry, .jg-ap-sheet {
  --ap-bg: #eef2f7;
  --ap-card: #ffffff;
  --ap-soft: #f4f7fb;
  --ap-line: #e1e7f0;
  --ap-ink: #0b1a38;
  --ap-ink-2: #36435e;
  --ap-vice: #66738d;
  --ap-brand: #1560d4;
  --ap-tint: #1560d414;
  --ap-glass: #ffffffb8;
  --ap-glass-line: #0f23501a;
  --ap-shadow: 0 0 0 1px #0f23500d, 0 1px 2px #0f23500a, 0 .21rem .53rem -.26rem #0f23502e;
  --ap-on: #0f8a5f;
  --ap-on-bg: #0f8a5f17;
  --ap-off: #66738d;
  --ap-off-bg: #66738d1a;
  --ap-shimmer: #e7ecf3;
}
:root[data-jg-mode="dark"] :is(.jg-ap-entry, .jg-ap-sheet) {
  --ap-bg: #101a2d;
  --ap-card: #1b2a44;
  --ap-soft: #223452;
  --ap-line: #ffffff14;
  --ap-ink: #e6efff;
  --ap-ink-2: #c1d0e6;
  --ap-vice: #93a5c0;
  --ap-brand: #85baff;
  --ap-tint: #85baff1f;
  --ap-glass: #16233ab8;
  --ap-glass-line: #ffffff14;
  --ap-shadow: 0 0 0 1px #ffffff12, 0 1px 2px #00000040;
  --ap-on: #5fd8a8;
  --ap-on-bg: #5fd8a81f;
  --ap-off: #93a5c0;
  --ap-off-bg: #93a5c01f;
  --ap-shimmer: #24364f;
}

/* ---------- 入口：和原菜单行同样的图标尺寸（.main_img .53rem）和箭头，文字对齐；
   「我的」页新版提供 .jg-me-tile / .jg-me-chevron 时，由新版样式决定外观 ---------- */
.jg-ap-entry { cursor: pointer; }
:where(.jg-ap-entry__icon) { display: inline-flex; flex: none; width: .53333rem; height: .53333rem; color: var(--ap-brand); }
:where(.jg-ap-entry__chevron) { display: inline-flex; flex: none; width: .4rem; height: .4rem; color: var(--ap-vice); }
:where(.jg-ap-entry) svg { display: block; width: 100%; height: 100%; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }

/* ---------- 列表页外壳：复用选择页，顶栏改成玻璃 ---------- */
:root .jg-ap-sheet { background: var(--ap-bg); color: var(--ap-ink); touch-action: pan-y; }
:root .jg-ap-sheet .jg-sheet__head {
  z-index: 3; background: var(--ap-glass); box-shadow: 0 1px 0 var(--ap-glass-line);
  -webkit-backdrop-filter: blur(18px) saturate(160%); backdrop-filter: blur(18px) saturate(160%);
}
:root .jg-ap-sheet .jg-sheet__title { color: var(--ap-ink); font-weight: 600; }
:root .jg-ap-sheet .jg-sheet__back { color: var(--ap-ink); }
:root .jg-ap { position: relative; overflow-x: hidden; padding: 0 .32rem calc(.4rem + env(safe-area-inset-bottom)); overscroll-behavior: contain; }

/* ---------- 搜索栏：吸顶，卡片从玻璃下面滑过 ---------- */
.jg-ap__bar {
  position: sticky; top: 0; z-index: 2; margin: 0 -.32rem; padding: .28rem .32rem .2rem;
  background: var(--ap-glass); box-shadow: 0 1px 0 var(--ap-glass-line);
  -webkit-backdrop-filter: blur(18px) saturate(160%); backdrop-filter: blur(18px) saturate(160%);
}
.jg-ap__bar[hidden] { display: none; }
.jg-ap__search {
  display: flex; align-items: center; gap: .16rem; height: 1rem; padding: 0 .12rem 0 .32rem; border-radius: .5rem;
  color: var(--ap-vice); background: var(--ap-card); box-shadow: var(--ap-shadow);
  transition: box-shadow .2s ease;
}
.jg-ap__search:focus-within { box-shadow: 0 0 0 2px var(--ap-brand); }
.jg-ap__search svg { flex: none; width: .46rem; height: .46rem; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.jg-ap__search input {
  flex: 1; min-width: 0; height: 100%; padding: 0; border: 0; outline: 0; border-radius: 0;
  background: transparent; color: var(--ap-ink); font: inherit; font-size: .42667rem;
  -webkit-appearance: none; appearance: none;
}
.jg-ap__search input::placeholder { color: var(--ap-vice); opacity: 1; }
.jg-ap__search input::-webkit-search-cancel-button { display: none; }
.jg-ap__clear {
  display: inline-flex; flex: none; align-items: center; justify-content: center; width: .76rem; height: .76rem; padding: .16rem;
  border: 0; border-radius: 50%; background: transparent; color: var(--ap-vice); cursor: pointer;
}
.jg-ap__clear[hidden] { display: none; }
.jg-ap__clear:active { background: var(--ap-soft); }
.jg-ap__clear svg { width: 100%; height: 100%; }
.jg-ap__count { min-height: .64rem; padding: .24rem 0 0 .12rem; font-size: .32rem; line-height: .4rem; color: var(--ap-vice); }

/* ---------- 玩家卡片 ---------- */
.jg-ap__pane { padding-top: .28rem; transition: opacity .16s ease; }
.jg-ap__pane.is-loading { opacity: .55; }
.jg-ap__list { display: grid; grid-template-columns: minmax(0, 1fr); gap: .24rem; margin: 0; padding: 0; list-style: none; }
.jg-ap-card { padding: .32rem .34rem .3rem; border-radius: .32rem; background: var(--ap-card); box-shadow: var(--ap-shadow); }
.jg-ap-card__top { display: flex; align-items: center; justify-content: space-between; gap: .2rem; }
.jg-ap-card__name { overflow: hidden; min-width: 0; font-size: .42667rem; font-weight: 650; color: var(--ap-ink); text-overflow: ellipsis; white-space: nowrap; }
.jg-ap-card__status {
  flex: none; display: inline-flex; align-items: center; gap: .1rem; height: .52rem; padding: 0 .2rem; border-radius: .26rem;
  font-size: .29333rem; font-weight: 600; color: var(--ap-off); background: var(--ap-off-bg);
}
.jg-ap-card__status::before { content: ""; width: .12rem; height: .12rem; border-radius: 50%; background: currentColor; }
.jg-ap-card__status.is-on { color: var(--ap-on); background: var(--ap-on-bg); }
.jg-ap-card dl { margin: 0; }
.jg-ap-card dd { margin: 0; }
.jg-ap-card__times { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .16rem; margin-top: .18rem !important; }
.jg-ap-card__times dt { font-size: .29333rem; color: var(--ap-vice); }
.jg-ap-card__times dd { padding-top: .04rem; font-size: .32rem; color: var(--ap-ink-2); font-variant-numeric: tabular-nums; }
.jg-ap-card__stats {
  display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1px; margin-top: .26rem !important; overflow: hidden;
  border-radius: .22rem; background: var(--ap-line); box-shadow: 0 0 0 1px var(--ap-line);
}
.jg-ap-card__stats > div { min-width: 0; padding: .2rem .24rem; background: var(--ap-card); }
.jg-ap-card__stats dt { font-size: .29333rem; color: var(--ap-vice); }
.jg-ap-card__stats dd { overflow: hidden; padding-top: .05rem; font-size: .38rem; font-weight: 600; color: var(--ap-ink); text-overflow: ellipsis; white-space: nowrap; font-variant-numeric: tabular-nums; }
.jg-ap-card__stats .is-main dd { color: var(--ap-brand); }

/* 翻页时卡片按方向滑入 */
.jg-ap__list[data-dir="next"] .jg-ap-card { animation: jg-ap-next .3s cubic-bezier(.22, 1, .36, 1) both; animation-delay: calc(var(--i, 0) * 18ms); }
.jg-ap__list[data-dir="prev"] .jg-ap-card { animation: jg-ap-prev .3s cubic-bezier(.22, 1, .36, 1) both; animation-delay: calc(var(--i, 0) * 18ms); }
@keyframes jg-ap-next { from { opacity: 0; transform: translateX(.6rem); } }
@keyframes jg-ap-prev { from { opacity: 0; transform: translateX(-.6rem); } }

.jg-ap-card.is-skeleton { height: 4.3rem; background: linear-gradient(100deg, var(--ap-card) 30%, var(--ap-shimmer) 50%, var(--ap-card) 70%); background-size: 300% 100%; animation: jg-ap-shimmer 1.3s linear infinite; }
@keyframes jg-ap-shimmer { from { background-position: 100% 0; } to { background-position: 0 0; } }

/* ---------- 空状态和错误 ---------- */
.jg-ap__notice { display: flex; flex-direction: column; align-items: center; padding: 1.6rem .6rem; text-align: center; }
.jg-ap__notice-icon { display: inline-flex; align-items: center; justify-content: center; width: 1.28rem; height: 1.28rem; border-radius: 50%; color: var(--ap-brand); background: var(--ap-tint); }
.jg-ap__notice-icon svg { width: .72rem; height: .72rem; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.jg-ap__notice-title { padding-top: .32rem; font-size: .4rem; font-weight: 600; color: var(--ap-ink); }
.jg-ap__notice-hint { padding-top: .12rem; font-size: .32rem; line-height: 1.5; color: var(--ap-vice); }
.jg-ap__retry { height: .9rem; margin-top: .36rem !important; padding: 0 .6rem; border: 0; border-radius: .45rem; background: var(--ap-brand); color: #fff; font: inherit; font-size: .36rem; font-weight: 600; cursor: pointer; }
:root[data-jg-mode="dark"] .jg-ap__retry { color: #0b1a38; }

/* ---------- 翻页：吸底玻璃胶囊 ---------- */
.jg-ap__pager {
  position: sticky; bottom: calc(.3rem + env(safe-area-inset-bottom)); z-index: 2;
  display: flex; align-items: center; justify-content: space-between; gap: .12rem;
  width: max-content; max-width: 100%; margin: .36rem auto 0; padding: .1rem; border-radius: .6rem;
  background: var(--ap-glass); box-shadow: 0 0 0 1px var(--ap-glass-line), 0 .2rem .5rem -.2rem #0f235059;
  -webkit-backdrop-filter: blur(18px) saturate(160%); backdrop-filter: blur(18px) saturate(160%);
}
.jg-ap__pager[hidden] { display: none; }
.jg-ap__pager button {
  display: inline-flex; align-items: center; gap: .06rem; height: .92rem; padding: 0 .28rem; border: 0; border-radius: .46rem;
  background: var(--ap-card); box-shadow: var(--ap-shadow); color: var(--ap-brand); font: inherit; font-size: .34667rem; font-weight: 600; cursor: pointer;
  transition: transform .18s cubic-bezier(.22, 1, .36, 1), opacity .18s ease;
}
.jg-ap__pager button:active:not(:disabled) { transform: scale(.95); }
.jg-ap__pager button:disabled { opacity: .4; cursor: default; }
.jg-ap__pager svg { width: .4rem; height: .4rem; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }
.jg-ap__page { padding: 0 .16rem; font-size: .33rem; color: var(--ap-ink-2); white-space: nowrap; font-variant-numeric: tabular-nums; }

.jg-ap :is(button, input):focus-visible { outline: 2px solid var(--ap-brand); outline-offset: 2px; }
.jg-ap__search input:focus-visible { outline: 0; }

/* ---------- 宽屏：responsive.css 已把选择页让开侧栏；这里按可用宽度排多列 ---------- */
@media (min-width: 640px) {
  :root .jg-ap { padding: 0 24px 24px; }
  .jg-ap__bar { margin: 0 -24px; padding: 16px 24px 12px; }
  .jg-ap__search { max-width: 480px; height: 44px; }
  .jg-ap__search input { font-size: 15px; }
  .jg-ap__list { grid-template-columns: repeat(auto-fill, minmax(min(340px, 100%), 1fr)); gap: 16px; }
  .jg-ap__pane { padding-top: 16px; }
  .jg-ap-card__name { font-size: 16px; }
  .jg-ap-card { padding: 16px; border-radius: 14px; }
}
@media (prefers-reduced-motion: reduce) {
  .jg-ap__list .jg-ap-card, .jg-ap-card.is-skeleton { animation: none; }
}
