/* ============================================================
   守備位置の盤面（js/field.js）
   管理画面の「守備位置」と、部員画面の「ポジション」で共用する。
   ============================================================ */

.fd {
  --fd-blue: #2c66bd;
  --fd-line: #3b6db6;
  --fd-ink: #1f2a37;
  position: relative;
  width: 100%;
  max-width: 480px;
  margin: 0 auto;
  border-radius: 18px;
  overflow: hidden;
  /* 箱の大きさは盤面の幅に合わせたいので、文字も画面の幅で決める（広い画面では頭打ち） */
  font-size: clamp(11.5px, 3.7vw, 16px);
  font-family: inherit;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.08);
  -webkit-user-select: none;
  user-select: none;
}
/* 縦横比（横 100 : 縦 116）。aspect-ratio の無い古い Safari でも潰れないよう余白で取る */
.fd::before {
  content: "";
  display: block;
  padding-top: 116%;
}
.fd-field {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
}

/* 守備位置ごとの箱。中心を座標に合わせ、左に守備番号を出す */
.fd-spot {
  position: absolute;
  transform: translate(-50%, -50%);
  width: max-content;
  min-width: 25%;
  max-width: 36%;
  display: flex;
  flex-direction: column;
}
.fd-no {
  position: absolute;
  right: 100%;
  top: 50%;
  transform: translateY(-50%);
  margin-right: 0.12em;
  font-size: 2.1em;
  font-weight: 800;
  line-height: 1;
  color: var(--fd-blue);
  text-shadow: 0 1px 0 rgba(255, 255, 255, 0.35);
  pointer-events: none;
}

/* ---- 名札（管理画面）---- */
.fd-card {
  position: relative;
  background: #fff;
  border: 1.5px solid var(--fd-line);
  border-radius: 0.7em;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.18);
  color: var(--fd-ink);
  font-weight: 800;
  text-align: center;
}
.fd-card.one { padding: 0.5em 0.55em 0.35em; }
/* 背番号は名札の上に重ねる */
.fd-tab {
  position: absolute;
  left: 50%;
  top: 0;
  transform: translate(-50%, -62%);
  min-width: 1.9em;
  padding: 0.02em 0.4em;
  background: #fff;
  border: 1.5px solid var(--fd-line);
  border-radius: 0.45em;
  font-size: 0.95em;
  line-height: 1.25;
  white-space: nowrap;
}
.fd-name {
  display: block;
  font-size: 1.05em;
  white-space: nowrap;
  letter-spacing: 0.02em;
}
/* 同じ守備位置に何人もいるときは1枚の名札に並べる */
.fd-card.many {
  display: flex;
  flex-direction: column;
  gap: 0.2em;
  padding: 0.3em 0.45em;
}
.fd-row {
  display: flex;
  align-items: center;
  gap: 0.35em;
  white-space: nowrap;
}
.fd-row .fd-name { font-size: 0.98em; }
.fd-num {
  flex: 0 0 auto;
  min-width: 1.9em;
  padding: 0 0.2em;
  border: 1.5px solid var(--fd-line);
  border-radius: 0.4em;
  font-size: 0.8em;
  line-height: 1.35;
  text-align: center;
}
.fd-num.none { border-style: dashed; color: #9aa3ad; }
.fd-mark {
  font-size: 0.68em;
  color: #d35400;
  margin-left: 0.1em;
}
.fd-card.empty {
  background: rgba(255, 255, 255, 0.6);
  border-style: dashed;
  color: #4d5d4a;
  font-size: 0.85em;
  padding: 0.35em 0.45em;
  box-shadow: none;
}
.fd-cand {
  display: block;
  margin-top: 0.15em;
  font-size: 0.82em;
  font-weight: 700;
  color: #35522f;
  white-space: normal;
  line-height: 1.35;
}

/* ---- 選ぶボタン（部員画面）---- */
.fd-pick {
  position: relative;
  width: 100%;
  min-height: 2.6em;
  padding: 0.45em 0.4em;
  background: #fff;
  border: 1.5px solid var(--fd-line);
  border-radius: 0.7em;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.18);
  color: var(--fd-ink);
  font: inherit;
  font-weight: 800;
  font-size: 1em;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: transform 0.12s, background 0.15s;
}
.fd-pick:active { transform: scale(0.95); }
.fd-pick.on {
  background: var(--fd-blue);
  border-color: #fff;
  color: #fff;
}
.fd-pick.on .fd-tab {
  color: var(--fd-blue);
  font-size: 0.8em;
}

/* ---- 盤面の下：空いた守備位置の帯と、外野・内野・バッテリーの一覧 ---- */
.fd-gaps {
  margin: 0.6rem 0;
  padding: 0.5rem 0.8rem;
  border-radius: 10px;
  background: #f6f3ee;
  font-size: 0.85rem;
  font-weight: 800;
  text-align: center;
  color: var(--text-sub, #8a8a8a);
}
.fd-gaps.warn { background: #fff4e0; color: #a15c00; }
.fd-gaps.ok { background: #eaf7ef; color: #1e8449; }
.fd-groups {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  margin-top: 0.6rem;
}
.fd-group {
  border: 1.5px solid var(--border, #e8e2da);
  border-radius: 12px;
  overflow: hidden;
}
.fd-group-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: 0;
  padding: 0.45rem 0.8rem;
  background: #f7f4ef;
  font-size: 0.88rem;
  font-weight: 800;
  color: var(--primary-dark, #6b4f0a);
}
.fd-group-head span { font-size: 0.75rem; color: var(--text-sub, #8a8a8a); }
.fd-pos-list { list-style: none; margin: 0; padding: 0; }
.fd-pos {
  display: flex;
  align-items: flex-start;
  gap: 0.45rem;
  padding: 0.5rem 0.7rem;
  border-top: 1px solid #f0ebe4;
}
.fd-pos:first-child { border-top: none; }
.fd-pos.empty { background: #fffaf0; }
.fd-pos-no {
  flex: 0 0 1.1em;
  font-size: 1.25rem;
  font-weight: 800;
  line-height: 1.35;
  text-align: center;
  color: #2c66bd;
}
.fd-pos-label {
  flex: 0 0 3.3em;
  font-size: 0.85rem;
  font-weight: 800;
  line-height: 2;
}
.fd-pos-players {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 5px;
}
.fd-player {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 9px 3px 4px;
  border: 1.5px solid #3b6db6;
  border-radius: 8px;
  background: #fff;
  font-size: 0.88rem;
  font-weight: 800;
}
.fd-player.no-num { padding-left: 9px; }
.fd-player-num {
  min-width: 1.8em;
  padding: 0 0.25em;
  border-radius: 5px;
  background: #eef3fb;
  color: #2c66bd;
  font-size: 0.75rem;
  text-align: center;
}
.fd-player-mark { margin-left: -2px; font-size: 0.68rem; color: #d35400; }
.fd-pos-empty { padding: 3px 0; font-size: 0.82rem; font-weight: 800; color: #a15c00; }
.fd-pos-cand { font-size: 0.78rem; font-weight: 700; color: var(--text-sub, #8a8a8a); }
