/* ============================================================
   ガチャキング統計  ページ専用スタイル
   design-system.css / site.css の上に重ねる
   ============================================================ */

/* --- タブパネル --- */
.gk-panel { display: block; padding-top: var(--pb-space-5); }
.gk-panel[hidden] { display: none; }

.gk-section { margin-bottom: var(--pb-space-10); }
.gk-section__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: var(--pb-space-3);
  margin: 0 0 var(--pb-space-5);
}
.gk-section__head h2 { margin: 0; }
.gk-section__head--end { justify-content: flex-end; }
.gk-section__count {
  font-size: 15px;
  color: var(--pb-muted);
  font-weight: var(--pb-fw-bold);
}

/* --- ソート切り替え --- */
.gk-sort { display: inline-flex; gap: var(--pb-space-2); }
.gk-sort__btn {
  font-size: 17px;
  padding: 7px 18px;
  background: rgba(255, 255, 255, .6);
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
}
.gk-sort__btn.is-active {
  background: var(--pb-text);
  color: var(--pb-primary);
  border-color: var(--pb-text);
}

/* ============================================================
   全体画面（オーバービュー）
   ============================================================ */
.gk-ov { display: flex; flex-direction: column; gap: var(--pb-space-6); }
.gk-ov__meta {
  margin: 0;
  font-size: 14px;
  color: var(--pb-muted);
  font-weight: var(--pb-fw-bold);
  letter-spacing: .03em;
  min-height: 1em;
}

/* 総ガチャ回数ヒーロー */
.gk-ov__hero {
  position: relative;
  overflow: hidden;
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 6px 14px;
  padding: var(--pb-space-8) var(--pb-space-8);
  border-radius: var(--pb-radius);
  background: linear-gradient(135deg, rgba(22, 22, 22, .94), rgba(40, 40, 40, .9));
  color: var(--pb-surface);
  border: 1px solid rgba(255, 255, 255, .08);
  box-shadow: 0 20px 50px rgba(0, 0, 0, .25);
}
.gk-ov__hero::before {
  content: "";
  position: absolute;
  width: 360px; height: 360px;
  top: -130px; right: -70px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(178, 247, 40, .4), transparent 70%);
  filter: blur(20px);
  pointer-events: none;
}
.gk-ov__hero > * { position: relative; z-index: 1; }
.gk-ov__hero-label { font-size: 18px; font-weight: var(--pb-fw-bold); color: rgba(255, 255, 255, .7); width: 100%; }
.gk-ov__hero-value { font-size: 72px; font-weight: var(--pb-fw-black); line-height: 1; color: var(--pb-primary); }
.gk-ov__hero-unit { font-size: 26px; font-weight: var(--pb-fw-bold); }
.gk-ov__hero-note { font-size: 13px; color: rgba(255, 255, 255, .55); width: 100%; }

.gk-ov__heading {
  font-size: 22px;
  font-weight: var(--pb-fw-bold);
  margin: var(--pb-space-2) 0 calc(-1 * var(--pb-space-2));
  display: flex;
  align-items: baseline;
  gap: 12px;
  flex-wrap: wrap;
}
.gk-ov__heading-sub { font-size: 13px; font-weight: var(--pb-fw-regular); color: var(--pb-muted); }

/* 排出数カード */
.gk-ov__counts {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: var(--pb-space-4);
}
.gk-count-card {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: var(--pb-space-5);
  border-radius: var(--pb-radius);
  background: rgba(255, 255, 255, .58);
  -webkit-backdrop-filter: blur(16px) saturate(160%);
  backdrop-filter: blur(16px) saturate(160%);
  border: 1px solid rgba(255, 255, 255, .75);
  box-shadow: 0 8px 26px rgba(20, 30, 10, .08);
}
.gk-count-card__label { font-size: 16px; font-weight: var(--pb-fw-bold); color: var(--pb-muted); }
.gk-count-card__val { font-size: 22px; font-weight: var(--pb-fw-bold); }
.gk-count-card__val b { font-size: 34px; font-weight: var(--pb-fw-black); color: var(--pb-text); }
.gk-count-card__val small { font-size: 15px; color: var(--pb-muted); }
.gk-count-card .pb-bar { height: 10px; }

/* 安定指数ゲージ */
.gk-ov__gauges {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: var(--pb-space-4);
}
.gk-gauge {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  padding: var(--pb-space-5);
  border-radius: var(--pb-radius);
  background: rgba(255, 255, 255, .58);
  -webkit-backdrop-filter: blur(16px) saturate(160%);
  backdrop-filter: blur(16px) saturate(160%);
  border: 1px solid rgba(255, 255, 255, .75);
  box-shadow: 0 8px 26px rgba(20, 30, 10, .08);
}
.gk-gauge--hero {
  background: linear-gradient(135deg, rgba(22, 22, 22, .94), rgba(40, 40, 40, .9));
  border-color: rgba(255, 255, 255, .1);
}
.gk-gauge--hero .gk-gauge__label { color: var(--pb-surface); }
.gk-gauge__ring {
  --val: 0;
  --col: var(--pb-primary);
  width: 120px; height: 120px;
  border-radius: 50%;
  background:
    conic-gradient(var(--col) calc(var(--val) * 1%), rgba(150, 150, 150, .25) 0);
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
}
.gk-gauge--hero .gk-gauge__ring {
  background:
    conic-gradient(var(--col) calc(var(--val) * 1%), rgba(255, 255, 255, .12) 0);
}
.gk-gauge__ring::before {
  content: "";
  position: absolute;
  inset: 12px;
  border-radius: 50%;
  background: var(--pb-surface);
}
.gk-gauge--hero .gk-gauge__ring::before { background: #1f1f1f; }
.gk-gauge__num {
  position: relative;
  z-index: 1;
  font-size: 38px;
  font-weight: var(--pb-fw-black);
  line-height: 1;
}
.gk-gauge__label { font-size: 17px; font-weight: var(--pb-fw-bold); }
.gk-gauge__judge { font-size: 14px; font-weight: var(--pb-fw-bold); }

/* 安定指数の説明アコーディオン（初期は控えめ） */
.gk-formula { margin-top: var(--pb-space-3); }
.gk-formula__summary {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  width: fit-content;
  list-style: none;
  cursor: pointer;
  font-size: 12.5px;
  color: var(--pb-muted);
  padding: 4px 2px;
  transition: color .15s ease;
}
.gk-formula__summary::-webkit-details-marker { display: none; }
.gk-formula__summary .pb-icon { font-size: 16px; }
.gk-formula__summary:hover { color: var(--pb-text); }
.gk-formula[open] .gk-formula__summary { color: var(--pb-text); font-weight: var(--pb-fw-bold); margin-bottom: var(--pb-space-3); }
.gk-formula__body {
  font-size: 14px;
  line-height: 1.7;
  color: var(--pb-text);
  background: rgba(255, 255, 255, .55);
  -webkit-backdrop-filter: blur(14px);
  backdrop-filter: blur(14px);
  border: 1px solid rgba(255, 255, 255, .75);
  border-radius: var(--pb-radius);
  padding: var(--pb-space-5) var(--pb-space-6);
}
.gk-formula__body h4 {
  font-size: 15px;
  margin: var(--pb-space-4) 0 var(--pb-space-2);
  padding-left: 10px;
  border-left: 4px solid var(--pb-primary);
}
.gk-formula__body p { margin: 0 0 var(--pb-space-2); }
.gk-formula__body ol { margin: 0; padding-left: 1.4em; }
.gk-formula__body ol li { margin-bottom: 8px; }
.gk-formula__body code {
  display: inline-block;
  font-family: ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;
  font-size: 13px;
  background: rgba(26, 26, 26, .06);
  padding: 3px 8px;
  border-radius: 6px;
  margin-top: 4px;
}
.gk-formula__table { border-collapse: collapse; width: 100%; margin: 4px 0 0; }
.gk-formula__table th,
.gk-formula__table td {
  border: 1px solid rgba(26, 26, 26, .1);
  padding: 8px 12px;
  text-align: left;
  vertical-align: top;
  font-size: 13.5px;
}
.gk-formula__table th { width: 90px; background: rgba(26, 26, 26, .04); font-weight: var(--pb-fw-bold); }
.gk-formula__note { font-size: 13px; color: var(--pb-muted); margin-top: var(--pb-space-2) !important; }
.gk-formula__legend { list-style: none; margin: 4px 0 0; padding: 0; }
.gk-formula__legend li { display: flex; align-items: center; gap: 8px; font-size: 13.5px; margin-bottom: 4px; }
.gk-dot { width: 12px; height: 12px; border-radius: 50%; flex: 0 0 auto; }

/* ============================================================
   統計カード（ルール / ステージ / ブキ 共通）
   ============================================================ */
.gk-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: var(--pb-space-4);
}
.gk-grid--weapons {
  grid-template-columns: repeat(auto-fill, minmax(138px, 1fr));
  gap: var(--pb-space-3);
}

.gk-card {
  position: relative;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  border-radius: var(--pb-radius);
  background: rgba(255, 255, 255, .58);
  -webkit-backdrop-filter: blur(16px) saturate(160%);
  backdrop-filter: blur(16px) saturate(160%);
  border: 1px solid rgba(255, 255, 255, .75);
  box-shadow: 0 8px 26px rgba(20, 30, 10, .08);
  transition: transform .2s ease, box-shadow .25s ease, border-color .25s ease;
}
.gk-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 18px 38px rgba(178, 247, 40, .20), 0 8px 20px rgba(0, 0, 0, .10);
  border-color: rgba(178, 247, 40, .5);
}

.gk-card__img {
  position: relative;
  aspect-ratio: 16 / 9;
  background: linear-gradient(160deg, #ffffff, #eef0ef);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}
.gk-card__img img {
  width: 100%; height: 100%;
  object-fit: cover;
}
/* contain：画像全体を縦幅に収める（ブキ・ルール） */
.gk-card--contain .gk-card__img img {
  object-fit: contain;
  padding: 8px;
}

.gk-card__body {
  padding: var(--pb-space-3) var(--pb-space-4) var(--pb-space-4);
  display: flex;
  flex-direction: column;
  gap: 8px;
  flex: 1 0 auto;
}
.gk-card__name {
  font-size: 16px;
  font-weight: var(--pb-fw-bold);
  line-height: 1.3;
}
.gk-grid--weapons .gk-card__name { font-size: 13.5px; }

.gk-card__meter {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: auto;
}
.gk-card__meter .pb-bar { flex: 1 1 auto; height: 12px; }
.gk-card__count {
  font-size: 22px;
  font-weight: var(--pb-fw-black);
  line-height: 1;
  white-space: nowrap;
}
.gk-card__count span { font-size: 12px; font-weight: var(--pb-fw-bold); margin-left: 1px; }
.gk-grid--weapons .gk-card__count { font-size: 18px; }

/* 最多／最少の回数を強調（回数の数字に色付け） */
.gk-card--top .gk-card__count { color: var(--pb-primary-active); }

/* ============================================================
   チームカード（コンパクト：名前・メンバー・ガチャ回数）
   ============================================================ */
.gk-team-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: var(--pb-space-4);
}
.gk-tc {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: var(--pb-space-3);
  padding: var(--pb-space-5);
  text-align: left;
  cursor: pointer;
  border-radius: var(--pb-radius);
  background: rgba(255, 255, 255, .6);
  -webkit-backdrop-filter: blur(18px) saturate(165%);
  backdrop-filter: blur(18px) saturate(165%);
  border: 1px solid rgba(255, 255, 255, .78);
  box-shadow: 0 8px 26px rgba(20, 30, 10, .08);
  font-family: inherit;
  color: var(--pb-text);
  transition: transform .2s ease, box-shadow .25s ease, border-color .25s ease;
}
.gk-tc:hover {
  transform: translateY(-4px);
  box-shadow: 0 20px 40px rgba(178, 247, 40, .2), 0 8px 20px rgba(0, 0, 0, .1);
  border-color: rgba(178, 247, 40, .55);
}
.gk-tc__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.gk-tc__gacha {
  font-size: 13px;
  font-weight: var(--pb-fw-bold);
  color: var(--pb-text);
  background: var(--pb-primary);
  padding: 3px 14px;
  border-radius: var(--pb-radius-full);
}
.gk-tc__gacha b { font-size: 16px; font-weight: var(--pb-fw-black); }
.gk-tc__stability { font-size: 22px; font-weight: var(--pb-fw-black); line-height: 1; }
.gk-tc__name {
  margin: 0;
  font-size: 23px;
  font-weight: var(--pb-fw-black);
  line-height: 1.2;
}
.gk-tc__reading {
  font-size: 12px;
  color: var(--pb-muted);
  margin-top: -8px;
}
.gk-tc__members {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin-top: 2px;
}
.gk-tc__member {
  font-size: 14px;
  font-weight: var(--pb-fw-bold);
  padding: 4px 12px;
  border-radius: var(--pb-radius-full);
  background: rgba(26, 26, 26, .06);
}
.gk-tc__more {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin-top: auto;
  padding-top: 6px;
  font-size: 14px;
  font-weight: var(--pb-fw-bold);
  color: var(--pb-primary-active);
}
.gk-tc__more .pb-icon { font-size: 18px; transition: transform .2s ease; }
.gk-tc:hover .gk-tc__more .pb-icon { transform: translateX(3px); }

/* チームカード：多様性チップ */
.gk-tc__diversity {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  align-items: center;
  margin-top: 4px;
}
.gk-tc__div-chip {
  font-size: 11px;
  color: var(--pb-muted);
  background: rgba(26,26,26,.06);
  border-radius: var(--pb-radius-full);
  padding: 2px 8px;
}
.gk-tc__div-chip b { color: var(--pb-text); }
.gk-tc__div-score { font-size: 11px; margin-left: 2px; }
.gk-tc__div-score b { font-weight: var(--pb-fw-black); }

/* モーダル：チーム安定指数ゲージ（コンパクト） */
.gk-div__gauges {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: var(--pb-space-3);
  margin-bottom: var(--pb-space-4);
}
.gk-gauge--sm { gap: 6px; padding: var(--pb-space-3); }
.gk-gauge--sm .gk-gauge__ring { width: 72px; height: 72px; }
.gk-gauge--sm .gk-gauge__ring::before { inset: 8px; }
.gk-gauge--sm .gk-gauge__num { font-size: 22px; }
.gk-gauge--sm .gk-gauge__label { font-size: 13px; }
.gk-gauge--sm .gk-gauge__judge { font-size: 11px; }

/* ============================================================
   チーム詳細モーダル
   ============================================================ */
.gk-modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: none;
  align-items: center;
  justify-content: center;
  padding: var(--pb-space-4);
  background: rgba(0, 0, 0, .55);
  -webkit-backdrop-filter: blur(4px);
  backdrop-filter: blur(4px);
}
.gk-modal-backdrop.is-open { display: flex; animation: pb-fade-up .25s ease both; }
.gk-modal {
  position: relative;
  width: 100%;
  max-width: 720px;
  max-height: 88vh;
  overflow: hidden;
  border-radius: var(--pb-radius);
  background: var(--pb-surface);
  box-shadow: 0 30px 80px rgba(0, 0, 0, .4);
}
.gk-modal__close {
  position: absolute;
  top: 14px; right: 14px;
  z-index: 2;
  width: 42px; height: 42px;
  border: none;
  border-radius: 50%;
  background: rgba(26, 26, 26, .06);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.gk-modal__close:hover { background: rgba(26, 26, 26, .12); }
.gk-modal__body {
  max-height: 88vh;
  overflow-y: auto;
  padding: var(--pb-space-8);
}
.gk-modal__head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--pb-space-4);
  padding-right: 48px;
}
.gk-modal__name { margin: 0; font-size: 32px; font-weight: var(--pb-fw-black); line-height: 1.2; }
.gk-modal__reading { font-size: 13px; color: var(--pb-muted); }
.gk-modal__gacha {
  flex: 0 0 auto;
  font-size: 14px;
  font-weight: var(--pb-fw-bold);
  background: var(--pb-primary);
  padding: 6px 16px;
  border-radius: var(--pb-radius-full);
}
.gk-modal__gacha b { font-size: 18px; font-weight: var(--pb-fw-black); }
.gk-modal__motto {
  margin: var(--pb-space-3) 0 0;
  font-size: 16px;
  color: var(--pb-text);
  font-style: italic;
}
.gk-modal__label {
  font-size: 15px;
  font-weight: var(--pb-fw-bold);
  color: var(--pb-muted);
  margin: var(--pb-space-6) 0 var(--pb-space-3);
  padding-bottom: 8px;
  border-bottom: 2px solid rgba(26, 26, 26, .08);
}
.gk-modal__label-note { font-weight: var(--pb-fw-regular); font-size: 12px; margin-left: 6px; }

.gk-modal__members {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: var(--pb-space-3);
}
.gk-mc {
  display: flex;
  flex-direction: column;
  gap: 3px;
  padding: var(--pb-space-3) var(--pb-space-4);
  border-radius: var(--pb-radius);
  background: var(--pb-background);
}
.gk-mc__name { font-size: 18px; font-weight: var(--pb-fw-bold); }
.gk-mc__tw {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  font-size: 13px;
  color: var(--pb-muted);
}
.gk-mc__tw .pb-icon { font-size: 15px; }
.gk-mc__tw:hover { color: var(--pb-primary-active); }

.gk-modal__haul { display: flex; flex-direction: column; gap: var(--pb-space-4); }

.gk-haul { margin-top: 2px; }
.gk-haul__label {
  display: inline-block;
  font-size: 13px;
  font-weight: var(--pb-fw-bold);
  color: var(--pb-muted);
  margin-bottom: 8px;
  letter-spacing: .04em;
}
.gk-haul__items {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.gk-thumb {
  position: relative;
  width: 64px; height: 64px;
  border-radius: 10px;
  overflow: hidden;
  background: linear-gradient(160deg, #ffffff, #eef0ef);
  border: 1px solid rgba(0, 0, 0, .08);
  flex: 0 0 auto;
}
.gk-thumb img { width: 100%; height: 100%; object-fit: contain; padding: 5px; }
.gk-thumb--cover img { object-fit: cover; padding: 0; }
/* 2回以上のバッジ */
.gk-thumb__badge {
  position: absolute;
  right: -3px; bottom: -3px;
  min-width: 22px; height: 22px;
  padding: 0 5px;
  border-radius: 11px;
  background: var(--pb-primary);
  color: var(--pb-text);
  font-size: 13px;
  font-weight: var(--pb-fw-black);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 2px solid var(--pb-surface);
}

/* --- ロード中／エラー --- */
.gk-status {
  padding: var(--pb-space-16) var(--pb-space-6);
  text-align: center;
  color: var(--pb-muted);
  font-size: var(--pb-body);
}

@media (max-width: 860px) {
  .gk-grid { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
  .gk-grid--weapons { grid-template-columns: repeat(auto-fill, minmax(108px, 1fr)); }
  .gk-team-list { grid-template-columns: 1fr; }
  .gk-team__name { font-size: 21px; }
}
