/* ===========================================================
   Premier League 2026-27 — Formation Viewer
   Figma: PremierLeague_wiki / Desktop - 1 (node 1001:2)
   =========================================================== */

/* 合成フォント FigtreeJP（Figtree 110.5% + Noto Sans JP / SIL OFL 1.1）
   配布された FigtreeJP-handoff の TTF を、このアプリで使う文字だけにサブセットして woff2 化したもの */
@font-face {
  font-family: 'FigtreeJP';
  src: url('fonts/FigtreeJP-400.woff2') format('woff2');
  font-weight: 400;
  font-display: swap;
}
@font-face {
  font-family: 'FigtreeJP';
  src: url('fonts/FigtreeJP-600.woff2') format('woff2');
  font-weight: 600;
  font-display: swap;
}
@font-face {
  font-family: 'FigtreeJP';
  src: url('fonts/FigtreeJP-700.woff2') format('woff2');
  font-weight: 700;
  font-display: swap;
}

:root {
  /* Figma design tokens */
  --bg: #151515;
  --panel: #1f1f1f;
  --line-soft: #292929;
  --pill: #2c2c2c;
  --stroke: #3b3b3b;
  --text: #ffffff;
  --text-50: rgba(255, 255, 255, 0.5);
  --text-30: rgba(255, 255, 255, 0.3);
  --radius-card: 12px;
  --radius-pill: 50px;
  --tabbar-h: 58px;
  --tabbar-pad: 5px;
  /* 画面下からタブバーが占める高さ（浮かせているぶんの余白込み） */
  --tabbar-space: calc(var(--tabbar-h) + 20px + env(safe-area-inset-bottom));
  --accent: #ffffff;
  --brand: #3b3b3b;

  --font: 'FigtreeJP', -apple-system, BlinkMacSystemFont, 'Hiragino Sans', 'Noto Sans JP',
    'Yu Gothic UI', 'Segoe UI', sans-serif;
  --font-display: 'Urbanist', var(--font);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; }

/* ---------- Layout ---------- */

/* 本文だけ左のクラブバーの分をよける（ヘッダーは画面幅いっぱいのまま） */
.wrap {
  max-width: 1440px;
  margin: 0 auto;
  padding: var(--hdr-h, 80px) 40px calc(80px + var(--tabbar-space));
}

/* 画面上部に固定。下へ向かって透明になる黒のグラデーションで、
   本文がヘッダーの下へ抜けていくのが薄く見えるようにする */
header.site {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 40;
  background: linear-gradient(
    180deg,
    rgba(0, 0, 0, 0.65) 0%,
    rgba(0, 0, 0, 0.6) 45%,
    rgba(0, 0, 0, 0.38) 75%,
    rgba(0, 0, 0, 0) 100%
  );
  pointer-events: none;
}

/* 背景は素通し、中身だけ操作できるようにする */
header.site .brand,
header.site .teamsel { pointer-events: auto; }

.site-inner {
  max-width: 1440px;
  margin: 0 auto;
  min-height: 80px;
  padding: 8px 40px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 40px;
}

/* 右上のクラブ選択。エンブレムとシェブロンだけ */
.teamsel {
  appearance: none;
  border: 0;
  background: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 6px 8px 6px 6px;
  border-radius: var(--radius-pill);
  color: #fff;
  transition: background 0.15s ease;
}

.teamsel:hover { background: rgba(255, 255, 255, 0.08); }
.teamsel > .badge { --bs: 34px; }

.teamsel .ab {
  font-size: 17px;
  font-weight: 700;
  letter-spacing: 0.02em;
  margin-left: 4px;
}

.teamsel .chev { width: 20px; height: 20px; opacity: 0.6; }

.brand { display: flex; align-items: center; gap: 8px; }

.pl-logo { width: 80px; height: 33.694px; display: block; }

.brand .season {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 29px;
  letter-spacing: -1.45px;
  color: #fff;
}

/* ---------- Tabs (Teams / Matchs pills) ---------- */




/* ---------- Club badge ---------- */

.badge {
  --bs: 24px;
  width: var(--bs);
  height: var(--bs);
  flex: 0 0 var(--bs);
  display: inline-grid;
  place-items: center;
  background: none;
  vertical-align: middle;
}

.badge img {
  width: var(--bs);
  height: var(--bs);
  object-fit: contain;
  display: block;
}

.badge.fallback {
  border-radius: 22%;
  background: var(--fb, var(--pill));
  font-size: calc(var(--bs) * 0.3);
  font-weight: 700;
  color: #fff;
}

/* ---------- Team header ---------- */

/* エンブレムとクラブ名は必ず横一列（折り返すとクラブごとに高さが変わるため） */
.team-head {
  display: flex;
  align-items: center;
  gap: 15px;
  flex-wrap: nowrap;
  height: 77.144px;
}

/* デザインの外枠は 64x77.144（クレストの縦長比）。中の画像は各クラブの比率を保つ */
.team-head > .badge { --bs: 64px; height: 77.144px; }
.team-head > .badge img { height: 77.144px; }

/* 折り返すとクラブごとに見出しの高さが変わってしまうので必ず1行 */
.team-title h2 {
  margin: 0;
  font-size: 48px;
  font-weight: 700;
  line-height: normal;
  letter-spacing: -0.01em;
  white-space: nowrap;
}

.team-title .en { display: none; }

/* 選手一覧の下に置く補足情報 */
.team-info {
  border-top: 0.5px solid var(--stroke);
  padding-top: 20px;
}

.team-meta {
  display: flex;
  gap: 24px;
  flex-wrap: wrap;
}

.meta-item { display: flex; align-items: baseline; gap: 8px; }

.meta-item .k {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text-30);
}

.meta-item .v { font-size: 14px; font-weight: 600; color: var(--text-50); }

.team-note {
  margin-top: 12px;
  font-size: 13px;
  line-height: 1.7;
  color: var(--text-50);
}

/* ---------- Two-column body (list left / pitch right) ---------- */

.pitch-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 538px;
  gap: 32px;
  align-items: start;
  padding-top: 40px;
}

.left-col {
  display: flex;
  flex-direction: column;
  gap: 24px;
  min-width: 0;
}

/* 右カラム。履歴カード → ピッチ → 試合情報ボタン の縦並び */
.pitch-col {
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-width: 0;
}

/* --- フォーメーション履歴（ドロップダウン） --- */

/* 幅はピッチと同じ（カラム全幅）。閉じているときは1行だけの高さに収める */
.fmsel { position: relative; }

.fmsel-btn,
.fmsel-item {
  appearance: none;
  font-family: inherit;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  height: 38px;
  padding: 0 12px;
  border: 0;
  border-radius: 10px;
  background: none;
  color: #fff;
  text-align: left;
  white-space: nowrap;
  transition: background 0.15s ease, box-shadow 0.15s ease;
}

.fmsel-btn { background: #202020; box-shadow: inset 0 0 0 0.5px var(--stroke); }
.fmsel-btn:hover { box-shadow: inset 0 0 0 0.5px #6a6a6a; }
.fmsel.open .fmsel-btn { box-shadow: inset 0 0 0 1px #fff; }

.fmsel-btn .chev {
  width: 18px;
  height: 18px;
  flex: 0 0 18px;
  opacity: 0.5;
  transition: transform 0.15s ease;
}

.fmsel.open .fmsel-btn .chev { transform: rotate(180deg); }

/* 行の中身。左からメタ情報、右へ布陣とスコアを寄せる */
.fmsel .mw { font-size: 11px; color: var(--text-50); }
.fmsel .d { font-size: 11px; color: var(--text-30); }

.fmsel .ha {
  font-size: 9px;
  font-weight: 700;
  line-height: 14px;
  width: 14px;
  text-align: center;
  border-radius: 3px;
  background: var(--pill);
  color: var(--text-50);
  flex: 0 0 14px;
}

.fmsel .ha.h { background: #fff; color: #000; }

.fmsel .vs { display: flex; align-items: center; gap: 5px; }
.fmsel .vs > .badge { --bs: 18px; flex: 0 0 auto; }
.fmsel .vs .ab { font-size: 12px; font-weight: 600; letter-spacing: 0.02em; }

.fmsel .fm {
  margin-left: auto;
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0.02em;
  font-variant-numeric: tabular-nums;
}

.fmsel .res { display: flex; align-items: center; gap: 5px; font-size: 11px; color: var(--text-50); }
.fmsel .res .sc { font-variant-numeric: tabular-nums; }
.fmsel .res .dot { width: 6px; height: 6px; border-radius: 50%; }
.fmsel .res .dot.win { background: #16a34a; }
.fmsel .res .dot.draw { background: #6a6a6a; }
.fmsel .res .dot.lose { background: #b03a3a; }

/* --- ドロップダウン本体 --- */

.fmsel-menu {
  display: none;
  position: absolute;
  left: 0;
  right: 0;
  top: calc(100% + 6px);
  z-index: 20;
  flex-direction: column;
  gap: 2px;
  max-height: 320px;
  overflow-y: auto;
  padding: 6px;
  border-radius: 12px;
  background: #1c1c1c;
  box-shadow: inset 0 0 0 0.5px var(--stroke), 0 14px 34px rgba(0, 0, 0, 0.55);
}

.fmsel.open .fmsel-menu { display: flex; }

.fmsel-item { flex: 0 0 auto; }
.fmsel-item:hover { background: rgba(255, 255, 255, 0.06); }
.fmsel-item.on { background: rgba(255, 255, 255, 0.1); }

/* --- 試合情報ボタン --- */

.match-cta {
  appearance: none;
  font-family: inherit;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 44px;
  border: 0;
  border-radius: var(--radius-pill);
  background: var(--pill);
  box-shadow: inset 0 0 0 0.5px var(--stroke);
  color: #fff;
  font-size: 14px;
  font-weight: 600;
  transition: background 0.15s ease, color 0.15s ease;
}

.match-cta:hover { background: #fff; color: #000; }

/* ---------- Squad list ---------- */

.panel { display: flex; flex-direction: column; gap: 12px; }

.panel h3, .panel .cnt { display: none; }

.group-label {
  display: flex;
  align-items: center;
  gap: 11px;
  padding-top: 12px;
  font-size: 18px;
  font-weight: 600;
  color: #fff;
}

.group-label::after {
  content: '';
  flex: 1 0 0;
  height: 0.5px;
  background: var(--stroke);
}

/* 1440幅では3列。ピッチ幅が固定なので、画面が狭いときは自動で列を減らして名前が潰れないようにする */
.prow-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
  gap: 12px;
}

/* 枠線は border ではなく inset の box-shadow で引く。
   カード幅が端数（165.5px など）になるグリッドだと 0.5px の border は
   ラスタライズで潰れて消える辺が出るため */
.prow {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 16px;
  border: 0;
  border-radius: var(--radius-card);
  box-shadow: inset 0 0 0 0.5px var(--stroke);
  cursor: pointer;
  transition: box-shadow 0.15s ease, background 0.15s ease;
}

/* スタメンは常に浮いて見せる。ホバーは枠線だけ白くする */
.prow.is-xi { box-shadow: inset 0 0 0 0.5px #5a5a5a; background: rgba(255, 255, 255, 0.03); }
.prow:hover { box-shadow: inset 0 0 0 0.5px #fff; }

.prow .who { display: flex; align-items: center; gap: 10px; min-width: 0; flex: 1 1 auto; }
.prow .no { flex: 0 0 auto; }

.prow .face {
  width: 40px;
  height: 40px;
  flex: 0 0 40px;
  border-radius: 50%;
  overflow: hidden;
  position: relative;
  display: grid;
  place-items: center;
  background: var(--brand);
  font-size: 12px;
  font-weight: 700;
  color: rgba(255, 255, 255, 0.85);
}

.prow .face img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: top center;
}

.prow .nm { display: flex; flex-direction: column; gap: 1px; min-width: 0; }

/* 英語表記の上に置くカタカナ読み */
.prow .nm .ja-top {
  font-size: 11px;
  line-height: 1.4;
  color: var(--text-50);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.prow .nm .ja-top:empty { display: none; }

.prow .nm .en {
  font-size: 16px;
  font-weight: 600;
  color: #fff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.prow .sub { display: flex; align-items: center; gap: 5px; min-width: 0; }
.prow .sub .fl { font-size: 13px; line-height: 1; flex: 0 0 auto; }

.prow .sub .pos,
.prow .sub .num {
  font-size: 11px;
  line-height: 1.4;
  color: var(--text-50);
  white-space: nowrap;
}

.prow .no {
  font-size: 32px;
  font-weight: 600;
  color: var(--text-30);
  font-variant-numeric: tabular-nums;
  line-height: 1;
}

.prow.is-xi .no { color: rgba(255, 255, 255, 0.6); }

/* ---------- Pitch ---------- */

.pitch-wrap { position: relative; }

/* ピッチはファーストビューで全体が見えるよう、上に積まれた要素の分を引いた高さにする
   （--pitch-h は app.js の fitPitch が実測して設定）。
   縦向きは選手トークンをピッチの高さに、横向きは横幅に追従させるので、
   寸法の基準を --u として切り替える。 */
.pitch {
  --u: 1cqh;
  position: relative;
  width: 538px;
  max-width: 100%;
  height: var(--pitch-h, min(851px, calc(100vh - 32px)));
  min-height: 420px;
  border-radius: var(--radius-card);
  background:
    url('figma/pitch-box.svg') no-repeat 50% 0 / 68.8% 25.4%,
    url('figma/pitch-frame.svg') no-repeat 0 0 / 100% 100%;
  /* 選手トークンをピッチに追従させるためのコンテナ */
  container-type: size;
}

.pitch::after {
  content: '';
  position: absolute;
  left: 50%;
  bottom: 0;
  width: 68.8%;
  height: 25.4%;
  transform: translateX(-50%) scaleY(-1);
  background: url('figma/pitch-box.svg') no-repeat 50% 0 / 100% 100%;
  pointer-events: none;
}

/* --- 横向き（PC）。ゴールが左右、ハーフウェイラインが縦になる --- */
.pitch.h {
  --u: 1cqw;
  width: 100%;
  min-height: 320px;
  background:
    url('figma/pitch-box-h.svg') no-repeat 100% 50% / 25.4% 68.8%,
    url('figma/pitch-frame-h.svg') no-repeat 0 0 / 100% 100%;
}

.pitch.h::after {
  left: 0;
  top: 50%;
  bottom: auto;
  width: 25.4%;
  height: 68.8%;
  transform: translateY(-50%) scaleX(-1);
  background: url('figma/pitch-box-h.svg') no-repeat 50% 0 / 100% 100%;
}

.formation-tag {
  position: absolute;
  top: 16px;
  left: 18px;
  z-index: 3;
  font-size: 14px;
  font-weight: 600;
  color: var(--text-30);
}

.pitch-hint {
  position: absolute;
  bottom: 14px;
  right: 18px;
  z-index: 3;
  font-size: 11px;
  color: var(--text-30);
}

/* ---------- Player token ---------- */

/* 各寸法は cqh（ピッチ高さの%）。851px のとき デザインの実寸（103px / 64px / 16px …）になる */
.token {
  position: absolute;
  transform: translate(-50%, -50%);
  width: calc(12.1 * var(--u));
  display: flex;
  flex-direction: column;
  align-items: center;
  cursor: pointer;
  z-index: 4;
  animation: rise 0.45s cubic-bezier(0.2, 0.8, 0.3, 1) both;
}

@keyframes rise {
  from { opacity: 0; transform: translate(-50%, calc(-50% + 10px)); }
  to { opacity: 1; transform: translate(-50%, -50%); }
}

.token .shirt {
  width: calc(7.52 * var(--u));
  height: calc(7.52 * var(--u));
  border-radius: 50%;
  position: relative;
  display: grid;
  place-items: center;
  margin-bottom: -0.94cqh;
  background: var(--brand);
  font-size: calc(2.1 * var(--u));
  font-weight: 700;
  color: #fff;
  transition: transform 0.18s cubic-bezier(0.2, 0.8, 0.3, 1);
}

.token:hover .shirt { transform: translateY(-3px); }

.token .shirt.photo img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border-radius: 50%;
  object-fit: cover;
  object-position: top center;
  display: block;
}

.token .nchip {
  position: relative;
  z-index: 2;
  background: #fff;
  color: #000;
  font-size: calc(1.88 * var(--u));
  font-weight: 600;
  line-height: normal;
  padding: calc(0.23 * var(--u)) calc(0.94 * var(--u));
  border-radius: 30px;
  margin-bottom: calc(0.47 * var(--u));
}

.token .nm {
  font-size: calc(1.88 * var(--u));
  font-weight: 600;
  color: #fff;
  text-align: center;
  width: 100%;
  line-height: normal;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* デザインは whitespace-nowrap。長いカタカナで折り返して崩れないよう省略表示 */
.token .sub {
  display: flex;
  gap: 4px;
  justify-content: center;
  align-items: baseline;
  width: 100%;
  min-width: 0;
}

.token .sub .fl { font-size: calc(2.35 * var(--u)); font-weight: 600; line-height: 1; flex: 0 0 auto; }

.token .sub .ja {
  font-size: calc(1.53 * var(--u));
  color: var(--text-50);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
}

/* ---------- Modal ---------- */

/* ダイアログは画面下辺にぴったり付ける（下だけ角を落とす） */
.overlay {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: none;
  align-items: flex-end;
  justify-content: center;
  padding: 0;
  background: rgba(0, 0, 0, 0.72);
  backdrop-filter: blur(6px);
}

.overlay.open { display: flex; animation: fade 0.18s ease both; }

@keyframes fade { from { opacity: 0; } to { opacity: 1; } }

/* 角丸20 / 内側の余白12 / 写真の角丸8 で同心の入れ子にして、写真が枠にすっぽり収まるようにする。
   横幅は画面の9割、下辺は画面いっぱい。中身だけスクロールする */
.card {
  --card-pad: 12px;
  position: relative;
  width: 90vw;
  height: 90vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border-radius: 20px 20px 0 0;
  border: 0.5px solid var(--stroke);
  border-bottom: 0;
  background: var(--panel);
  padding: var(--card-pad) var(--card-pad) 0;
  animation: pop 0.24s cubic-bezier(0.2, 0.8, 0.3, 1) both;
}

/* 閉じるボタンが浮いているぶん、最後まで読めるよう下に余白を足す */
.card-grid {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  display: grid;
  grid-template-columns: 260px minmax(0, 1fr);
  gap: 32px;
  align-items: start;
  padding-bottom: 80px;
}

@keyframes pop {
  from { opacity: 0; transform: translateY(14px) scale(0.99); }
  to { opacity: 1; transform: none; }
}

/* 閉じるボタンは画面左下に固定して浮かせる。マッチページの「戻る」と同じ見た目 */
.overlay > .close {
  position: absolute;
  left: 20px;
  bottom: 20px;
  z-index: 3;
  box-shadow: 0 6px 24px rgba(0, 0, 0, 0.45);
  backdrop-filter: blur(12px);
}

.close {
  appearance: none;
  font-family: inherit;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 44px;
  padding: 0 20px 0 16px;
  border: 1px solid var(--stroke);
  border-radius: var(--radius-pill);
  background: rgba(32, 32, 32, 0.92);
  color: #fff;
  font-size: 14px;
  font-weight: 600;
  line-height: 1;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.close:hover { background: #fff; color: #000; border-color: #fff; }
.close .x { font-size: 16px; line-height: 1; }

/* 左カラム：写真。縦は情報カラムに合わせて伸びる */
.card-photo {
  position: relative;
  border-radius: 8px;
  overflow: hidden;
  height: min(420px, 52vh);
  min-height: 260px;
  display: grid;
  place-items: center;
  background: linear-gradient(170deg, var(--brand), rgba(0, 0, 0, 0.75));
}

.card-photo img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: top center;
}

.card-photo.noimg { font-size: 56px; font-weight: 700; color: rgba(255, 255, 255, 0.9); }

/* 右カラム：情報 */
.card-info {
  min-width: 0;
  padding: 12px 12px 12px 0;
  display: flex;
  flex-direction: column;
}

.info-head { margin-bottom: 22px; }

.card .num {
  font-size: 32px;
  font-weight: 600;
  line-height: 1;
  color: var(--text-30);
  font-variant-numeric: tabular-nums;
  margin-bottom: 8px;
}

.card h3 { margin: 0 0 3px; font-size: 24px; font-weight: 700; }

.card .ja-name { font-size: 14px; color: var(--text-50); margin-bottom: 12px; }

.card .tags { display: flex; gap: 8px; flex-wrap: wrap; }

.tag {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-50);
  background: var(--pill);
  border-radius: var(--radius-pill);
  padding: 4px 12px;
}

.tag.club { color: #fff; display: inline-flex; align-items: center; gap: 6px; padding-left: 7px; }
.tag.num { font-variant-numeric: tabular-nums; }

.card .credit { margin-top: auto; padding-top: 18px; font-size: 11px; color: var(--text-30); }

.card-body { display: flex; flex-direction: column; flex: 1; }

/* 国籍 / キャリアはタグチップと同じ地色の角丸ボックスで囲う */
.field {
  margin-bottom: 12px;
  padding: 12px 14px;
  background: var(--pill);
  border-radius: var(--radius-card);
}
.field:last-child { margin-bottom: 0; }

.field .k {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text-30);
  margin-bottom: 10px;
}

.nat-line { display: flex; align-items: center; gap: 10px; font-size: 16px; font-weight: 600; }

.born-line { font-size: 16px; font-weight: 600; color: #fff; font-variant-numeric: tabular-nums; }

/* 現所属クラブへの加入年月 */
.timeline .since { font-size: 12px; font-weight: 400; color: var(--text-50); }

/* レール（線＋丸）は Career 見出しより 12px 内側。丸の外周から文字までは 12px */
.timeline { list-style: none; margin: 0 0 0 12px; padding: 0; border-left: 0.5px solid var(--stroke); }

.timeline li {
  position: relative;
  padding: 0 0 13px 17px;
  font-size: 15px;
  color: var(--text-50);
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.timeline li:last-child { padding-bottom: 0; }

.timeline li::before {
  content: '';
  position: absolute;
  left: -5px;
  top: 6px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--bg);
  border: 1px solid var(--stroke);
}

.timeline .lg { font-size: 12px; color: var(--text-30); }

.timeline li.now { color: #fff; font-weight: 600; }
.timeline li.now::before { background: #fff; border-color: #fff; }

/* 現所属の丸から外側へ広がる波（●LIVE 的な表現） */
.timeline li.now::before { animation: nowPing 1.8s cubic-bezier(0, 0, 0.2, 1) infinite; }

@keyframes nowPing {
  0%   { box-shadow: 0 0 0 0 rgba(255, 255, 255, 0.45); }
  70%  { box-shadow: 0 0 0 8px rgba(255, 255, 255, 0); }
  100% { box-shadow: 0 0 0 0 rgba(255, 255, 255, 0); }
}

@media (prefers-reduced-motion: reduce) {
  .timeline li.now::before { animation: none; }
}

.empty { color: var(--text-30); font-size: 14px; }

/* ---------- Fixtures ---------- */

.toolbar { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; padding: 24px 0 8px; }

/* 日程の絞り込みチェックボックス */
.check {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  padding: 7px 15px 7px 12px;
  border-radius: var(--radius-pill);
  background: var(--pill);
  color: var(--text-50);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  user-select: none;
  transition: background 0.15s ease, color 0.15s ease;
}

.check:hover { background: #3a3a3a; color: #fff; }
.check.on { background: #fff; color: #000; }

.check input { position: absolute; opacity: 0; width: 0; height: 0; }

.check .bx {
  position: relative;
  width: 17px;
  height: 17px;
  flex: 0 0 17px;
  border-radius: 5px;
  box-shadow: inset 0 0 0 1.5px currentColor;
  transition: background 0.15s ease;
}

.check.on .bx { background: #000; box-shadow: none; }

/* チェックマーク */
.check .bx::after {
  content: '';
  position: absolute;
  left: 5px;
  top: 2px;
  width: 5px;
  height: 9px;
  border: solid #fff;
  border-width: 0 2px 2px 0;
  transform: rotate(45deg) scale(0);
  transition: transform 0.15s cubic-bezier(0.2, 0.8, 0.3, 1);
}

.check.on .bx::after { transform: rotate(45deg) scale(1); }

.check input:focus-visible + .bx { outline: 2px solid #fff; outline-offset: 2px; }

.legend { font-size: 12px; color: var(--text-30); padding: 14px 2px 0; line-height: 1.7; }

.mw-block { margin-bottom: 32px; }

.mw-head {
  display: flex;
  align-items: center;
  gap: 11px;
  padding-top: 12px;
  margin-bottom: 12px;
}

.mw-head .n { font-size: 18px; font-weight: 600; color: #fff; white-space: nowrap; }
.mw-head .d { font-size: 13px; color: var(--text-30); white-space: nowrap; }
.mw-head::after { content: ''; flex: 1 0 0; height: 0.5px; background: var(--stroke); }

/* 日程1行 — Figma node 1037:1099 */
.match {
  position: relative;
  overflow: hidden;
  height: 111px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #202020;
  border: 1px solid var(--pill);
  border-radius: var(--radius-card);
  margin-bottom: 12px;
  transition: border-color 0.15s ease;
}

.match:hover { border-color: #4a4a4a; }

/* 両端のクラブカラーのグロー */
.match .glow {
  position: absolute;
  top: -1px;
  width: 120px;
  height: 111px;
  filter: blur(60px);
  pointer-events: none;
}

.match .glow.home { left: -1px; }
.match .glow.away { right: -1px; }

/* 巨大な略称。選択中のクラブだけ 100%、それ以外は 50% */
.match .abbr {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  font-size: clamp(44px, 5.6vw, 80px);
  font-weight: 900;
  letter-spacing: -0.05em;
  line-height: 1;
  color: var(--text-30);
  pointer-events: none;
  user-select: none;
}

.match .abbr.on { color: #fff; }
.match .abbr.home { left: 24px; }
.match .abbr.away { right: 24px; }

/* 中央3列（エンブレム45px・日付・エンブレム45px）を固定幅にして、
   日付が必ず行の中央、左右のエンブレムがどの行でも同じ位置に来るようにする。
   日付トラックの 125px = 61px + 左右32px（エンブレムとの間隔が 32+8=40px になる） */
.match .center {
  position: relative;
  z-index: 2;
  width: min(100%, 620px);
  display: grid;
  grid-template-columns: minmax(0, 1fr) 45px 125px 45px minmax(0, 1fr);
  align-items: center;
  column-gap: 8px;
}

.match .center > .badge { --bs: 45px; }

.match .tname {
  color: #fff;
  font-size: 20px;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
}

.match .tname.h { text-align: right; }
.match .tname.a { text-align: left; }

/* 第N節（グレー）/ 日付（白）/ キックオフ時刻（グレー）の3行 */
.match .when {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  text-align: center;
  font-size: 16px;
  line-height: 1.35;
  white-space: nowrap;
}

.match .when .mw { color: var(--text-50); font-size: 14px; }
.match .when .d { color: #fff; }
.match .when .t { color: var(--text-50); font-size: 14px; }

/* ---------- Footer ---------- */

footer.src {
  margin-top: 56px;
  padding-top: 22px;
  border-top: 0.5px solid var(--stroke);
  font-size: 12px;
  line-height: 1.9;
  color: var(--text-30);
}

/* ---------- Responsive ---------- */

/* 2カラム時は右カラムを固定扱いにして、一覧をスクロールしてもフォーメーションが常に見えるようにする。
   ヘッダーの下 40px に貼り付き、ヘッダーが消えたら画面上端から 40px の位置に上がる */
@media (min-width: 1181px) {
  .pitch-col {
    position: sticky;
    top: calc(var(--hdr-off, 80px) + 40px);
  }

  /* 横向きのピッチは幅が要るので、右カラムを広めに取る */
  .pitch-layout { grid-template-columns: minmax(0, 1fr) minmax(520px, 780px); }
}

@media (max-width: 1180px) {
  .pitch-layout { grid-template-columns: 1fr; }
  .pitch { margin: 0 auto; }
  .team-meta { margin-left: 0; }
}


@media (max-width: 767px) {
  /* スマホでは横幅も画面いっぱいに使う。縦は収めきらず、中身をスクロールさせる前提 */
  .card { width: 100%; height: 90vh; }


  .card-grid { grid-template-columns: 1fr; gap: 14px; }

  /* aspect-ratio だけだと align-items:start のグリッドが行高を内容基準で決めてしまい、
     写真が下の情報カラムに重なる。1カラムのときは高さを実寸で指定する */
  .card-photo { height: min(52vh, 72vw); min-height: 0; aspect-ratio: auto; }

  .card-info { padding: 0 8px 8px; }
}

@media (max-width: 620px) {
  .wrap { padding-left: 16px; padding-right: 16px; }
  .site-inner { padding-left: 16px; padding-right: 16px; }
  .site-inner { padding-left: 16px; padding-right: 16px; }
  .prow-grid { grid-template-columns: 1fr; }
  .team-title h2 { font-size: 32px; }
  .match .abbr { display: none; }
  .match .center { grid-template-columns: minmax(0, 1fr) 34px 96px 34px minmax(0, 1fr); }
  .match .center > .badge { --bs: 34px; }
  .match .tname { font-size: 16px; }
}

/* ---------- Mobile（Figma 1117:2 = Teams / 1117:1113 = Matchs） ---------- */

/* スマホ専用パーツはPCでは出さない */
.match .tname .tab3,
.match .tname .tsub { display: none; }

/* 背番号はPCでは右の大きい数字が担当するので、サブ行には出さない */
.prow .sub .num { display: none; }

/* クラブ一覧のダイアログ。選手プロフィールと同じ「画面下にベタ付けの8割モーダル」 */
.teampick {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: none;
  align-items: flex-end;
  justify-content: center;
  background: rgba(0, 0, 0, 0.72);
  backdrop-filter: blur(6px);
}

.teampick.open { display: flex; animation: fade 0.18s ease both; }

.tp-card {
  width: 80vw;
  height: 80vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border-radius: 20px 20px 0 0;
  border: 0.5px solid var(--stroke);
  border-bottom: 0;
  background: var(--panel);
  animation: pop 0.24s cubic-bezier(0.2, 0.8, 0.3, 1) both;
}

.tp-head {
  flex: 0 0 auto;
  padding: 18px 20px 14px;
  border-bottom: 0.5px solid var(--stroke);
}

.tp-title { font-size: 18px; font-weight: 600; color: #fff; }

/* 閉じるボタンが浮いているぶん、最後まで届くよう下に余白を足す */
.tp-grid {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(148px, 1fr));
  align-content: start;
  gap: 12px;
  padding: 16px 16px 90px;
}

.teampick > .close {
  position: absolute;
  left: 20px;
  bottom: 20px;
  z-index: 3;
  box-shadow: 0 6px 24px rgba(0, 0, 0, 0.45);
  backdrop-filter: blur(12px);
}

/* クラブ名は略さず全部読めるように、エンブレムの下に折り返しありで置く */
.tp-item {
  appearance: none;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  gap: 8px;
  min-width: 0;
  padding: 14px 10px;
  border: 0.5px solid var(--stroke);
  border-radius: var(--radius-card);
  background: none;
  color: #fff;
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  text-align: center;
}

.tp-item.on { border-color: #fff; background: rgba(255, 255, 255, 0.06); }

.tp-name { min-width: 0; line-height: 1.35; overflow-wrap: anywhere; }

body.no-scroll { overflow: hidden; }

@media (max-width: 767px) {
  .wrap { padding: var(--hdr-h, 60px) 16px calc(64px + var(--tabbar-space)); }

  .site-inner { min-height: 0; padding: 16px; gap: 12px; justify-content: space-between; }

  /* --- Teams：ピッチを最初に、その下にポジション別カード --- */
  .pitch-layout { padding-top: 12px; gap: 16px; }
  .pitch-col { order: -1; }
  .left-col { gap: 16px; }
  .team-head { display: none; } /* クラブ名はカルーセルが担当する */
  .pitch { width: 100%; min-height: 0; }
  .pitch-hint { display: none; }
  .group-label { font-size: 16px; }

  /* --- プレイヤーカード：2カラム・中央寄せ（Figma 1117:808） --- */
  .prow-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }

  .prow {
    flex-direction: column;
    justify-content: center;
    gap: 10px;
    padding: 16px;
  }

  .prow .who { flex: 0 0 auto; flex-direction: column; gap: 10px; width: 100%; }
  .prow .nm { align-items: center; width: 100%; }
  .prow .nm .en { width: 100%; text-align: center; }
  .prow .sub { justify-content: center; }
  .prow .sub .num { display: inline; }

  .prow .no { display: none; }

  /* --- Matchs（Figma 1117:1687） --- */
  .toolbar { padding: 16px 0 4px; }
  .seg button { font-size: 14px; padding: 4px 12px; }

  .match { height: auto; padding: 10px; }

  /* クラブカラーのぼかしは、大きさも濃さも半分ほどに落として左右の端の高さ中央に置く */
  .match .glow {
    top: 50%;
    left: auto;
    right: auto;
    width: 60px;
    height: 56px;
    transform: translateY(-50%);
    filter: blur(34px);
    opacity: 0.55;
  }

  .match .glow.home { left: 0; }
  .match .glow.away { right: 0; }

  .match .center {
    grid-template-columns: minmax(0, 1fr) 45px 80px 45px minmax(0, 1fr);
    column-gap: 12px;
  }

  .match .center > .badge { --bs: 45px; }

  .match .tname {
    display: flex;
    flex-direction: column;
    gap: 2px;
    font-size: 20px;
    line-height: 1.2;
  }

  /* 左のクラブは左揃え、右のクラブは右揃え（カードの外側に寄せる） */
  .match .tname.h { align-items: flex-start; text-align: left; }
  .match .tname.a { align-items: flex-end; text-align: right; }

  /* 太字はクラブ名ではなく3文字の略称。読み仮名がわりにクラブ名を下に添える */
  .match .tname .tab3 { display: block; letter-spacing: 0.02em; }
  .match .tname .tshort { display: none; }

  .match .tname .tsub {
    display: block;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    font-size: 11px;
    font-weight: 400;
    color: var(--text-50);
  }

  .match .when { font-size: 14px; gap: 4px; }
  .match .when .mw { display: none; }
  .match .when .d,
  .match .when .t { font-size: 14px; }
}

/* ===========================================================
   Match page — 1試合の詳細（スタメン・控え・チームスタッツ）
   =========================================================== */

/* ---------- 日程1行のスコア表示 ---------- */

.match { cursor: pointer; }
.match.is-live { border-color: #2c5c3c; }

/* 画面中央に置いた「いまの試合」。どれを指しているか分かるよう少しだけ立たせる */
.match.is-now { border-color: #4a4a4a; }

.match .when .sc {
  font-size: 26px;
  font-weight: 700;
  color: #fff;
  line-height: 1.1;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.02em;
}

.mstat {
  display: inline-block;
  font-size: 11px;
  font-weight: 600;
  line-height: 1;
  padding: 4px 8px;
  border-radius: var(--radius-pill);
  white-space: nowrap;
}

.mstat.live { background: #16a34a; color: #fff; }
.mstat.done { background: var(--pill); color: var(--text-50); }
.mstat.soon { background: var(--pill); color: var(--text-50); }

.match.is-live .when .sc { color: #fff; }

@media (prefers-reduced-motion: no-preference) {
  .mstat.live { animation: pulse 1.8s ease-in-out infinite; }
}

@keyframes pulse {
  50% { opacity: 0.55; }
}

/* ---------- ページ全体 ---------- */

.mpage { padding: 24px 0 96px; display: flex; flex-direction: column; gap: 28px; }

.msec-title {
  margin: 0;
  font-size: 15px;
  font-weight: 600;
  color: #fff;
  display: flex;
  align-items: center;
  gap: 11px;
}

.msec-title::after { content: ''; flex: 1 0 0; height: 0.5px; background: var(--stroke); }

.mbody { display: flex; flex-direction: column; gap: 20px; }

.mempty {
  font-size: 13px;
  color: var(--text-30);
  padding: 22px 2px;
}

/* ---------- スコアボード ---------- */

.mhead {
  position: relative;
  overflow: hidden;
  background: #202020;
  border: 1px solid var(--pill);
  border-radius: var(--radius-card);
  padding: 28px 24px 20px;
}

.mhead .glow {
  position: absolute;
  top: -20px;
  width: 160px;
  height: 160px;
  filter: blur(70px);
  pointer-events: none;
}

.mhead .glow.home { left: -20px; }
.mhead .glow.away { right: -20px; }

.mhead-line {
  position: relative;
  z-index: 2;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 150px minmax(0, 1fr);
  align-items: center;
  gap: 12px;
}

.mteam {
  appearance: none;
  background: none;
  border: 0;
  padding: 0;
  cursor: pointer;
  color: #fff;
  font-family: inherit;
  display: flex;
  align-items: center;
  gap: 14px;
  min-width: 0;
  transition: opacity 0.15s ease;
}

.mteam:hover { opacity: 0.65; }
.mteam.a { flex-direction: row-reverse; }
.mteam > .badge { --bs: 64px; flex: 0 0 auto; }

.mteam .nm {
  font-size: 22px;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
}

.mscore {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  text-align: center;
}

.mscore .sc {
  font-size: 44px;
  font-weight: 700;
  line-height: 1;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.01em;
}

.mscore .ko { font-size: 30px; font-weight: 700; line-height: 1; }
.mscore .ht { font-size: 11px; color: var(--text-30); }

.mmeta {
  position: relative;
  z-index: 2;
  display: flex;
  flex-wrap: wrap;
  gap: 6px 14px;
  margin-top: 20px;
  padding-top: 14px;
  border-top: 0.5px solid var(--stroke);
  font-size: 12px;
  color: var(--text-50);
}

/* ---------- タブ（メンバー / 試合状況 / スタッツ） ---------- */

.mtabs { display: flex; }

/* 下のタブバーと同じ考え方で、外側の角丸から内側の余白を引いた半径にする */
.mtabs .seg {
  --seg-h: 42px;
  --seg-pad: 4px;
  display: inline-flex;
  gap: 4px;
  height: var(--seg-h);
  padding: var(--seg-pad);
  border-radius: 999px;
  background: var(--pill);
  box-shadow: inset 0 0 0 0.5px var(--stroke);
}

.mtabs .seg button {
  appearance: none;
  border: 0;
  background: none;
  font-family: inherit;
  cursor: pointer;
  padding: 0 16px;
  border-radius: calc((var(--seg-h) - var(--seg-pad) * 2) / 2);
  color: var(--text-50);
  font-size: 14px;
  font-weight: 600;
  white-space: nowrap;
  transition: background 0.15s ease, color 0.15s ease;
}

.mtabs .seg button:hover { color: #fff; background: rgba(255, 255, 255, 0.07); }
.mtabs .seg button.active { background: #fff; color: #000; }

@media (max-width: 767px) {
  .mtabs .seg { --seg-h: 38px; }
  .mtabs .seg button { padding: 0 13px; font-size: 13px; }
}

/* ---------- 試合状況（得点・カード・交代） ---------- */

.mevents {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

/* 行は左右のパディングぶんまで使い切る。時計は片側にだけ置くので2カラム */
.mev {
  display: grid;
  grid-template-columns: 46px minmax(0, 1fr);
  align-items: center;
  gap: 10px;
  margin: 0 -10px;
  padding: 8px 10px;
  border-radius: var(--radius-card);
  font-size: 14px;
}

.mev.tap { cursor: pointer; }
.mev.tap:hover { background: rgba(255, 255, 255, 0.04); }

.mev .min {
  font-size: 12px;
  color: var(--text-30);
  font-variant-numeric: tabular-nums;
  text-align: right;
}

.mev .who { display: flex; align-items: center; gap: 10px; min-width: 0; }
.mev .txt { display: flex; flex-direction: column; gap: 2px; min-width: 0; }

.mev .nm { display: flex; align-items: center; gap: 6px; min-width: 0; }
.mev .nm .n { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.mev .nm .kind {
  flex: 0 0 auto;
  font-size: 10px;
  font-weight: 700;
  color: var(--text-50);
  border: 0.5px solid var(--stroke);
  border-radius: 3px;
  padding: 1px 4px;
}

.mev .nm .sc {
  flex: 0 0 auto;
  font-size: 12px;
  color: var(--text-30);
  font-variant-numeric: tabular-nums;
}

.mev .as {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--text-50);
  min-width: 0;
}

/* 選手アイコンと、その右下に重ねる出来事の印 */
.mev .ico { position: relative; flex: 0 0 auto; line-height: 0; }

.mev .evb {
  position: absolute;
  right: -3px;
  bottom: -3px;
  display: grid;
  place-items: center;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  border: 1.5px solid var(--bg);
  font-size: 9px;
  font-weight: 700;
  line-height: 1;
  color: #fff;
}

/* 同梱フォントに絵文字は入っていないので、白背景で消えないよう文字色は黒にしておく */
.mev .evb.goal { background: #fff; color: #000; font-size: 10px; }
.mev .evb.in { background: #16a34a; }
.mev .evb.out { background: #dc2626; }

/* カードは丸ではなくカードの形にする */
.mev .evb.yellow,
.mev .evb.red { width: 11px; height: 14px; border-radius: 2px; border-width: 1.25px; }
.mev .evb.yellow { background: #eab308; }
.mev .evb.red { background: #dc2626; }

.mev .ico.sm .evb {
  width: 12px;
  height: 12px;
  right: -3px;
  bottom: -3px;
  font-size: 7px;
  border-width: 1.25px;
}

.mev .face {
  position: relative;
  width: 34px;
  height: 34px;
  flex: 0 0 34px;
  border-radius: 50%;
  overflow: hidden;
  display: grid;
  place-items: center;
  background: var(--brand);
  font-size: 11px;
  font-weight: 700;
  color: rgba(255, 255, 255, 0.85);
}

.mev .face img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: top center;
}

.mev .ico.sm .face { width: 22px; height: 22px; flex-basis: 22px; font-size: 9px; }

/* ホームは左、アウェイは右に寄せてどちらのチームか分かるようにする。
   grid-row を明示しないと、列を飛ばしたアウェイ側が次の行へ送られてしまう */
.mev .min { grid-row: 1; grid-column: 1; }
.mev .who { grid-row: 1; grid-column: 2; }
.mev.a { grid-template-columns: minmax(0, 1fr) 46px; }
.mev.a .min { grid-column: 2; text-align: left; }
.mev.a .who { grid-column: 1; flex-direction: row-reverse; }
.mev.a .txt { align-items: flex-end; }
.mev.a .nm { flex-direction: row-reverse; }
.mev.a .as { flex-direction: row-reverse; }
.mev.a .as span,
.mev.a .nm .n { text-align: right; }

/* ---------- 両チームを1面に並べたピッチ ---------- */

.mpitch-wrap { display: flex; justify-content: center; }

/* .pitch.h の width:100% より後に置いて上書きする */
.pitch.mpitch {
  width: 100%;
  max-width: var(--mpitch-w, 538px);
  height: var(--mpitch-h, 900px);
  min-height: 0;
}

/* 横向きは1面に10列（両チーム5列ずつ）並ぶので、トークンを少し細くする */
.mpitch.h .mtoken { width: calc(8.4 * var(--u)); }

/* センターサークルの代わりのハーフウェイライン */
.mpitch::before {
  content: '';
  position: absolute;
  left: 0;
  right: 0;
  top: 50%;
  height: 1px;
  background: var(--line-soft);
  z-index: 1;
}

.mpitch.h::before {
  left: 50%;
  right: auto;
  top: 0;
  bottom: 0;
  width: 1px;
  height: auto;
}

.mform {
  position: absolute;
  z-index: 3;
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-50);
}

.mform > .badge { --bs: 22px; }
.mform.away { top: 14px; left: 16px; }
.mform.home { bottom: 14px; left: 16px; }

.mpitch.h .mform.home { top: auto; bottom: 14px; left: 16px; }
.mpitch.h .mform.away { top: auto; bottom: 14px; left: auto; right: 16px; }

.mtoken {
  position: absolute;
  transform: translate(-50%, -50%);
  width: calc(10 * var(--u));
  display: flex;
  flex-direction: column;
  align-items: center;
  cursor: pointer;
  z-index: 4;
  animation: rise 0.4s cubic-bezier(0.2, 0.8, 0.3, 1) both;
}

.mtoken .ico { position: relative; margin-bottom: -0.7cqh; line-height: 0; }

.mtoken .shirt {
  width: calc(5 * var(--u));
  height: calc(5 * var(--u));
  border-radius: 50%;
  position: relative;
  display: grid;
  place-items: center;
  background: var(--brand);
  font-size: calc(1.6 * var(--u));
  font-weight: 700;
  color: #fff;
  box-shadow: 0 0 0 1.5px rgba(0, 0, 0, 0.35);
  transition: transform 0.18s cubic-bezier(0.2, 0.8, 0.3, 1);
}

.mtoken:hover .shirt { transform: translateY(-3px); }

.mtoken .shirt.photo img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border-radius: 50%;
  object-fit: cover;
  object-position: top center;
  display: block;
}

.mtoken .nchip {
  position: relative;
  z-index: 2;
  background: #fff;
  color: #000;
  font-size: calc(1.35 * var(--u));
  font-weight: 600;
  line-height: normal;
  padding: calc(0.1 * var(--u)) calc(0.7 * var(--u));
  border-radius: 30px;
  margin-bottom: calc(0.3 * var(--u));
}

.mtoken .nm {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 3px;
  font-size: calc(1.5 * var(--u));
  font-weight: 600;
  color: #fff;
  width: 100%;
  line-height: 1.25;
  min-width: 0;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.8);
}

.mtoken .nm .t {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
}

.mtoken .nm .cap {
  flex: 0 0 auto;
  font-size: calc(1.05 * var(--u));
  line-height: 1.5;
  color: #000;
  background: rgba(255, 255, 255, 0.85);
  border-radius: 3px;
  padding: 0 calc(0.35 * var(--u));
  text-shadow: none;
}

/* ---------- 控え ---------- */

.msubs {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 24px;
}

.msubs-col { display: flex; flex-direction: column; gap: 8px; }

.msubs-head {
  display: flex;
  align-items: center;
  gap: 9px;
  font-size: 14px;
  font-weight: 600;
  color: #fff;
  padding-bottom: 4px;
}

/* ---------- チームスタッツ ---------- */

.mstats { display: flex; flex-direction: column; gap: 14px; }

.mstat-row { display: flex; flex-direction: column; gap: 6px; }

.mstat-top {
  display: grid;
  grid-template-columns: 70px minmax(0, 1fr) 70px;
  align-items: baseline;
  font-size: 14px;
}

.mstat-top .v { font-weight: 700; color: #fff; font-variant-numeric: tabular-nums; }
.mstat-top .v.h { text-align: left; }
.mstat-top .v.a { text-align: right; }
.mstat-top .k { text-align: center; font-size: 12px; color: var(--text-50); }

.mstat-bar {
  display: flex;
  gap: 3px;
  height: 6px;
  border-radius: 3px;
  overflow: hidden;
}

.mstat-bar span { display: block; border-radius: 3px; min-width: 2px; transition: width 0.4s ease; }
.mstat-bar .a { opacity: 0.75; }

.mstat-note { font-size: 11px; color: var(--text-30); padding-top: 4px; }

/* ---------- 戻るボタン（画面左下に固定） ---------- */

.mback {
  position: fixed;
  left: 20px;
  bottom: calc(20px + var(--tabbar-space));
  z-index: 30;
  appearance: none;
  font-family: inherit;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 44px;
  padding: 0 20px 0 16px;
  border: 1px solid var(--stroke);
  border-radius: var(--radius-pill);
  background: rgba(32, 32, 32, 0.92);
  backdrop-filter: blur(12px);
  color: #fff;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  box-shadow: 0 6px 24px rgba(0, 0, 0, 0.45);
  transition: background 0.15s ease, border-color 0.15s ease;
}

.mback:hover { background: #fff; color: #000; border-color: #fff; }
.mback .ar { font-size: 16px; line-height: 1; }

@media (max-width: 767px) {
  .mpage { padding: 16px 0 96px; gap: 20px; }

  .mhead { padding: 20px 14px 14px; }

  .mhead .glow { width: 80px; height: 80px; filter: blur(40px); opacity: 0.6; }
  .mhead .glow.home { left: -10px; }
  .mhead .glow.away { right: -10px; }

  .mhead-line { grid-template-columns: minmax(0, 1fr) 96px minmax(0, 1fr); gap: 6px; }

  .mteam { flex-direction: column; gap: 8px; text-align: center; }
  .mteam.a { flex-direction: column; }
  .mteam > .badge { --bs: 44px; }
  .mteam .nm { font-size: 13px; white-space: normal; line-height: 1.25; }

  .mscore .sc { font-size: 34px; }
  .mscore .ko { font-size: 22px; }

  .mmeta { margin-top: 14px; font-size: 11px; }

  .mev { grid-template-columns: 34px minmax(0, 1fr); gap: 8px; font-size: 13px; }
  .mev.a { grid-template-columns: minmax(0, 1fr) 34px; }

  .msubs { grid-template-columns: 1fr; gap: 18px; }

  .mstat-top { grid-template-columns: 52px minmax(0, 1fr) 52px; font-size: 13px; }

  /* スマホはクラブバーが横並びになるので左端に置ける */
  .mback {
    left: 20px;
    bottom: calc(20px + var(--tabbar-space));
    height: 40px;
    padding: 0 16px 0 12px;
    font-size: 13px;
  }

  .match .when .sc { font-size: 22px; }
}


/* ===========================================================
   Bottom tab bar — Teams / Schedule / Ranking
   =========================================================== */

/* 左右・下に20pxの余白を取って浮かせる。完全な角丸（高さの半分） */
.tabbar {
  position: fixed;
  left: 50%;
  transform: translateX(-50%);
  bottom: calc(20px + env(safe-area-inset-bottom));
  width: calc(100% - 40px);
  max-width: 360px;
  z-index: 90;
  display: flex;
  gap: 2px;
  height: var(--tabbar-h);
  padding: var(--tabbar-pad);
  border-radius: 999px;
  background: rgba(22, 22, 22, 0.82);
  backdrop-filter: blur(18px);
  box-shadow: inset 0 0 0 0.5px var(--stroke), 0 12px 34px rgba(0, 0, 0, 0.55);
}

/* 角丸はバーの内側にぴったり沿わせる（バーの半径 − 内側の余白） */
.tabitem {
  appearance: none;
  border: 0;
  background: none;
  font-family: inherit;
  cursor: pointer;
  flex: 1 1 0;
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  border-radius: calc((var(--tabbar-h) - var(--tabbar-pad) * 2) / 2);
  color: var(--text-30);
  transition: color 0.15s ease, background 0.15s ease;
}

.tabitem .ic { width: 21px; height: 21px; display: block; }

.tabitem .lb {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.02em;
  line-height: 1;
}

.tabitem:hover { color: var(--text-50); }

.tabitem.active {
  color: #fff;
  background: rgba(255, 255, 255, 0.13);
}


/* ===========================================================
   Ranking — 順位表
   =========================================================== */

/* 枠で囲わず、そのまま並べる。狭い画面だけ横スクロールさせる */
.rank-scroll { overflow-x: auto; }

.ranking {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
  white-space: nowrap;
}

.ranking th {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-50);
  text-align: right;
  padding: 10px 8px;
}

.ranking th.pos,
.ranking th.club { text-align: left; }
.ranking th.form { text-align: left; }

.ranking td {
  padding: 10px 8px;
  border-top: 0.5px solid var(--line-soft);
  text-align: right;
  font-variant-numeric: tabular-nums;
  color: var(--text-50);
}

.ranking tbody tr { cursor: pointer; transition: background 0.15s ease; }
.ranking tbody tr:hover { background: rgba(255, 255, 255, 0.04); }

.ranking td.pos {
  width: 48px;
  text-align: center;
  color: var(--text-30);
  position: relative;
  /* ぼかしが行の外へにじまないようセルで切る */
  overflow: hidden;
}

/* 右上で選択しているクラブの行だけ、左端にそのクラブカラーのぼかしを敷く。
   切り口が四角く見えないよう、ぼかしの裾がセルの内側で消える大きさにしてある */
.ranking tr.on td.pos::before {
  content: '';
  position: absolute;
  left: 50%;
  top: 50%;
  width: 18px;
  height: 9px;
  transform: translate(-50%, -50%);
  background: var(--tc, #fff);
  filter: blur(11px);
  pointer-events: none;
}

.ranking tr.on td { color: #fff; }
.ranking tr.on td.pos { color: #fff; }

.ranking td.club {
  text-align: left;
  color: #fff;
  font-weight: 600;
  width: 100%;
}

.ranking td.club { display: flex; align-items: center; gap: 9px; }
.ranking td.club > .badge { --bs: 22px; flex: 0 0 auto; }
.ranking td.club .ab { display: none; }

.ranking td.pts { color: #fff; font-weight: 700; }
.ranking td.gd { color: var(--text-50); }

.ranking td.form { text-align: left; width: 74px; }
.ranking td.form .dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  margin-right: 3px;
}

.ranking td.form .dot.win { background: #16a34a; }
.ranking td.form .dot.draw { background: #6a6a6a; }
.ranking td.form .dot.lose { background: #b03a3a; }

@media (max-width: 767px) {
  .ranking { font-size: 12px; }
  .ranking th,
  .ranking td { padding: 9px 5px; }

  /* 狭いので得点・失点は畳んで、得失点差と勝点を残す */
  .ranking th.gf, .ranking td.gf,
  .ranking th.ga, .ranking td.ga,
  .ranking th.form, .ranking td.form { display: none; }

  .ranking td.club .nm { display: none; }
  .ranking td.club .ab { display: inline; font-weight: 700; letter-spacing: 0.02em; }
  .ranking td.club > .badge { --bs: 20px; }
}

@media (max-width: 767px) {
  /* クラブ一覧も選手プロフィールと同じく横幅いっぱい・2カラム */
  .tp-card { width: 100%; height: 88vh; }
  .tp-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

/* ===========================================================
   選手評価 — アイコン右上に重ねる数字
   =========================================================== */

.rate {
  position: absolute;
  z-index: 3;
  display: grid;
  place-items: center;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  line-height: 1;
  border-radius: 5px;
  border: 1.5px solid var(--bg);
  color: #000;
  pointer-events: none;
}

.rate.hi { background: #16a34a; color: #fff; }
.rate.good { background: #8ecf94; }
.rate.mid { background: #cfcfcf; }
.rate.low { background: #d97070; color: #fff; }

/* ピッチ上はピッチ高さ基準（cqh）で縮む */
.mtoken .rate {
  top: -0.5cqh;
  right: -1.2cqh;
  min-width: calc(3.1 * var(--u));
  height: calc(2 * var(--u));
  padding: 0 calc(0.4 * var(--u));
  font-size: calc(1.3 * var(--u));
  border-width: calc(0.16 * var(--u));
}

/* 控えカードの顔写真 */
.msubs-col .prow .ico { position: relative; flex: 0 0 auto; line-height: 0; }

.msubs-col .prow .rate {
  top: -4px;
  right: -7px;
  min-width: 27px;
  height: 18px;
  padding: 0 4px;
  font-size: 11px;
}

.rate-note {
  font-size: 11px;
  color: var(--text-30);
  line-height: 1.7;
  padding-top: 4px;
}

/* ===========================================================
   交代のステップバー — ピッチの上。0分から試合終了までの目盛りに
   交代のあった分の印を打つ。押すとその時点の11人になる
   =========================================================== */

/* 右端は試合終了の表示（90+5' など）ぶんを空けておく。
   最後の交代が90分台だと、目盛りのラベルと重なるため */
.stepbar {
  position: relative;
  height: 44px;
  margin-bottom: 2px;
  padding: 0 50px 0 6px;
}

.stepbar .track {
  position: absolute;
  left: 6px;
  right: 50px;
  top: 13px;
  height: 3px;
  border-radius: 2px;
  background: var(--pill);
}

.stepbar .step {
  appearance: none;
  border: 0;
  background: none;
  font-family: inherit;
  cursor: pointer;
  position: absolute;
  top: 0;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
  padding: 0;
  --sc: #6a6a6a;
}

.stepbar .step .dot {
  width: 11px;
  height: 11px;
  margin-top: 9px;
  border-radius: 50%;
  background: var(--sc);
  box-shadow: 0 0 0 3px var(--bg);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.stepbar .step .lb {
  font-size: 10px;
  font-weight: 600;
  color: var(--text-30);
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
  transition: color 0.15s ease;
}

.stepbar .step:hover .dot { transform: scale(1.25); }
.stepbar .step:hover .lb { color: var(--text-50); }

.stepbar .step.on .dot {
  transform: scale(1.35);
  box-shadow: 0 0 0 3px var(--bg), 0 0 0 5px rgba(255, 255, 255, 0.85);
}

.stepbar .step.on .lb { color: #fff; }

.stepbar .end {
  position: absolute;
  right: 0;
  top: 8px;
  font-size: 10px;
  color: var(--text-30);
  font-variant-numeric: tabular-nums;
}

/* 交代で入った選手の背番号チップ */
.nchip.sub { display: inline-flex; align-items: center; gap: 0.2em; }
.nchip .sw { font-size: 0.85em; line-height: 1; }

/* ===========================================================
   Quiz — 選手カードの1項目を隠して4択
   =========================================================== */

.quiz {
  display: flex;
  flex-direction: column;
  gap: 16px;
  max-width: 620px;
  margin: 0 auto;
  padding-top: 24px;
}

/* ---------- スタート画面 ---------- */

.q-title { margin: 0; font-size: 34px; font-weight: 700; letter-spacing: -0.01em; }
.q-desc { margin: 0; font-size: 14px; line-height: 1.8; color: var(--text-50); }

.q-go {
  appearance: none;
  font-family: inherit;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 14px;
  width: 100%;
  padding: 18px 20px;
  border: 0;
  border-radius: var(--radius-card);
  background: #202020;
  box-shadow: inset 0 0 0 0.5px var(--stroke);
  color: #fff;
  text-align: left;
  transition: background 0.15s ease, box-shadow 0.15s ease;
}

.q-go:hover { background: #2a2a2a; box-shadow: inset 0 0 0 0.5px #6a6a6a; }
.q-go > .badge { --bs: 34px; flex: 0 0 auto; }
.q-go .lb { font-size: 17px; font-weight: 700; }
.q-go .sub { font-size: 12px; color: var(--text-50); margin-left: auto; text-align: right; }
.q-go.alt { background: none; }

.q-note { font-size: 11px; line-height: 1.8; color: var(--text-30); }

/* ---------- 進行 ---------- */

.q-head { display: flex; align-items: center; gap: 12px; }
.q-count { font-size: 13px; font-weight: 700; font-variant-numeric: tabular-nums; white-space: nowrap; }
.q-score { font-size: 12px; color: var(--text-50); white-space: nowrap; }

.q-bar { flex: 1 1 auto; height: 4px; border-radius: 2px; background: var(--pill); overflow: hidden; }
.q-bar span { display: block; height: 100%; background: #fff; border-radius: 2px; transition: width 0.25s ease; }

/* ---------- 問題 ---------- */

.q-card {
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding: 22px 20px;
  border-radius: var(--radius-card);
  background: #202020;
  box-shadow: inset 0 0 0 0.5px var(--stroke);
}

.q-ask { font-size: 15px; font-weight: 600; color: var(--text-50); }

.q-prompt { display: flex; align-items: center; gap: 18px; min-width: 0; }
.q-lines { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.q-name { font-size: 22px; font-weight: 700; line-height: 1.3; }
.q-en { font-size: 13px; color: var(--text-50); }
.q-tags { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 6px; }

/* 顔写真。問題文では大きく、選択肢ではさらに大きく */
.qface {
  position: relative;
  width: 88px;
  height: 88px;
  flex: 0 0 88px;
  border-radius: 50%;
  overflow: hidden;
  display: grid;
  place-items: center;
  background: var(--brand);
  font-size: 26px;
  font-weight: 700;
  color: rgba(255, 255, 255, 0.9);
}

.qface img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; object-position: top center; }

/* ---------- 選択肢 ---------- */

.q-opts { display: flex; flex-direction: column; gap: 10px; }
.q-opts.photo { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }

.q-opt {
  appearance: none;
  font-family: inherit;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  min-height: 58px;
  padding: 12px 18px;
  border: 0;
  border-radius: var(--radius-card);
  background: #202020;
  box-shadow: inset 0 0 0 0.5px var(--stroke);
  color: #fff;
  text-align: left;
  transition: background 0.15s ease, box-shadow 0.15s ease;
}

.q-opt:hover:not(:disabled) { background: #2c2c2c; box-shadow: inset 0 0 0 0.5px #7a7a7a; }
.q-opt:disabled { cursor: default; }

.q-opt.photo { justify-content: center; padding: 16px; }
.q-opt.photo .qface { width: 110px; height: 110px; flex-basis: 110px; }

.q-opt .q-lb { display: flex; flex-direction: column; gap: 2px; min-width: 0; font-size: 16px; font-weight: 600; }
.q-opt .q-lb .en { font-size: 12px; font-weight: 400; color: var(--text-50); }

/* 背番号の選択肢は数字だけなので大きく、桁で揺れないように等幅数字で */
.q-opt .q-lb.num { font-size: 24px; font-weight: 700; font-variant-numeric: tabular-nums; letter-spacing: -0.5px; }

/* クラブの選択肢の印。PLのエンブレムが無いクラブはリーグの国旗で代用する */
.cmark {
  --bs: 24px;
  width: var(--bs);
  height: var(--bs);
  flex: 0 0 var(--bs);
  display: inline-grid;
  place-items: center;
  font-size: calc(var(--bs) * 0.82);
  line-height: 1;
  vertical-align: middle;
}

.q-opt > .cmark { --bs: 26px; }
.q-opt > .badge { --bs: 26px; flex: 0 0 auto; }

.q-opt.right { background: rgba(22, 163, 74, 0.22); box-shadow: inset 0 0 0 1.5px #16a34a; }
.q-opt.wrong { background: rgba(176, 58, 58, 0.22); box-shadow: inset 0 0 0 1.5px #b03a3a; }

/* ---------- 正誤と次へ ---------- */

.q-feedback { display: flex; align-items: baseline; gap: 10px; font-size: 14px; flex-wrap: wrap; }
.q-feedback .mk { font-size: 16px; font-weight: 700; }
.q-feedback.ok .mk { color: #4ade80; }
.q-feedback.ng .mk { color: #f87171; }
.q-feedback .ans { color: var(--text-50); }
.q-feedback .ans::before { content: '正解は '; }

.q-next {
  appearance: none;
  font-family: inherit;
  cursor: pointer;
  width: 100%;
  height: 50px;
  border: 0;
  border-radius: var(--radius-pill);
  background: #fff;
  color: #000;
  font-size: 15px;
  font-weight: 700;
  transition: opacity 0.15s ease;
}

.q-next:hover { opacity: 0.85; }
.q-next.alt { background: var(--pill); color: #fff; box-shadow: inset 0 0 0 0.5px var(--stroke); }

/* ---------- 結果 ---------- */

.q-result { display: flex; flex-direction: column; align-items: center; gap: 10px; padding: 40px 0 0; }
.q-big { font-size: 56px; font-weight: 700; line-height: 1; font-variant-numeric: tabular-nums; }
.q-label { font-size: 17px; font-weight: 600; color: var(--text-50); }
.q-of { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--text-30); margin-bottom: 18px; }
.q-result .q-next { margin-top: 4px; }

@media (max-width: 767px) {
  .quiz { padding-top: 12px; gap: 14px; }
  .q-title { font-size: 28px; }
  .q-card { padding: 18px 16px; }
  .q-prompt { gap: 14px; }
  .qface { width: 72px; height: 72px; flex-basis: 72px; font-size: 22px; }
  .q-name { font-size: 19px; }
  .q-opt.photo .qface { width: 100%; height: auto; aspect-ratio: 1; flex-basis: auto; }
  .q-opt.photo { padding: 12px; }
  /* 説明文は折り返して2行目に置く（ボタン名を潰さない） */
  .q-go { padding: 16px; gap: 10px 12px; flex-wrap: wrap; }
  .q-go .lb { font-size: 16px; }
  .q-go .sub { width: 100%; margin-left: 0; text-align: left; font-size: 11px; }
  .q-big { font-size: 46px; }
}
