:root {
  --primary: #0288d1;
  --primary-light: #e1f5fe;
  --primary-pale: #b3e5fc;
  --gray: #9e9e9e;
  --gray-light: #eeeeee;
  --red: #c62828;
  --border: #cfd8cf;
  --text: #0d2735;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  font-family: "Hiragino Sans", "Noto Sans JP", system-ui, sans-serif;
  color: var(--text);
  background: #f6f8f6;
}

header.appbar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  background: var(--primary);
  color: #fff;
  position: sticky;
  top: 0;
  z-index: 20;
  flex-wrap: wrap;
}

header.appbar h1 {
  font-size: 16px;
  margin: 0;
  flex: 1;
  min-width: 120px;
}

header.appbar select,
header.appbar button,
header.appbar a.ghost {
  font-size: 14px;
  padding: 6px 10px;
  border-radius: 6px;
  border: none;
  text-decoration: none;
}

header.appbar button {
  background: #fff;
  color: var(--primary);
  font-weight: bold;
  cursor: pointer;
}

header.appbar button.ghost,
header.appbar a.ghost {
  background: rgba(255, 255, 255, 0.18);
  color: #fff;
  font-weight: normal;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  transition: background-color 0.2s ease, opacity 0.2s ease;
}

/* 上の display:inline-flex が [hidden] の display:none に勝ってしまうため打ち消す */
header.appbar button.ghost[hidden],
header.appbar a.ghost[hidden] {
  display: none;
}

header.appbar button.ghost:hover,
header.appbar a.ghost:hover {
  background: rgba(255, 255, 255, 0.3);
}

/* 通知ボタン: 色・アイコン・文言の3つで状態を見分けられるようにする */
header.appbar button#notifBtn {
  gap: 5px;
}

header.appbar button#notifBtn.notif-on,
header.appbar button#notifBtn.notif-on:hover {
  background: #fff;
  color: var(--primary);
  font-weight: bold;
}

header.appbar button#notifBtn.notif-blocked,
header.appbar button#notifBtn.notif-blocked:hover {
  background: #faeeda;
  color: #633806;
  font-weight: bold;
}

/* 言語トグル: JA [スイッチ] EN。どちらの言語でも「オン」に見えないよう、スイッチの色は変えない
   (header.appbar button の共通スタイルより優先させるため詳細度を上げている) */
.lang-toggle {
  display: inline-flex;
  align-items: center;
}

header.appbar .lang-toggle button {
  padding: 6px 4px; /* 見た目は小さく、押せる範囲は確保する */
  background: transparent;
  color: rgba(255, 255, 255, 0.7);
  font-weight: normal;
  font-size: 13px;
}

header.appbar .lang-toggle button.active {
  color: #fff;
  font-weight: bold;
}

header.appbar .lang-toggle #langSwitch {
  display: inline-flex;
  padding: 8px 4px;
}

#langSwitch span {
  position: relative;
  display: block;
  width: 32px;
  height: 18px;
  border-radius: 9px;
  background: rgba(255, 255, 255, 0.4);
}

#langSwitch span::after {
  content: "";
  position: absolute;
  top: 2px;
  left: 2px;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: #fff;
  transition: transform 0.15s ease;
}

#langSwitch[aria-checked="true"] span::after {
  transform: translateX(14px);
}

.banner {
  padding: 8px 12px;
  font-size: 13px;
  background: #fff3cd;
  border-bottom: 1px solid #e6d9a8;
}

.banner.preview {
  background: #ffe0e0;
  border-color: #e8b3b3;
}

#notice {
  background: #fff;
  margin: 10px;
  padding: 10px 14px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 14px;
  overflow-wrap: break-word;
}

#notice:empty {
  display: none;
}

#notice img {
  max-width: 100%;
  height: auto;
}

.legend {
  font-size: 11px;
  color: #555;
  margin: 0 12px 6px;
}

#gridWrap {
  margin: 0 10px 20px;
  overflow-x: auto;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 8px;
}

.capture-mode #gridWrap {
  overflow: visible;
}

/* ===== 会場切替タブ =====
   予約画面(会場の切替)と管理画面(会場ごとの設定)の両方が使う。styles.css は
   index.html と admin.html の共通なので、ここ1か所だけで両画面の見た目が揃う。
   アクティブなタブだけがグラデーションと光彩で浮き上がり、.tab-panel の上枠に
   乗って見える。非アクティブは背景も枠も持たない文字だけにする。 */
.bubble-tabs {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  /* overflow-x:auto は padding ボックスで縦方向もクリップする。アクティブタブの
     box-shadow が上へ伸びるぶんの余地を padding で確保しないと光彩の上側が切れる */
  padding-top: 8px;
  /* タブの下端をパネルの上枠(2px)に重ね、枠を跨いで乗っているように見せる */
  margin-bottom: -2px;
  /* パネルは DOM 上で後ろの兄弟なので、指定しないとタブがパネルの下に隠れる */
  position: relative;
  z-index: 1;
  /* スクロールバーはタブの直下に描かれて境目を横切るので隠す(スワイプは効く) */
  scrollbar-width: none;
}

.bubble-tabs::-webkit-scrollbar {
  display: none;
}

.bubble-tabs button {
  flex: 0 0 auto;
  font-size: 13px;
  font-weight: normal;
  padding: 10px 20px;
  border: none;
  border-radius: 12px 12px 0 0;
  background: transparent;
  color: #61757f;
  cursor: pointer;
  white-space: nowrap;
}

.bubble-tabs button.active {
  font-weight: bold;
  color: #fff;
  background: linear-gradient(135deg, #03a9f4 0%, #0277bd 100%);
  box-shadow: 0 -2px 12px rgba(2, 136, 209, 0.3);
}

/* 追加用のタブ。非アクティブが枠無しになったので、破線で会場のタブと区別する */
.bubble-tabs .grp-tab-add {
  color: var(--primary);
  border: 1px dashed var(--primary-pale);
  border-bottom: none;
}

/* アクティブタブが上枠に乗る本体 */
.tab-panel {
  background: #fff;
  border: 2px solid var(--primary);
  border-radius: 12px;
}

/* 予約画面のタブ位置。#gridWrap の外に置くので表ヘッダの sticky とは干渉しない。
   下端の -2px は .bubble-tabs と同じ値 ─ ここで 0 に戻すとタブが表から浮いて離れる */
.group-tabs {
  margin: 0 10px -2px;
}

/* タブが出ている日だけ表をパネル化する。1グループの日は従来の見た目のまま */
#groupTabs:not([hidden]) + #gridWrap {
  border: 2px solid var(--primary);
  border-radius: 12px;
}

.capture-mode ::-webkit-scrollbar {
  display: none;
}

table.grid {
  border-collapse: collapse;
  width: 100%;
  table-layout: fixed;
}

table.grid th,
table.grid td {
  border: 1px solid var(--border);
  font-size: 11px;
  vertical-align: top;
}

table.grid th {
  background: var(--primary-light);
  padding: 6px 1px;
  position: sticky;
  top: 0;
  overflow-wrap: anywhere; /* 列より長いコート名も、切らずに折り返して全部見せる */
}

table.grid th.timecol,
table.grid td.timecol {
  width: 58px;
  min-width: 58px;
  text-align: center;
  background: var(--primary-light);
  font-weight: bold;
  padding: 4px 2px;
  white-space: nowrap;
  vertical-align: middle;
  position: sticky;
  left: 0;
  z-index: 10;
}

table.grid th.timecol {
  z-index: 15;
}

/* 開始時刻・終了時刻を2行で表示(はみ出し防止) */
table.grid td.timecol span {
  display: block;
  line-height: 1.35;
}

table.grid td.timecol .t2 {
  font-weight: normal;
  font-size: 10px;
  color: #4a6b4e;
}

table.grid td.slot {
  min-width: 92px;
  height: 44px;
  padding: 2px 3px;
  cursor: pointer;
  background: #fff;
}

table.grid td.slot.full {
  background: var(--primary-pale);
}

table.grid td.slot.blackout {
  background: #fbe9e7;
  cursor: not-allowed;
  text-align: center;
}

/* 時刻を過ぎた枠は薄いグレー。満枠(青)より後に定義し、過去枠のグレーを優先させる */
table.grid td.slot.pastslot {
  background: var(--gray-light);
  color: #888;
}

.slot .names {
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.slot .names span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  line-height: 1.25;
}

.slot .count {
  float: right;
  font-size: 10px;
  color: var(--primary);
  font-weight: bold;
}

.badge {
  display: inline-block;
  font-size: 10px;
  padding: 1px 6px;
  border-radius: 8px;
  color: #fff;
}

.badge.red {
  background: var(--red);
}

.badge.blue {
  background: #1565c0;
}

@media (min-width: 900px) {

  /* PC: 全体が1画面に収まるよう縮小気味に表示 (FR-U01-4) */
  table.grid td.slot {
    min-width: 0;
  }

  table.grid {
    font-size: 11px;
  }
}

/* ---- モーダル ---- */
.modal-back {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 50;
  padding: 14px;
}

.modal {
  background: #fff;
  border-radius: 12px;
  max-width: 430px;
  width: 100%;
  max-height: 88vh;
  overflow-y: auto;
  padding: 16px;
}

.modal h2 {
  font-size: 16px;
  margin: 0 0 4px;
}

.modal .sub {
  font-size: 12px;
  color: #666;
  margin-bottom: 10px;
}

.modal label {
  display: block;
  font-size: 13px;
  margin: 10px 0 4px;
  font-weight: bold;
}

.modal input[type="text"],
.modal input[type="tel"],
.modal input[type="password"],
.modal input[type="date"],
.modal input[type="time"],
.modal input[type="datetime-local"],
.modal input[type="number"],
.modal select,
.modal textarea {
  width: 100%;
  font-size: 15px;
  padding: 8px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: #fff;
}

/* 日付・時刻の欄はブラウザ既定だと小さい等幅になるので、ほかの欄と高さをそろえる */
.modal input[type="date"],
.modal input[type="time"],
.modal input[type="datetime-local"] {
  height: 42px;
  box-sizing: border-box;
}

.modal .hint {
  font-size: 11px;
  color: #888;
  margin-top: 3px;
}

.row-btns {
  display: flex;
  gap: 8px;
  margin-top: 14px;
  margin-bottom: 14px;
  flex-wrap: wrap;
}

.row-btns button {
  font-size: 13px;
  padding: 8px 16px;
  border-radius: 6px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

/* 上の display:inline-flex が [hidden] の display:none に勝ってしまうため打ち消す */
.row-btns button[hidden] {
  display: none;
}

.modal .row-btns button {
  flex: 1;
  font-size: 14px;
  padding: 10px;
  border-radius: 8px;
  border: none;
}

/* ---- 管理画面のダイアログ ----
   選手画面のダイアログと CSS を共有しているため、変更は .admin-modal に限る(選手画面の見た目は変えない) */
.modal.admin-modal {
  padding: 20px 22px;
}

.admin-modal input,
.admin-modal select {
  font-family: inherit;
}

.admin-modal input:not([type="checkbox"]),
.admin-modal select {
  height: 42px;
  box-sizing: border-box;
}

.admin-modal h2 {
  font-size: 17px;
  margin-bottom: 14px;
}

.admin-modal label {
  margin-top: 14px;
}

.admin-modal h2 + label {
  margin-top: 0;
}

/* チェックボックス付きの見出しは太字のブロックにせず、箱と文字を横に並べる */
.admin-modal label:has(> input[type="checkbox"]) {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: normal;
  font-size: 14px;
}

.admin-modal label > input[type="checkbox"] {
  width: 18px;
  height: 18px;
  margin: 0;
}

.admin-modal .hint,
.admin-modal .small {
  font-size: 12px;
  color: #666;
  margin-top: 6px;
  line-height: 1.5;
}

/* エラー表示の欄は空のときに余白を作らない */
.admin-modal .msg-error:empty {
  display: none;
}

.admin-modal .row-btns {
  margin: 20px 0 0;
  gap: 10px;
}

/* .modal .row-btns button の border:none で枠が消え、文字だけに見えていたのを戻す */
.admin-modal .row-btns button.neutral {
  border: 1.5px solid var(--gray);
}

.admin-modal .row-btns button.primary {
  border: 1.5px solid var(--primary);
  background: var(--primary);
  color: #fff;
}

.admin-modal .row-btns button.primary:hover {
  filter: brightness(0.92);
}

/* ---- チュートリアル(初回のみ自動表示) ---- */
/* 図はスクリーンショットではなく実物のHTML。高さを固定しないので見切れない。
   飾りなので操作させない(中の要素も含めてクリック・フォーカス対象にしない) */
.tut-fig {
  border: 1px solid var(--border, #dcdcdc);
  border-radius: 8px;
  background: #f7f9fa;
  padding: 10px;
  margin: 10px 0;
  overflow-x: auto;
  pointer-events: none;
  user-select: none;
}

/* 予約表と同じ td.slot / .full / .blackout を使うので、色は本体の定義が効く。
   モーダル幅に収めるため、最小幅と文字サイズだけ縮める */
.tut-fig .tut-grid {
  width: 100%;
  font-size: 11px;
}

.tut-fig .tut-grid td.slot {
  min-width: 0;
  height: auto;
  padding: 4px 5px;
  cursor: default;
}

.tut-fig .tut-grid th,
.tut-fig .tut-grid td.timecol {
  width: auto;
  min-width: 0;
  font-size: 10px;
  padding: 4px 3px;
}

/* モーダル風の図(2・3枚目) */
.tut-card {
  background: #fff;
  border: 1px solid var(--border, #dcdcdc);
  border-radius: 8px;
  padding: 10px 11px;
  text-align: left;
}

.tut-card-h {
  font-size: 13px;
  font-weight: bold;
  margin-bottom: 8px;
}

.tut-card-h small {
  font-weight: normal;
  font-size: 11px;
  color: #777;
  margin-left: 4px;
}

.tut-card-lb {
  font-size: 11px;
  color: #666;
  margin-bottom: 2px;
}

.tut-card-in {
  border: 1px solid var(--border, #dcdcdc);
  border-radius: 6px;
  padding: 6px 8px;
  font-size: 12px;
  margin-bottom: 8px;
  background: #fff;
}

.tut-card-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 5px 0;
  border-top: 1px solid #eee;
}

.tut-card-nm {
  flex: 1;
  font-size: 12px;
}

.tut-card-btns {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 10px;
}

.tut-btn {
  display: inline-block;
  font-size: 11px;
  padding: 5px 11px;
  border-radius: 6px;
  border: 1px solid var(--primary, #0288d1);
  color: var(--primary, #0288d1);
  background: #fff;
  white-space: nowrap;
}

.tut-btn.on {
  background: var(--primary, #0288d1);
  color: #fff;
}

.tut-btn.danger {
  border-color: var(--red, #e53935);
  color: var(--red, #e53935);
}

/* 実画面の「名前を変更」はグレー枠(.pair-member-row button[data-act=edit])。
   図はボタン要素を使わないので、同じ見た目をこちらで再現する */
.tut-btn.plain {
  margin-left: auto;
  font-size: 11px;
  padding: 3px 8px;
  border: 1px solid var(--border, #dcdcdc);
  border-radius: 4px;
  color: var(--text, #222);
}

/* pair-card は実画面の定義をそのまま使う。図の幅に収まるよう寸法だけ詰める。
   「予約を取消」は英語だと横幅を取り、名前が省略記号で潰れてしまうため、
   図では折り返して名前に幅を譲る(ペアに対して取消が1つ、という関係は保つ) */
.tut-fig .pair-card {
  padding: 8px 9px;
  margin-bottom: 0;
  flex-wrap: wrap;
}

.tut-fig .pair-members {
  gap: 6px;
  min-width: 0;
  flex-basis: 100%;
}

.tut-fig .pair-member-row .nm {
  font-size: 12px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.tut-fig .pair-actions {
  margin-left: auto;
  margin-top: 8px;
}

.tut-fig .btn-delete-pair {
  font-size: 11px;
  padding: 5px 9px;
  white-space: nowrap;
}

.tut-fig .kw-tags-wrap {
  margin: 0 0 8px;
}

.tut-fig .kw-tag {
  font-size: 11px;
  padding: 3px 9px;
}

.tut-body {
  font-size: 13px;
  line-height: 1.7;
  margin: 10px 0 0;
  text-align: left;
}

/* 空のときに余白だけ残らないよう :empty で畳む */
.tut-note {
  font-size: 12px;
  line-height: 1.6;
  color: #666;
  background: #f1f8fb;
  border-radius: 6px;
  padding: 8px 10px;
  margin: 10px 0 0;
  text-align: left;
}

.tut-note:empty {
  display: none;
}

.tut-dots {
  display: flex;
  justify-content: center;
  gap: 6px;
  margin: 14px 0 2px;
}

.tut-dots span {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #cfd8dc;
}

.tut-dots span.on {
  background: var(--primary, #0288d1);
}

.tut-skip {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 13px;
  color: #555;
  margin-top: 12px;
  cursor: pointer;
}

.tut-skip input {
  width: 17px;
  height: 17px;
  flex: 0 0 auto;
  accent-color: var(--primary, #0288d1);
}

/* 動画とマニュアルはどちらも補助導線。主導線(戻る/次へ)より弱く、
   ただし動画のほうを先・太字にして「まず見るならこっち」を示す。
   13px では小さすぎて目に入らないという指摘があり 17px(130%)へ。
   上下の padding も広げて、指で押しやすい高さを確保する */
.modal .tut-video {
  display: block;
  text-align: center;
  font-size: 17px;
  font-weight: bold;
  color: var(--primary, #0288d1);
  padding: 10px 0 4px;
}

/* 主導線(戻る/次へ)より弱く見せたいので、ボタン行の下に文字リンクとして置く */
.modal .tut-manual {
  display: block;
  text-align: center;
  font-size: 17px;
  color: var(--primary, #0288d1);
  padding: 4px 0 8px;
}

button.primary {
  background: transparent;
  color: var(--primary);
  border: 1.5px solid var(--primary);
  border-radius: 8px;
  font-weight: bold;
  transition: background-color 0.2s ease, color 0.2s ease, transform 0.1s ease;
}

button.primary:hover {
  background: var(--primary);
  color: #fff;
}

button.primary:active {
  transform: scale(0.98);
}

button.danger {
  background: transparent;
  color: var(--red);
  border: 1.5px solid var(--red);
  border-radius: 8px;
  font-weight: bold;
  transition: background-color 0.2s ease, color 0.2s ease, transform 0.1s ease;
}

button.danger:hover {
  background: var(--red);
  color: #fff;
}

button.danger:active {
  transform: scale(0.98);
}

button.neutral {
  background: transparent;
  color: #555;
  border: 1.5px solid var(--gray);
  border-radius: 8px;
  font-weight: bold;
  transition: background-color 0.2s ease, color 0.2s ease, transform 0.1s ease;
}

button.neutral:hover {
  background: var(--gray-light);
}

button.neutral:active {
  transform: scale(0.98);
}

button.warn {
  background: #ef6c00;
  color: #fff;
  font-weight: bold;
}

.entry-list {
  margin: 8px 0;
}

.entry-row {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 7px 8px;
  border: 1px solid var(--border);
  border-radius: 8px;
  margin-bottom: 6px;
  font-size: 14px;
}

.entry-row .nm {
  flex: 1;
  overflow-wrap: anywhere;
}

.entry-row .st {
  font-size: 10px;
  padding: 2px 6px;
  border-radius: 8px;
}

.entry-row .st.c {
  background: var(--primary-light);
  color: var(--primary);
  font-weight: bold;
}

.entry-row .st.u {
  background: #fff8e1;
  color: #9a6c00;
}

.entry-row button {
  font-size: 12px;
  padding: 5px 8px;
  border: 1px solid var(--border);
  background: #fff;
  border-radius: 6px;
  cursor: pointer;
}

.msg-error {
  color: var(--red);
  font-size: 13px;
  margin-top: 8px;
  min-height: 1em;
}

.toast {
  position: fixed;
  bottom: 22px;
  left: 50%;
  transform: translateX(-50%);
  background: #323232;
  color: #fff;
  font-size: 13px;
  padding: 10px 18px;
  border-radius: 22px;
  z-index: 99;
  max-width: 92vw;
}

.center-screen {
  text-align: center;
  padding: 60px 20px;
  color: #555;
}

.center-screen h2 {
  color: var(--primary);
}

/* ---- 管理画面 ---- */
.admin-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 10px;
  background: #fff;
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 48px;
  z-index: 15;
}

.admin-nav button {
  font-size: 12px;
  padding: 7px 10px;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: #fff;
  cursor: pointer;
}

.admin-nav button.active {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
}

/* 子設定(親チェックボックスの下にぶら下がる設定)を視覚的にインデント */
.child-setting {
  margin: 6px 0 10px 26px;
  padding: 8px 12px;
  border-left: 3px solid var(--primary);
  background: #f5faff;
  border-radius: 0 6px 6px 0;
}

/* ヘッダーのお知らせボタン等に付ける未読バッジ(赤丸に数字) */
#inboxBtn {
  position: relative;
  overflow: visible;
}

.btn-badge {
  position: absolute;
  top: -6px;
  right: -6px;
  min-width: 16px;
  height: 16px;
  padding: 0 4px;
  box-sizing: border-box;
  font-size: 10px;
  line-height: 16px;
  font-weight: bold;
  text-align: center;
  color: #fff;
  background: #e53935;
  border-radius: 8px;
}

.admin-nav button .nav-badge {
  display: inline-block;
  min-width: 16px;
  padding: 0 4px;
  margin-left: 5px;
  font-size: 11px;
  line-height: 16px;
  text-align: center;
  color: #fff;
  background: #e53935;
  border-radius: 9px;
}

/* 未保存が残っているタブの印(不正報告の赤い件数バッジとは別色にする) */
.admin-nav button .nav-badge-dirty {
  background: #f9a825;
  color: #222;
  font-weight: bold;
}

.admin-nav button.active .nav-badge-dirty {
  background: #ffd54f;
}

.admin-section {
  background: #fff;
  margin: 10px;
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: 8px;
}

.admin-section h2 {
  font-size: 15px;
  margin: 0 0 10px;
  color: var(--primary);
}

.admin-section label {
  display: block;
  font-size: 13px;
  font-weight: bold;
  margin: 10px 0 4px;
}

.admin-section input:not([type="checkbox"]),
.admin-section select,
.admin-section textarea {
  font-size: 14px;
  padding: 7px;
  border: 1px solid var(--border);
  border-radius: 6px;
  max-width: 100%;
}

/* 入力欄の字体と高さをそろえる。既定だと文字欄は Arial、日付・時刻の欄は等幅になり、高さも欄ごとに違う */
.admin-section input:not([type="checkbox"]):not([type="radio"]):not([type="file"]),
.admin-section select {
  font-family: inherit;
  height: 38px;
  box-sizing: border-box;
  background: #fff;
}

.admin-section textarea {
  font-family: inherit;
}

.admin-section table {
  border-collapse: collapse;
  width: 100%;
  font-size: 12px;
  margin: 14px 0;
}

.admin-section table th,
.admin-section table td {
  border: 1px solid var(--border);
  padding: 5px 7px;
  text-align: left;
}

.admin-section table th {
  background: var(--primary-light);
}

.seg-row,
.inline-row {
  display: flex;
  gap: 6px;
  align-items: center;
  flex-wrap: wrap;
  margin-bottom: 6px;
}

.seg-row span,
.inline-row span {
  font-size: 13px;
}

/* グループ追加の導線。コート名の入力欄より前に置いて、入力を始める前に
   「この日はグループに分けられる」と気づけるようにしている。
   ただしグループが1つの日(大多数)では .single が付き、リンク風の控えめな
   一行にとどめて従来の画面の見え方を保つ ─ 下の .grp-card.single と同じ考え方 */
#groupBar {
  margin-bottom: 12px;
}

#groupBar #addGroupBtn {
  cursor: pointer;
  font-size: 12px;
  padding: 6px 12px;
}

#groupBar.single #addGroupBtn {
  background: none;
  border: none;
  padding: 0;
  color: var(--primary);
  text-decoration: underline;
}

#groupBar.single .hint-full,
#groupBar:not(.single) .hint-short {
  display: none;
}

/* コートグループ(会場・コート種別)のカード。
   グループが1つのときは .single が付き、枠も見出しも消えて従来の画面と同じ見え方になる。
   複数あるときは #grpTabs のタブで切り替え、常に .active の1枚だけを表示する。 */
.grp-card {
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px 14px;
  margin: 10px 0;
  background: #fafcfe;
}

/* 時間帯が1つもないグループは選手画面に出ないので、その場で分かるようにする */
.segEmptyNote {
  display: none;
  margin: 4px 0 8px;
  color: #b45309;
  font-size: 13px;
  font-weight: 700;
}
.segRows:not(:has(.seg-row)) + .segEmptyNote {
  display: block;
}

/* 非表示は display のみで行い、カードは DOM に残す。#groupCards .grp-card を全件
   読んで保存する getFormDayData() から外れると、開いていない会場の設定が消える */
.grp-card:not(.active) {
  display: none;
}

.grp-card.single {
  border: none;
  padding: 0;
  margin: 0;
  background: transparent;
}

.grp-card.single .grp-head {
  display: none;
}

/* タブ表示中は枠と背景をパネル側に任せる(二重枠にしない) */
#groupCards.tab-panel {
  margin-bottom: 14px;
}

#groupCards.tab-panel .grp-card {
  border: none;
  border-radius: 0;
  background: transparent;
  margin: 0;
  padding: 14px 16px;
}

.grp-head {
  display: flex;
  gap: 8px;
  align-items: center;
  margin-bottom: 8px;
}

.admin-section .grp-head .grpName {
  flex: 1;
  min-width: 0;
  font-weight: bold;
}

/* 時間帯ごとの「例外キーワード可」チェック。行内に収めるため .admin-section label の block/bold を打ち消す */
.admin-section .seg-row .segKwLabel {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin: 0 0 0 4px;
  font-weight: normal;
  white-space: nowrap;
}

.wysiwyg-bar {
  display: flex;
  gap: 6px;
  align-items: center;
  flex-wrap: wrap;
  margin-bottom: -1px;
  background: #f1f3f4;
  padding: 8px;
  border: 1px solid var(--border);
  border-top-left-radius: 6px;
  border-top-right-radius: 6px;
}

.wysiwyg-bar button,
.wysiwyg-bar select {
  font-size: 12px;
  padding: 5px 10px;
  border: 1px solid var(--border);
  background: #fff;
  border-radius: 4px;
  cursor: pointer;
  color: #333;
}

.wysiwyg-bar button:hover,
.wysiwyg-bar select:hover {
  background: #f8f9fa;
  border-color: #999;
}

/* カラーパレットのコンテナ */
.color-picker-container {
  position: relative;
  display: inline-flex;
}

.wysiwyg-color-btn {
  font-size: 14px;
  font-weight: bold;
  padding: 3px 8px;
  border: 1px solid var(--border);
  background: #fff;
  border-radius: 4px;
  cursor: pointer;
  height: 26px;
  min-width: 36px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
}

.wysiwyg-color-btn:hover {
  background: #f8f9fa;
  border-color: #999;
}

.wysiwyg-color-btn span {
  border-bottom: 3px solid #c62828;
  /* 初期値の文字色指示カラー */
  line-height: 1;
}

.color-palette-dropdown {
  position: absolute;
  top: 100%;
  left: 0;
  z-index: 100;
  background: #fff;
  border: 1px solid #ccc;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  padding: 8px;
  border-radius: 6px;
  display: grid;
  grid-template-columns: repeat(12, 18px);
  gap: 4px;
  margin-top: 4px;
}

.color-palette-dropdown[hidden] {
  display: none;
}

.color-chip {
  width: 18px;
  height: 18px;
  border-radius: 3px;
  border: 1px solid rgba(0, 0, 0, 0.15);
  cursor: pointer;
  transition: transform 0.1s ease;
}

.color-chip:hover {
  transform: scale(1.2);
  box-shadow: 0 0 3px rgba(0, 0, 0, 0.3);
}

#noticeEditor,
#noticeEditorEn {
  border: 1px solid var(--border);
  border-bottom-left-radius: 6px;
  border-bottom-right-radius: 6px;
  min-height: 130px;
  padding: 10px;
  font-size: 14px;
  background: #fff;
}

#noticeEditor img,
#noticeEditorEn img {
  max-width: 100%;
}

/* 日程カード一覧: 見出し行(タイトル+追加ボタン) */
.day-list-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 8px;
}

.day-list-head .head-title {
  font-size: 13px;
  font-weight: bold;
}

/* 日程カード: スマホは横スクロール1行、広い画面は折り返し */
.day-cards {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 4px;
  margin-bottom: 14px;
}

@media (min-width: 700px) {
  .day-cards {
    flex-wrap: wrap;
    overflow-x: visible;
  }
}

.day-card {
  flex: 0 0 auto;
  min-width: 104px;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 8px 12px;
  cursor: pointer;
  background: #fff;
}

.day-card:hover {
  border-color: var(--primary);
}

.day-card.selected {
  border: 2px solid var(--primary);
  background: var(--primary-light);
  padding: 7px 11px;
}

.day-card.past {
  opacity: 0.5;
}

.day-card-date {
  font-weight: bold;
  font-size: 14px;
  white-space: nowrap;
}

.day-card.selected .day-card-date {
  color: var(--primary);
}

.day-card-badges {
  margin-top: 5px;
  white-space: nowrap;
}

.day-badge {
  display: inline-block;
  font-size: 10px;
  padding: 1px 7px;
  border-radius: 8px;
}

.day-badge.ok {
  background: #e3f4e4;
  color: #2e7d32;
}

.day-badge.warn {
  background: #fff3cd;
  color: #8a6d00;
}

.day-badge.list {
  background: var(--gray-light);
  color: #555;
  border: 1px solid var(--border);
}

.day-badge.draft {
  background: #fbe9e7;
  color: #b03a2e;
}

.small {
  font-size: 11px;
  color: #777;
}

/* PC・タブレット: 1画面に収めつつ、コートが多い日は1列57pxを下限に横スクロールする */
@media (min-width: 601px) {
  #gridWrap table.grid {
    min-width: calc(58px + var(--court-count, 0) * 57px);
  }
}

/* スマホ画面向けのコート幅調整 (1画面4コート表示) */
@media (max-width: 600px) {
  table.grid {
    width: max-content;
    min-width: 100%;
  }
  table.grid th:not(.timecol),
  table.grid td.slot {
    width: calc((100vw - 78px) / 4);
    min-width: calc((100vw - 78px) / 4);
  }
}

.kw-tags-wrap {
  margin-top: 6px;
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.kw-tag {
  background: var(--primary-light);
  color: var(--primary);
  border: 1px solid var(--primary-pale);
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: bold;
  cursor: pointer;
  transition: all 0.15s ease;
}

.kw-tag:hover,
.kw-tag:active {
  background: var(--primary-pale);
}

.suggest-container {
  position: relative;
  width: 100%;
}

.suggest-input {
  width: 100%;
  font-size: 15px;
  padding: 8px;
  border: 1px solid var(--border);
  border-radius: 6px;
}

.suggest-box {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 6px;
  max-height: 180px;
  overflow-y: auto;
  z-index: 100;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
  margin-top: 2px;
}

/* 通知を受け取る選手名の候補。高さを固定し、絞り込んでも下のボタンを動かさない */
.nn-list {
  height: 190px;
  margin-top: 6px;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  border: 1px solid var(--border);
  border-radius: 6px;
}

.nn-item {
  display: block;
  width: 100%;
  padding: 10px 12px;
  border: 0;
  border-bottom: 1px solid var(--gray-light);
  font: inherit;
  font-size: 14px;
  text-align: left;
  color: var(--text);
  background: #fff;
  cursor: pointer;
}

.nn-item.on {
  font-weight: 700;
  background: var(--primary-pale);
}

.nn-none {
  padding: 10px 12px;
  font-size: 14px;
  color: #777;
}

.suggest-item {
  padding: 8px 12px;
  cursor: pointer;
  font-size: 14px;
  border-bottom: 1px solid #f0f0f0;
  text-align: left;
  transition: background-color 0.15s ease;
}

.suggest-item:last-child {
  border-bottom: none;
}

.suggest-item:hover,
.suggest-item:active {
  background: var(--primary-light);
  color: var(--primary);
  font-weight: bold;
}

.pair-card {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 12px;
  margin-bottom: 8px;
  background: #fafafa;
}

.pair-members {
  flex-grow: 1;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.pair-member-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.pair-member-row button[data-act="edit"] {
  margin-left: auto;
  font-size: 12px;
  padding: 3px 8px;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 4px;
  cursor: pointer;
}

.pair-member-row button[data-act="edit"]:hover {
  background: #f0f0f0;
}

.pair-actions {
  margin-left: 16px;
}

.btn-delete-pair {
  padding: 6px 12px;
  background: #fff;
  border: 1px solid #d32f2f;
  color: #d32f2f;
  border-radius: 6px;
  font-weight: bold;
  cursor: pointer;
  font-size: 13px;
  transition: all 0.15s ease;
}

.btn-delete-pair:hover,
.btn-delete-pair:active {
  background: #d32f2f;
  color: #fff;
}

/* ---- 多言語入力(JA/EN ペア + 訳ボタン) ---- */
.lfield {
  margin: 10px 0;
}

.lfield > .lfield-label {
  font-size: 13px;
  font-weight: bold;
  margin-bottom: 4px;
}

.lfield .lang-pair {
  display: grid;
  gap: 6px;
}

.lfield .lang-row {
  display: grid;
  grid-template-columns: 34px 1fr;
  gap: 6px;
  align-items: start;
}

/* EN行: 右端に JA→EN 自動翻訳ボタンを置く3カラム構成 */
.lfield .lang-row.has-translate {
  grid-template-columns: 34px 1fr auto;
}

.lfield .lang-row input,
.lfield .lang-row textarea {
  width: 100%;
  box-sizing: border-box;
}

.translate-btn {
  font-size: 12px;
  padding: 5px 8px;
  margin-top: 4px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: #fff;
  color: var(--primary);
  cursor: pointer;
  white-space: nowrap;
}

.translate-btn:hover {
  background: var(--primary-light);
}

.translate-btn:disabled {
  color: var(--gray);
  cursor: default;
}

.lang-tag {
  display: inline-block;
  font-size: 11px;
  font-weight: bold;
  color: #fff;
  background: #8fa3c0;
  border-radius: 4px;
  text-align: center;
  padding: 3px 6px;
}

.lfield .lang-tag {
  margin-top: 7px;
  padding: 3px 0;
}

.lang-tag.ja {
  background: #b0713f;
}

.lang-tag.en {
  background: #3f72b0;
}

/* お知らせの JA/EN エディタ枠 */
.lang-editor {
  margin-top: 10px;
}

.lang-editor-head {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  font-weight: bold;
  margin-bottom: 4px;
}
/* 受付開始までのカウントダウン(準備中の画面) */
.countdown {
  font-size: 20px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

/* ---- 予約状況の紙出力(管理画面) ---- */
#reportOverlay {
  position: fixed;
  inset: 0;
  z-index: 1000;
  overflow: auto;
  background: #777;
}

#reportOverlay[hidden] {
  display: none;
}

.report-bar {
  position: sticky;
  top: 0;
  left: 0;
  z-index: 1;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  padding: 10px 16px;
  background: #fff;
  color: #222;
  box-shadow: 0 1px 4px rgba(0, 0, 0, .3);
}

.report-bar button {
  padding: 8px 14px;
  border-radius: 6px;
  cursor: pointer;
}

.report-page {
  width: 277mm;
  margin: 12px auto;
  padding: 8mm;
  box-sizing: content-box;
  background: #fff;
  color: #000;
}

.report-table {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
  font-size: 9pt;
  line-height: 1.25;
  color: #000;
}

.report-table th,
.report-table td {
  border: 0.5pt solid #444;
  padding: 1mm 1.2mm;
  vertical-align: top;
  overflow-wrap: anywhere;
  background: #fff;
  color: #000;
}

.report-table thead th {
  background: #e8e8e8;
  text-align: center;
  font-weight: bold;
}

.report-table thead .report-head th {
  border: none;
  background: #fff;
  padding: 0 0 2mm;
  font-weight: normal;
  text-align: left;
}

.report-title {
  font-size: 13pt;
}

.report-title span {
  margin-left: 2mm;
  font-size: 10pt;
}

.report-meta {
  font-size: 8pt;
}

.report-time-col {
  width: 15mm;
}

.report-table .report-time {
  text-align: center;
  font-weight: normal;
  background: #f4f4f4;
}

/* 空き枠にも手書きできる高さを残す */
.report-grid tbody td,
.report-grid tbody th {
  height: 15mm;
}

.report-booking + .report-booking {
  margin-top: 1mm;
  padding-top: 1mm;
  border-top: 0.5pt dashed #666;
}

.report-table td.report-blackout {
  background: #bdbdbd;
}

.report-bl-label {
  font-weight: bold;
}

.report-list th:nth-child(1) { width: 25%; }
.report-list th:nth-child(2) { width: 8%; }
.report-list th:nth-child(4) { width: 11%; }
.report-list th:nth-child(5) { width: 14%; }
.report-list th:nth-child(7) { width: 6%; }
.report-list .report-head th { width: auto; }

.report-check {
  text-align: center;
}

@media print {
  html,
  body.report-open {
    height: auto;
    overflow: visible;
    background: #fff;
  }

  body.report-open > *:not(#reportOverlay),
  .report-bar {
    display: none !important;
  }

  #reportOverlay {
    position: static;
    overflow: visible;
    background: #fff;
  }

  .report-page {
    width: auto;
    margin: 0;
    padding: 0;
    break-after: page;
  }

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

  /* 見出しはページをまたいで繰り返し、1枠の途中では切らない */
  .report-table thead {
    display: table-header-group;
  }

  .report-table tr {
    break-inside: avoid;
  }

  .report-table th,
  .report-table td,
  .report-table td.report-blackout {
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }
}

/* ---- Looking 予約後の案内 ---- */
.looking-rule {
  margin: 10px 0;
  padding: 10px 12px;
  border-left: 4px solid #c62828;
  border-radius: 4px;
  background: #fdecea;
  color: #222;
  font-size: 14px;
  line-height: 1.5;
}

.looking-text {
  margin: 6px 0;
  font-size: 13px;
  line-height: 1.5;
}

.looking-guide {
  margin: 12px 0 8px;
  padding-top: 10px;
  border-top: 1px solid #ddd;
  font-size: 13px;
  line-height: 1.5;
}

.looking-guide p {
  margin: 0 0 6px;
}

.looking-guide ol {
  margin: 0;
  padding-left: 20px;
}

.looking-guide li {
  margin-bottom: 3px;
}

.modal .looking-guide button,
.modal #installArea button {
  width: 100%;
  padding: 10px;
  margin-top: 4px;
  font-size: 14px;
  cursor: pointer;
}

/* 管理画面: 設定パターン */
#patternDraftBar {
  margin: 10px;
  padding: 10px 12px;
  background: #fff8e1;
  border: 1px solid #ffb300;
  border-radius: 8px;
  font-size: 14px;
}
.pattern-draft-btns,
.pattern-row-btns {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.pattern-draft-btns { margin-top: 8px; }
.pattern-draft-btns button,
.pattern-row-btns button {
  width: auto;
  margin: 0;
  padding: 6px 12px;
  cursor: pointer;
}
.pattern-dates {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 14px;
}
.pattern-date {
  font-weight: normal;
  margin: 0;
}
.pattern-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 10px 0;
  border-bottom: 1px solid #e0e0e0;
}
