label.required:after {
   content:" *";
   color: red;
}

.entry-name {
  font-size: 0.78rem;
  padding: 0 0.15rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ブラケット上の試合ボタン（「回戦-試合番号」を表示する細長いボタン） */
/*
 * ブラケット上の試合ボタン（「回戦-番号」を表示する細長いボタン）。
 * 古い .viewer-id（15px 四方の固定サイズ）がコンパイル済みCSSに残っていても崩れないよう、
 * 大きさ・余白・文字サイズは CSS 変数ではなく直接指定する（.btn.viewer-id の方が詳細度が高い）。
 */
.btn.viewer-id {
  --bs-btn-color: #fff;
  --bs-btn-hover-color: #fff;
  --bs-btn-active-color: #fff;
  width: auto;
  min-width: 0;
  height: 14px;
  padding: 0 5px;
  font-size: 0.7rem;
  line-height: 12px;
  border-radius: 3px;
  white-space: nowrap;
  overflow: visible;
}

.viewer-button {
  font-size: 0.75rem;
  padding: 0px 2px;
}

.entry-width {
    width: 220px;
}

/* ブラケット上のエントリーの枠（エントリーの間隔 BRACKET_PIXELS_PER_UNIT * 2 = 26px より少し低くする） */
.entry-box {
  height: 23px;
}

/*
 * エントリーの位置を決める入れ物（_entry の layout_height を渡したとき）。
 * エントリーが多いと、描き直すたびに全部の配置の計算で時間がかかるので、
 * 画面の外にあるものは計算を省く（content-visibility）。見えていないときの高さは枠と同じにしておく。
 * 中身の影が切れないよう、はみ出しを少しだけ許す。
 */
.entry-position {
  content-visibility: auto;
  contain-intrinsic-size: auto 23px;
  overflow-clip-margin: 4px;
}

/* エントリー左端のアイコン（詳細・ブロック移動）。押せることが分かるよう色付きのボタンにする */
.entry-icon {
  width: 24px;
  padding: 0;
  font-size: 0.7rem;
  transition: background-color 0.15s, color 0.15s;
}

/* エントリーの詳細（青） */
.entry-icon-detail {
  background-color: #e7f1ff;
  color: #0d6efd;
}

.entry-icon-detail:hover,
.entry-icon-detail:focus-visible {
  background-color: #0d6efd;
  color: #fff;
}

/* 勝ち上がり元のブロック・ブラケットへ移動（紫。編集画面の分割の試合と同じ色） */
.entry-icon-link {
  background-color: #efe8fa;
  color: #6f42c1;
}

.entry-icon-link:hover,
.entry-icon-link:focus-visible {
  background-color: #6f42c1;
  color: #fff;
}

.modal-body {
  overflow-x: auto;
}

#modal_content {
  position: relative;
}

#modal_content::after {
  content: "";
  position: absolute;
  inset: 0;
  display: none;
  background-color: rgba(255, 255, 255, 0.7);
  z-index: 10;
}

#modal_content::before {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  width: 2rem;
  height: 2rem;
  margin: -1rem 0 0 -1rem;
  display: none;
  border: 0.25rem solid;
  border-right-color: transparent;
  border-radius: 50%;
  animation: modal-spin 0.75s linear infinite;
  z-index: 11;
}

#modal_content[aria-busy="true"]::after,
#modal_content[aria-busy="true"]::before {
  display: block;
}

/* 読み込み中の表示（shared/_modal_loading）を出しているときは、白い膜とくるくるは重ねない（スピナーが2つにならないように）。
   フォームの送信中（入れ替えない）は、今までどおり膜とくるくるを出す */
#modal_content:has(> .modal-loading)::after,
#modal_content:has(> .modal-loading)::before {
  display: none;
}

.modal-loading {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 12rem;
}

.dropdown:has(.dropdown-menu.show) {
  z-index: 10;
}

@keyframes modal-spin {
  to {
    transform: rotate(360deg);
  }
}

@media (max-width: 768px) {
  /* スマホでは名前をできるだけ多く表示するため、文字と余白を詰める */
  .entry-name {
    font-size: 0.6rem;
    padding: 0 0.1rem;
    letter-spacing: -0.02em;
  }

  /* スマホでも押せる幅を残す */
  .entry-icon {
    width: 18px;
    font-size: 0.6rem;
  }

  .entry-width {
    width: 110px;
  }  

  .viewer-button {
    font-size: 0.50rem;
    padding: 0px 2px;
  }

  .modal-dialog {
    margin: 1rem;
    max-width: calc(100vw - 2rem);
    width: calc(100vw - 2rem);
  }

  .modal-content {
    border-radius: 0.5rem;
  }

  .modal-body {
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
  }

  .btn.viewer-id {
    width: auto;
    height: 9px;
    padding: 0 1px;
    font-size: 0.45rem;
    line-height: 7px;
    letter-spacing: -0.05em;
  }
}
/* 編集画面のボタン（白文字が読める濃さの水色。cyan-700） */
.btn-edit {
  --bs-btn-bg: #087990;
  --bs-btn-border-color: #087990;
  --bs-btn-hover-bg: #066170;
  --bs-btn-hover-border-color: #066170;
  --bs-btn-active-bg: #055160;
  --bs-btn-active-border-color: #055160;
  --bs-btn-color: #fff;
  --bs-btn-hover-color: #fff;
  --bs-btn-active-color: #fff;
}

/*
 * 編集画面：開いたドロップダウンを他のボタン・エントリー・列より前面に出す。
 * ボタンの配置に transform を使っているため、メニューの z-index だけでは
 * 後から描画される要素の下に隠れてしまう。開いている間だけ配置用の要素ごと前面に出す。
 * このルールはメニューを含む親の要素（ブラケットの列全体）にも当たるので、
 * 上部のバー（.sb-topnav、z-index 1039）やサイドバー（1038）より小さい値にする。
 * ブラケットの中の要素は z-index が auto か 10 以下なので、20 で前面に出る。
 */
#bracket_editor :is(.position-relative, .position-absolute):has(.dropdown-menu.show) {
  z-index: 20;
}

/*
 * Tom Select：候補一覧は body に出すため、モーダル（z-index 1055）より前面に出す。
 * Tom Select の CSS（z-index: 10）が後から読み込まれるため、詳細度を上げて上書きされないようにする。
 */
body > .ts-dropdown {
  z-index: 1060;
}

/* ブラケットのエントリー番号。桁数が変わっても名前の開始位置がそろうよう最小幅を取る */
.entry-number {
  display: inline-block;
  min-width: 1em;
  margin-right: 0.1em;
  text-align: right;
  font-variant-numeric: tabular-nums;
}

@media (max-width: 768px) {
  .entry-number {
    min-width: 0;
    margin-right: 0.1em;
  }
}

/* 編集画面であることを示すバーと、ブラケットの枠（編集用の色 .btn-edit と同じ。白文字のコントラスト比 約5:1） */
.editing-bar {
  background-color: #087990;
  color: #fff;
}

.editing-frame {
  border: 2px solid #087990 !important;
}

/* 編集画面：分割（separate）の試合のボタン。通常の水色（btn-edit）と区別できる紫（白文字のコントラスト比 約6:1） */
.btn-separate {
  --bs-btn-bg: #6f42c1;
  --bs-btn-border-color: #6f42c1;
  --bs-btn-hover-bg: #59359a;
  --bs-btn-hover-border-color: #59359a;
  --bs-btn-active-bg: #432874;
  --bs-btn-active-border-color: #432874;
  --bs-btn-color: #fff;
  --bs-btn-hover-color: #fff;
  --bs-btn-active-color: #fff;
}

/* 準備完了（黄色）のボタンは白文字だと読みにくいため黒文字にする */
.btn.viewer-id.btn-warning {
  --bs-btn-color: #000;
  --bs-btn-hover-color: #000;
  --bs-btn-active-color: #000;
}

.min-w-0 {
  min-width: 0;
}

@media (max-width: 768px) {
  /* スマホでは文字が小さいので、枠も少し低くする */
  .entry-box {
    height: 21px;
  }
}

/* 大会のブラケット切り替え（ドロップダウン） */
.bracket-switcher {
  max-width: 100%;
}

/* ブラケットが多いときはメニューの中でスクロールする */
.bracket-switcher-menu {
  min-width: 14rem;
  max-width: min(24rem, calc(100vw - 2rem));
  max-height: 60vh;
  overflow-y: auto;
}

/* 一覧の行の左に置く丸・角丸のアイコン（頭文字・番号） */
.list-avatar {
  width: 36px;
  height: 36px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

/*
 * 一覧の行の「⋮」メニュー（shared/_row_menu）を開いたときは、メニューの入れ物と行を前に出す。
 * 入れ物は行全体のリンクより前に出すため z-2 で、次の行のボタン（QRコードなど。同じ z-2）が後から描かれて
 * 開いたメニューの上に重なってしまう。行も、試合中のコートの行（list-group-item-action）は重ねると z-index: 1 になる
 */
.dropdown:has(> .dropdown-menu.show),
.list-group-item:has(.dropdown-menu.show) {
  z-index: 1000 !important;
}

/* 一覧が空のときだけ「まだありません」を表示する（turbo_stream で行が足されたら消える） */
.list-group > .list-empty:not(:only-child) {
  display: none;
}

/* ブラケットのエントリー名の後ろの所属団体（名前より少し小さく） */
.entry-group {
  font-size: 0.8em;
}

/* 勝ち上がり線の先の印（上のブロックへ / トロフィー） */
.winner-mark {
  z-index: 1;
}

.btn.winner-mark {
  --bs-btn-padding-y: 0.1rem;
  --bs-btn-padding-x: 0.4rem;
  --bs-btn-font-size: 0.75rem;
}

/* スマホでは矢印だけの小さな丸いボタンにする */
@media (max-width: 767.98px) {
  .btn.winner-mark {
    --bs-btn-padding-y: 0;
    --bs-btn-padding-x: 0;
    --bs-btn-font-size: 0.6rem;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
  }
}

.winner-trophy {
  color: #e0a800;
  font-size: 1.1rem;
  line-height: 1;
}

/* ===== 試合のモーダル：選手のカード（matches/_players）。上に選手名、下にプロフィール画像 ===== */
.player-card {
  flex: 1 1 0;
  min-width: 0;
  max-width: 200px;
  display: flex;
  flex-direction: column;
  background-color: var(--bs-body-bg);
  border: 1px solid var(--bs-border-color);
  border-radius: 1.5rem;
  overflow: hidden;
  box-shadow: 0 0.25rem 0.75rem rgba(0, 0, 0, 0.08);
}

/* 選手名（プロフィール画像の下） */
.player-card-name-area {
  padding: 0.75rem 0.6rem 0.5rem;
  text-align: center;
}

/* 名前と所属は省略せず、長ければ折り返して全部出す（ダブルスのペア名や長い大学名もあるため） */
.player-card-name {
  font-size: 1.1rem;
  font-weight: 700;
  line-height: 1.35;
  overflow-wrap: anywhere;
  text-wrap: balance;
}

.player-card-group {
  margin-top: 0.2rem;
  font-size: 0.85rem;
  line-height: 1.35;
  color: var(--bs-secondary-color);
  overflow-wrap: anywhere;
  text-wrap: balance;
}

/* プロフィール画像（上）。カード幅いっぱいで、名前の場所を広く取るため正方形より低くする。
   今は人のシルエットを上下中央に出す */
.player-card-photo {
  aspect-ratio: 4 / 3;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  background: linear-gradient(180deg, #e9ecef 0%, #ced4da 100%);
  color: #adb5bd;
  font-size: 3.75rem;
  line-height: 1;
}

/* 点数・勝者の入力（いちばん下） */
.player-card-foot {
  margin-top: auto;
  padding: 0.6rem 0.75rem 0.9rem;
  text-align: center;
}

/* 点数の入力欄と勝者ボタンも丸い形にそろえる */
.player-card-foot .form-select,
.player-card-foot .btn {
  border-radius: 50rem;
}

/* 点数の入力：［−］［数字］［＋］ */
.score-stepper {
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

.btn.score-stepper-btn {
  flex-shrink: 0;
  width: 2.25rem;
  height: 2.25rem;
  padding: 0;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--bs-body-color);
  background-color: var(--bs-tertiary-bg);
  border: 1px solid var(--bs-border-color);
}

.btn.score-stepper-btn:hover,
.btn.score-stepper-btn:focus-visible {
  color: #fff;
  background-color: var(--bs-primary);
  border-color: var(--bs-primary);
}

.score-stepper-input {
  min-width: 0;
  flex: 1 1 auto;
  height: 2.25rem;
  padding: 0 0.25rem;
  text-align: center;
  font-size: 1.25rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  border-radius: 0.6rem;
  -moz-appearance: textfield;
  appearance: textfield;
}

/* 入力欄の中の上下の矢印は出さない（−・＋ボタンで変える） */
.score-stepper-input::-webkit-outer-spin-button,
.score-stepper-input::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

.player-card-score {
  font-size: 2.75rem;
  font-weight: 800;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}

.btn-check:checked + .btn.player-card-winner-toggle {
  color: #212529;
}

/* 勝者は金色の枠と王冠、敗者は少し薄く。
   入力欄があるときは、選ばれている「勝者」ボタン（:checked）のカードを勝者として表示する */
.player-card-winner,
.player-card:has(.btn-check:checked) {
  border-color: #ffc107;
  box-shadow: 0 0 0 2px #ffc107, 0 0.25rem 0.75rem rgba(255, 193, 7, 0.35);
}

.player-card-crown {
  display: none;
}

.player-card-winner .player-card-crown,
.player-card:has(.btn-check:checked) .player-card-crown {
  display: inline-block;
}

.player-card-loser {
  opacity: 0.6;
}

/* 対戦相手が未定 */
.player-card-empty {
  opacity: 0.55;
}

/* 中央の VS */
.player-vs {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 2.2rem;
  height: 2.2rem;
  border-radius: 50%;
  font-size: 0.75rem;
  font-weight: 800;
  color: #fff;
  background-color: #212529;
}

@media (max-width: 575.98px) {
  .player-card {
    border-radius: 1.1rem;
  }

  .player-card-name {
    font-size: 1.05rem;
  }

  .player-card-photo {
    font-size: 2.75rem;
  }

  .player-card-score {
    font-size: 2.2rem;
  }

  .player-vs {
    width: 1.9rem;
    height: 1.9rem;
    font-size: 0.65rem;
  }
}

/* コートのQRコード */
.court-qr-box {
  max-width: 220px;
}

.court-qr {
  display: block;
  width: 100%;
  height: auto;
}

/* ===== コートの画面（courts/show）。スマホで審判が点数を入れる画面 ===== */
/* project レイアウト（上部のバー 56px の下に container-fluid px-4）の中で、画面の幅いっぱいに広げる */
.court-live {
  min-height: calc(100vh - 56px);
  margin-left: -1.5rem;
  margin-right: -1.5rem;
  background-color: #f1f3f5;
}

/* 上部のバーの下の帯：コート番号・プロジェクト名・状態・更新。スクロールしてもバーの下に残る */
.court-live-header {
  position: sticky;
  top: 56px;
  z-index: 10;
  background-color: #fff;
  border-bottom: 1px solid var(--bs-border-color);
  box-shadow: 0 0.125rem 0.5rem rgba(0, 0, 0, 0.05);
}

.court-live-header-inner {
  max-width: 640px;
  margin: 0 auto;
  padding: 0.75rem 1rem;
  display: flex;
  align-items: center;
  gap: 0.85rem;
}

.court-live-number {
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: 3.25rem;
  height: 3.25rem;
  border-radius: 0.9rem;
  color: #fff;
  background-color: #212529;
  line-height: 1;
}

.court-live-number-label {
  font-size: 0.55rem;
  font-weight: 700;
  letter-spacing: 0.15em;
  opacity: 0.75;
}

.court-live-number-value {
  font-size: 1.5rem;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
}

.court-live-project {
  font-size: 0.8rem;
  color: var(--bs-secondary-color);
}

.court-live-status {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  margin-top: 0.2rem;
  padding: 0.1rem 0.6rem;
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--bs-secondary-color);
  border-radius: 50rem;
  background-color: var(--bs-secondary-bg);
}

.court-live-status-playing {
  color: #fff;
  background-color: #dc3545;
}

/* 状態の点（試合中・待機中は点滅させる） */
.court-live-dot {
  width: 0.5rem;
  height: 0.5rem;
  border-radius: 50%;
  background-color: currentColor;
  animation: court-live-pulse 1.4s ease-in-out infinite;
}

@keyframes court-live-pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.25; }
}

.btn.court-live-refresh {
  flex-shrink: 0;
  width: 2.75rem;
  height: 2.75rem;
  padding: 0;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--bs-body-color);
  background-color: var(--bs-secondary-bg);
  border: 0;
}

.btn.court-live-refresh:hover,
.btn.court-live-refresh:focus-visible {
  color: #fff;
  background-color: #212529;
}

/* 中身 */
.court-live-main {
  max-width: 640px;
  margin: 0 auto;
  padding: 1rem;
}

.court-live-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-bottom: 0.75rem;
}

.court-live-chip {
  display: inline-flex;
  align-items: center;
  max-width: 100%;
  padding: 0.2rem 0.75rem;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--bs-secondary-color);
  background-color: #fff;
  border: 1px solid var(--bs-border-color);
  border-radius: 50rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* 試合の内容（試合のモーダルと同じもの）を白いカードに入れる。モーダル用の見出し・閉じるボタンは出さない */
.court-live-panel {
  background-color: #fff;
  border-radius: 1.5rem;
  box-shadow: 0 0.25rem 1rem rgba(0, 0, 0, 0.08);
  overflow: hidden;
}

.court-live-panel .modal-header {
  display: none;
}

.court-live-panel .modal-body {
  padding: 0.5rem 1rem 1rem;
}

.court-live-hint {
  margin: 1rem 0 0;
  font-size: 0.8rem;
  color: var(--bs-secondary-color);
  text-align: center;
}

/* 空いているとき */
.court-live-empty {
  margin-top: 2.5rem;
  padding: 2.5rem 1.5rem;
  text-align: center;
  background-color: #fff;
  border-radius: 1.5rem;
  box-shadow: 0 0.25rem 1rem rgba(0, 0, 0, 0.06);
}

.court-live-empty-icon {
  width: 5rem;
  height: 5rem;
  margin: 0 auto 1.25rem;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2rem;
  color: #adb5bd;
  background-color: #f1f3f5;
}

.court-live-empty-title {
  margin-bottom: 0.25rem;
  font-size: 1.15rem;
  font-weight: 700;
}

.court-live-empty-text {
  margin-bottom: 1.25rem;
  font-size: 0.9rem;
  color: var(--bs-secondary-color);
}

.court-live-waiting {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.25rem 0.85rem;
  font-size: 0.75rem;
  color: #198754;
  background-color: #d1e7dd;
  border-radius: 50rem;
}

/* QRコードの印刷：1つのコートがページをまたがないようにする */
/*
 * コートのQRコードの印刷用のページ（courts/qr_sheet）。1枚分（12面）ずつの並び。
 * 画面では3列（スマホは2列）に並べ、印刷ではA4縦1枚に3列×4段で、1枚ごとに改ページする
 */
.qr-sheet-page {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1rem;
  margin-bottom: 1rem;
}

.qr-sheet-cell {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-width: 0;
  padding: 1rem;
  border: 1px solid var(--bs-border-color);
  border-radius: 0.5rem;
  text-align: center;
}

.qr-sheet-cell .court-qr-box {
  width: 100%;
}

@media (max-width: 575.98px) {
  .qr-sheet-page {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media print {
  @page {
    size: A4 portrait;
    margin: 10mm;
  }

  .qr-sheet {
    max-width: none;
    padding: 0 !important;
  }

  /* 1枚の高さを決めて（余白を除いた277mmより少し小さく）、4段に等分する。
     中身に引っ張られて段が伸びると次の枚に重なるので、段の高さは中身によらず固定する（minmax(0, 1fr)） */
  .qr-sheet-page {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    grid-template-rows: repeat(4, minmax(0, 1fr));
    gap: 4mm;
    height: 270mm;
    margin: 0;
    overflow: hidden;
    break-after: page;
  }

  .qr-sheet-page:last-child {
    break-after: auto;
  }

  /* 1マスは約62mm×64mm。コート名・QR（38mm）・大会名が収まる大きさにする */
  .qr-sheet-cell {
    padding: 2mm;
    border-radius: 2mm;
    overflow: hidden;
    break-inside: avoid;
  }

  .qr-sheet-cell .h4 {
    margin-bottom: 1.5mm !important;
    font-size: 14pt;
  }

  .qr-sheet-cell .court-qr-box {
    width: 38mm;
    max-width: none;
  }

  .qr-sheet-cell .small {
    margin-top: 1.5mm !important;
    font-size: 8pt;
  }
}

/* ===== 公開ページ（トップページ・ログインなど。layouts/public） ===== */
.public {
  background-color: var(--bs-body-bg);
  /* 上部のバー（fixed-top）の高さ分、本文を下げる */
  padding-top: 56px;
}

.public-nav {
  min-height: 56px;
  box-shadow: 0 0.125rem 0.5rem rgba(0, 0, 0, 0.25);
}

/* スマホでメニューを開いたときは、開いたメニューが画面からはみ出さないようにスクロールできるようにする */
@media (max-width: 767.98px) {
  .public-nav .navbar-collapse {
    max-height: calc(100vh - 56px);
    overflow-y: auto;
  }
}

/* 上部のバーのリンクで、各セクションへなめらかにスクロールする。
   上部のバー（sticky、高さ約56px）に見出しが隠れないよう、少し上に余白を取って止める */
html:has(body.public) {
  scroll-behavior: smooth;
}

.public section[id] {
  scroll-margin-top: 64px;
}

.public-hero {
  color: #fff;
  background: radial-gradient(circle at 80% 20%, #343a40 0%, #212529 55%, #16181b 100%);
}

.public-hero-visual {
  padding: 1.5rem;
  border-radius: 1.5rem;
  background-color: rgba(255, 255, 255, 0.95);
  box-shadow: 0 1rem 2.5rem rgba(0, 0, 0, 0.35);
}

.public-feature {
  padding: 1.5rem;
  border: 1px solid var(--bs-border-color);
  border-radius: 1.25rem;
  background-color: var(--bs-body-bg);
  transition: box-shadow 0.15s, transform 0.15s;
}

.public-feature:hover {
  transform: translateY(-2px);
  box-shadow: 0 0.5rem 1.25rem rgba(0, 0, 0, 0.08);
}

.public-feature-icon {
  width: 3rem;
  height: 3rem;
  border-radius: 0.9rem;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.25rem;
}

.public-step {
  padding: 1.5rem;
  border-radius: 1.25rem;
  background-color: var(--bs-body-bg);
  box-shadow: 0 0.25rem 0.75rem rgba(0, 0, 0, 0.05);
}

.public-step-number {
  width: 2.25rem;
  height: 2.25rem;
  margin-bottom: 0.75rem;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  color: #212529;
  background-color: #ffc107;
}

.public-cta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 1.5rem;
  padding: 2rem;
  border-radius: 1.5rem;
  color: #fff;
  background: linear-gradient(135deg, #212529 0%, #343a40 100%);
}

/* 料金プラン */
.public-plan {
  position: relative;
  display: flex;
  flex-direction: column;
  padding: 2rem 1.5rem 1.5rem;
  border: 1px solid var(--bs-border-color);
  border-radius: 1.25rem;
  background-color: var(--bs-body-bg);
}

.public-plan-recommended {
  border: 2px solid var(--bs-primary);
  box-shadow: 0 0.75rem 2rem rgba(13, 110, 253, 0.15);
}

.public-plan-badge {
  position: absolute;
  top: -0.8rem;
  left: 50%;
  transform: translateX(-50%);
  padding: 0.15rem 0.9rem;
  font-size: 0.75rem;
  font-weight: 700;
  color: #fff;
  background-color: var(--bs-primary);
  border-radius: 50rem;
}

.public-footer {
  color: rgba(255, 255, 255, 0.85);
  background-color: #212529;
}

.public-footer a {
  color: rgba(255, 255, 255, 0.85);
  text-decoration: none;
}

.public-footer a:hover {
  color: #fff;
}

/* 編集画面のメニュー。画面に1つだけ置き、押されたボタンの位置に出して中身を Turbo Frame で読み込む
   （bracket_menu_controller.js）。読み込み前後で幅が変わって位置がずれないよう、最小幅を取っておく */
.bracket-shared-menu {
  min-width: 11rem;
  z-index: 1000;
}

.bracket-shared-menu > turbo-frame {
  display: block;
}

/* エントリーの「⋯」ボタン（以前は1件ごとに style と多くのクラスを書いていたものをまとめた） */
.entry-menu-button {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 0.25rem;
  font-size: 0.75rem;
  color: var(--bs-secondary-color);
  background: transparent;
  border: 0;
  border-left: 1px solid var(--bs-border-color);
}

.entry-menu-button:hover,
.entry-menu-button[aria-expanded="true"] {
  color: var(--bs-body-color);
  background-color: var(--bs-tertiary-bg);
}

/* ダッシュボードのコート（コート一覧と同じ行）。PCでは2列に並べ、列の間に区切り線を引く。スマホでは1列 */
@media (min-width: 992px) {
  .dashboard-courts-list {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .dashboard-courts-list > .list-group-item:nth-child(odd) {
    border-right: var(--bs-list-group-border-width) solid var(--bs-list-group-border-color);
  }

  /* 最後の行の下線は消す（一覧の最後には、空のときだけ出す行 .list-empty があるので、コートの最後は後ろから2番目）。
     コートが偶数なら、最後の行の左（後ろから3番目・奇数番目）も消す */
  .dashboard-courts-list > .list-group-item:nth-last-child(2),
  .dashboard-courts-list > .list-group-item:nth-last-child(3):nth-child(odd) {
    border-bottom-width: 0;
  }
}

/* 大会ページの公開URLのQRコード（管理画面） */
.public-page-qr {
  max-width: 180px;
}

.public-page-qr svg {
  width: 100%;
  height: auto;
}

/* 大会ページの説明（入力したとおりの段落）。最後の段落の下は詰める */
.public-project-description p:last-child {
  margin-bottom: 0;
}

/*
 * サイドバー（shared/_sidebar）。SB Admin の暗いサイドバーのまま、メニューを角丸の行にして、
 * 今いる画面（.active）は少し明るい背景で示す
 */
.app-sidenav.sb-sidenav-dark .sb-sidenav-menu .nav-link {
  margin: 0.125rem 0.5rem;
  padding: 0.6rem 0.75rem;
  border-radius: 0.5rem;
}

.app-sidenav.sb-sidenav-dark .sb-sidenav-menu .nav-link:hover,
.app-sidenav.sb-sidenav-dark .sb-sidenav-menu .nav-link.active {
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
}

/*
 * 開いているプロジェクト（大会名）。サイドバーの黒になじむ少し明るいグレーの枠にして、
 * 左端の線と「大会」の文字だけを金色（トロフィーのアイコンと同じ）にして目立たせる
 */
.app-sidenav.sb-sidenav-dark .sb-sidenav-menu .sidebar-project {
  gap: 0.5rem;
  margin: 0.75rem 0.5rem 0.25rem;
  padding: 0.75rem 0.875rem;
  border-radius: 0.5rem;
  background: #2f353b;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-left: 3px solid #ffc107;
  color: #fff;
}

.app-sidenav.sb-sidenav-dark .sb-sidenav-menu .sidebar-project:hover,
.app-sidenav.sb-sidenav-dark .sb-sidenav-menu .sidebar-project.active {
  background: #383f46;
  color: #fff;
}

.app-sidenav .sidebar-project-label {
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  color: #ffc107;
}

.app-sidenav .sidebar-project-name {
  font-size: 1.05rem;
  font-weight: 700;
  line-height: 1.3;
}

.app-sidenav .sidebar-project-arrow {
  color: rgba(255, 255, 255, 0.45);
}

.app-sidenav.sb-sidenav-dark .sb-sidenav-footer {
  background: transparent;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.app-sidenav .sidebar-footer-link {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.875rem;
  color: rgba(255, 255, 255, 0.5);
  text-decoration: none;
}

.app-sidenav .sidebar-footer-link:hover {
  color: #fff;
}

/* 編集画面で、追加・削除などを送っている間の「更新中…」（editor_busy_controller.js）。画面の上の中央に固定する */
.editor-busy-indicator {
  position: fixed;
  top: 4.5rem;
  left: 50%;
  transform: translateX(-50%);
  z-index: 1070;
  display: flex;
  align-items: center;
  padding: 0.5rem 1rem;
  border-radius: 2rem;
  background: #212529;
  color: #fff;
  font-size: 0.875rem;
}

.editor-busy-indicator[hidden] {
  display: none;
}

/* 送っている間はブラケットを薄くして、続けて押せないようにする */
.editing-frame.is-busy {
  opacity: 0.5;
  pointer-events: none;
  transition: opacity 0.15s ease;
}

/* ===== ダッシュボードの試合の進行状況（dashboards/_summary） ===== */
/* 右のイベントの欄（4件とページ送り）の高さに収まる大きさにする（カードの高さを変えない） */
.dashboard-donut {
  position: relative;
  width: 11rem;
  height: 11rem;
}

.dashboard-donut svg {
  width: 100%;
  height: 100%;
}

.dashboard-donut circle {
  fill: none;
  stroke-width: 3.6;
}

.dashboard-donut-track {
  stroke: var(--bs-secondary-bg);
}

/* 終了と試合中の弧は、端の形をそろえる（角のまま）。丸くすると、割合が小さいときに実際より大きく見える */
.dashboard-donut-finished {
  stroke: var(--bs-primary);
}

.dashboard-donut-playing {
  stroke: var(--bs-danger);
}

.dashboard-donut-label {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  line-height: 1.1;
}

.dashboard-donut-percent {
  font-size: 2.75rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.dashboard-donut-percent small {
  font-size: 0.55em;
  font-weight: 600;
  margin-left: 0.05em;
}

.dashboard-counts {
  display: grid;
  gap: 0.5rem;
  min-width: 0;
  max-width: 12rem;
  font-size: 1rem;
}

.dashboard-counts > div {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.dashboard-counts dt {
  white-space: nowrap;
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-weight: 400;
  color: var(--bs-secondary-color);
}

.dashboard-counts dd {
  margin: 0;
  font-weight: 700;
}

.dashboard-counts .dashboard-counts-total {
  margin-top: 0.15rem;
  padding-top: 0.4rem;
  border-top: 1px solid var(--bs-border-color);
}

.dashboard-dot {
  width: 0.7rem;
  height: 0.7rem;
  border-radius: 50%;
}

/*
 * イベントの欄は、イベントの数によらず高さを一定にする。
 * 1件の行の高さを固定し（名前が長くても折り返さない）、欄は1ページ分（Projects::Dashboard::EVENTS_PER_PAGE = 4件）の高さ、
 * その下のページ送りの行も、ページ送りがないときも含めていつも確保する
 */
.dashboard-events {
  display: grid;
  grid-auto-rows: 2.4rem;
  align-content: start;
  gap: 0.9rem;
  height: calc(2.4rem * 4 + 0.9rem * 3);
  overflow: hidden;
}

.dashboard-event {
  min-width: 0;
}

.dashboard-events-pager {
  height: 1.9rem;
  margin-top: 1rem;
}

.dashboard-event-progress {
  height: 0.45rem;
}

/* ===== 入力可能な試合の条件（projects/startable_settings/edit） ===== */
/* このモーダルだけ少し広くして、PCでは1行に収める */
.modal-dialog:has(.startable-settings) {
  max-width: 640px;
}

.startable-condition-help li {
  display: flex;
  align-items: baseline;
  gap: 0.5rem;
  margin-bottom: 0.25rem;
}

.startable-condition-name {
  flex-shrink: 0;
  padding: 0.05rem 0.5rem;
  border-radius: 1rem;
  background: var(--bs-primary-bg-subtle);
  color: var(--bs-primary-text-emphasis);
  font-weight: 600;
  white-space: nowrap;
}

/* 1行：つまみ｜イベント名（準備中の印）｜条件のボタン */
.startable-setting-row {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  column-gap: 0.75rem;
  row-gap: 0.5rem;
}

.startable-setting-name {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  min-width: 0;
}

/* 狭い画面では、条件のボタンを名前の下に全幅で、同じ幅で並べる */
@media (max-width: 575.98px) {
  .startable-setting-conditions {
    grid-column: 1 / -1;
  }

  .startable-setting-conditions > .btn {
    flex: 1 1 0;
  }
}

/* 並べ替えのつまみ */
.drag-handle {
  cursor: grab;
}
