/* ==========================================
   MBRT運営ツール - Firebase版 スタイル
   ========================================== */

/* ▼ 1. リセット & ベース ▼ */
* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  padding: 15px;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background-color: #f0f2f5;
  color: #333;
}

.hidden { display: none !important; }

select, input, button {
  appearance: none; -webkit-appearance: none;
  outline: none; border: none; background: none;
  font-family: inherit; margin: 0; padding: 0; width: 100%;
}

.app-container { max-width: 600px; margin: 0 auto; width: 100%; }

/* ▼ ログイン画面 ▼ */
.login-screen {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  min-height: 85vh; text-align: center; padding: 20px;
}
.login-logo { font-size: 28px; font-weight: 800; letter-spacing: 2px; color: #1b5e20; margin-bottom: 4px; }
.login-subtitle { font-size: 12px; color: #999; letter-spacing: 1px; margin-bottom: 6px; }
.login-divider {
  width: 60px; height: 3px;
  background: linear-gradient(90deg, #1b5e20, #4caf50);
  border-radius: 2px; margin: 0 auto 30px;
}
.login-card {
  width: 100%; max-width: 360px;
  background: #fff; border-radius: 16px; padding: 30px 24px;
  box-shadow: 0 4px 20px rgba(0,0,0,0.08);
}
.pin-title { font-size: 15px; font-weight: bold; color: #555; margin-bottom: 16px; }
.pin-inputs { display: flex; gap: 10px; justify-content: center; margin-bottom: 16px; }
.pin-digit {
  width: 56px !important; height: 64px;
  text-align: center; font-size: 28px; font-weight: bold;
  border: 2px solid #e0e0e0; border-radius: 12px;
  background: #fafafa; color: #333;
  transition: border 0.2s, box-shadow 0.2s;
}
.pin-digit:focus { border-color: #1a73e8; box-shadow: 0 0 0 3px rgba(26,115,232,0.15); background: #fff; }
.btn-pin-login {
  display: flex; justify-content: center; align-items: center;
  width: 100%; height: 50px;
  background: linear-gradient(135deg, #1b5e20, #388e3c);
  border-radius: 12px; font-size: 16px; font-weight: bold; color: #fff;
  cursor: pointer; box-shadow: 0 3px 12px rgba(27,94,32,0.25);
  transition: all 0.15s ease;
}
.btn-pin-login:active { transform: translateY(1px); box-shadow: 0 1px 4px rgba(27,94,32,0.2); }
.btn-pin-login:disabled { opacity: 0.5; cursor: not-allowed; }
.login-or {
  display: flex; align-items: center; gap: 12px;
  margin: 20px 0; font-size: 12px; color: #aaa;
}
.login-or::before, .login-or::after { content: ''; flex: 1; height: 1px; background: #e0e0e0; }
.btn-google {
  display: flex; justify-content: center; align-items: center; gap: 8px;
  width: 100%; height: 48px;
  background: #fff; border: 1.5px solid #ddd; border-radius: 12px;
  font-size: 14px; font-weight: 600; color: #555; cursor: pointer;
  transition: all 0.15s ease;
}
.btn-google:hover { background: #fafafa; border-color: #bbb; }
.btn-google:active { transform: translateY(1px); }
.login-error { margin-top: 12px; font-size: 13px; color: #c62828; min-height: 20px; }

/* ▼ Toast通知 ▼ */
.toast {
  visibility: hidden; min-width: 280px; max-width: 90vw;
  background: rgba(40,40,40,0.95); color: #fff; text-align: center;
  border-radius: 12px; padding: 14px 20px; position: fixed; z-index: 999;
  left: 50%; bottom: 30px; transform: translateX(-50%);
  font-size: 15px; font-weight: 500;
  box-shadow: 0 4px 20px rgba(0,0,0,0.25); backdrop-filter: blur(8px);
}
.toast.show { visibility: visible; animation: toastIn 0.4s ease-out, toastOut 0.4s ease-in 2.6s; }
.toast.error { background: rgba(198,40,40,0.95); }

@keyframes toastIn { from { bottom: 0; opacity: 0; transform: translateX(-50%) scale(0.95); } to { bottom: 30px; opacity: 1; transform: translateX(-50%) scale(1); } }
@keyframes toastOut { from { opacity: 1; } to { opacity: 0; } }

/* ▼ ヘッダー ▼ */
.header-row { display: flex; gap: 10px; align-items: center; width: 100%; margin-bottom: 20px; }
.btn-refresh {
  width: 70px; height: 70px; background: #fff; border: 1px solid #ddd; border-radius: 12px;
  font-size: 24px; display: flex; justify-content: center; align-items: center;
  cursor: pointer; box-shadow: 0 2px 8px rgba(0,0,0,0.06); flex-shrink: 0; transition: all 0.15s ease;
}
.btn-refresh:active { background: #f1f3f4; transform: translateY(1px); box-shadow: 0 1px 3px rgba(0,0,0,0.08); }

/* ▼ ユーザー情報バー ▼ */
.user-bar {
  display: flex; align-items: center; gap: 10px; padding: 10px 14px;
  background: #fff; border: 1px solid #e8e8e8; border-radius: 12px;
  box-shadow: 0 2px 6px rgba(0,0,0,0.04); margin-bottom: 12px; font-size: 13px; color: #555;
}
/* 長いメールアドレスでも右側（テーマ切替・ログアウト）を押し出さない。
   min-width:0 が無いとflexアイテムは内容幅より縮まないため、名前だけを省略表示にする。 */
.user-bar-info { flex: 1 1 auto; min-width: 0; display: flex; align-items: center; gap: 6px; }
.user-bar-info #userName { flex: 0 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.user-bar-info .realtime-dot { flex: 0 0 auto; margin-right: 0; }
.user-bar-info .user-bar-role { flex: 0 0 auto; }
.user-bar-role { font-weight: bold; font-size: 11px; padding: 2px 8px; border-radius: 6px; }
.role-admin { background: #e8f5e9; color: #1b5e20; }
.role-staff { background: #e3f2fd; color: #0d47a1; }
.btn-logout {
  width: auto !important; padding: 6px 12px; font-size: 12px;
  background: #f5f5f5; border: 1px solid #ddd; border-radius: 8px;
  color: #777; cursor: pointer; flex-shrink: 0;
}
.btn-logout:active { background: #eee; }

/* ▼ ダッシュボード ▼ */
.dashboard {
  display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 10px;
  margin-bottom: 16px;
}
.dash-item {
  background: #fff; border-radius: 12px; padding: 14px 8px; text-align: center;
  border: 1px solid #e8e8e8; box-shadow: 0 2px 6px rgba(0,0,0,0.04);
}
.dash-value { font-size: 28px; font-weight: 800; line-height: 1.2; }
.dash-label { font-size: 11px; color: #888; margin-top: 2px; letter-spacing: 0.5px; }
.dash-entry .dash-value { color: #1565c0; }
.dash-alive .dash-value { color: #2e7d32; }
.dash-avg .dash-value { color: #7b1fa2; font-size: 22px; }

/* ▼ アーカイブ ▼ */
.btn-archive {
  width: 100%; padding: 14px; border: 2px solid #d32f2f; border-radius: 8px;
  background: #fff; color: #d32f2f; font-size: 14px; font-weight: bold; cursor: pointer;
}
.btn-archive:active { background: #ffebee; }
.btn-aggregate {
  display: flex; align-items: center; justify-content: center;
  width: 100%; margin-top: 12px; padding: 18px 20px;
  border: none; border-radius: 12px;
  background: #2e7d32; color: #fff; font-size: 15px; font-weight: bold;
  cursor: pointer; box-shadow: 0 2px 8px rgba(0,0,0,0.15);
  transition: transform 0.1s, box-shadow 0.2s;
}
.btn-aggregate:hover { box-shadow: 0 4px 12px rgba(0,0,0,0.25); }
.btn-aggregate:active { transform: scale(0.97); box-shadow: 0 1px 4px rgba(0,0,0,0.2); }
.archived-banner {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 999;
  background: #d32f2f; color: #fff; text-align: center;
  padding: 10px; font-size: 13px; font-weight: bold;
}
.home-btn.disabled { opacity: 0.4; pointer-events: none; }

/* ▼ TOP画面 (.home-***) ▼ */
.home-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; width: 100%; margin-bottom: 16px; padding: 0; }
.home-btn {
  display: flex; flex-direction: column; justify-content: center; align-items: flex-start;
  width: 100%; height: 80px; padding: 0 15px; margin: 0;
  background-color: #fff; border: 1px solid #e0e0e0; border-radius: 12px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.04);
  font-size: 16px; font-weight: bold; color: #333; line-height: 1.3;
  cursor: pointer; transition: all 0.15s ease;
}
.home-btn:active { transform: translateY(2px); box-shadow: 0 1px 2px rgba(0,0,0,0.06); }
.home-btn:disabled { opacity: 0.4; cursor: not-allowed; transform: none; box-shadow: none; }
.home-btn small { font-size: 11px; font-weight: normal; opacity: 0.7; margin-top: 4px; display: block; }
.home-span-full { grid-column: 1 / -1; }

/* TOP画面色設定 */
.c-entry { background: linear-gradient(135deg, #e3f2fd, #bbdefb); border-color: #90caf9; color: #0d47a1; }
.c-reentry { background: linear-gradient(135deg, #e8f5e9, #c8e6c9); border-color: #a5d6a7; color: #1b5e20; }
.c-addon { background: linear-gradient(135deg, #e0f7fa, #b2ebf2); border-color: #80deea; color: #006064; }
.c-burst { background: linear-gradient(135deg, #ffebee, #ffcdd2); border-color: #ef9a9a; color: #b71c1c; }
.c-retire { background: linear-gradient(135deg, #fff8e1, #ffecb3); border-color: #ffe082; color: #ff6f00; }
.c-winner { background: linear-gradient(135deg, #fffde7, #fff9c4); border-color: #fff59d; color: #f57f17; }
.c-info { background: #f5f5f5; border-color: #e0e0e0; color: #424242; }
.c-rate { background: linear-gradient(135deg, #f3e5f5, #e1bee7); border-color: #ce93d8; color: #7b1fa2; }
.c-admin { background: #fff; border-color: #ddd; color: #555; }

/* ▼ リスト選択画面 (.list-***) ▼ */
.list-container { display: flex; flex-direction: column; gap: 12px; width: 100%; padding: 0; margin-bottom: 20px; }
.list-btn-base {
  display: flex; align-items: center; width: 100%; height: 60px; padding: 0 15px; margin: 0;
  border-radius: 12px; font-size: 16px; font-weight: bold;
  cursor: pointer; box-shadow: 0 2px 6px rgba(0,0,0,0.04); transition: all 0.15s ease;
}
.list-btn-base:active { transform: translateY(1px); }
.list-option { justify-content: flex-start; text-align: left; background-color: #fff; border: 1px solid #ddd; color: #333; }
.list-option:active { border-color: #1a73e8; background: #f8faff; }
.list-back { justify-content: center; text-align: center; background-color: #f5f5f5; border: 1px solid #ddd; color: #555; margin-top: 10px; }

/* ▼ フォーム・ログ・共通パーツ ▼ */
.form-stack { display: flex; flex-direction: column; gap: 12px; width: 100%; margin-bottom: 20px; }
.form-item {
  display: flex; align-items: center; width: 100%; height: 70px; padding: 0 15px;
  background: #fff; border: 2px solid #e3f2fd; border-radius: 12px;
  font-size: 18px; font-weight: bold; color: #333;
  transition: border 0.2s, box-shadow 0.2s;
}
input.form-item:focus, select.form-item:focus { border: 2px solid #1a73e8; outline: none; box-shadow: 0 0 0 3px rgba(26,115,232,0.15); }

.chip-controls { display: flex; align-items: center; gap: 10px; width: 100%; }
.chip-btn {
  width: 70px !important; height: 70px; font-size: 28px; font-weight: bold;
  background: #fff; border: 2px solid #ddd; border-radius: 14px; color: #333;
  cursor: pointer; display: flex; justify-content: center; align-items: center;
  flex-shrink: 0; transition: all 0.15s ease;
}
.chip-btn:active { background: #f0f0f0; transform: translateY(1px); border-color: #bbb; }
.chip-input { text-align: center; flex-grow: 1; height: 70px !important; font-size: 22px !important; border-radius: 14px !important; }

input[type=number]::-webkit-inner-spin-button,
input[type=number]::-webkit-outer-spin-button { -webkit-appearance: none; margin: 0; }

.form-label { font-weight: bold; font-size: 13px; display: block; margin-bottom: 5px; color: #666; padding-left: 2px; }

.btn-submit {
  display: flex; justify-content: center; align-items: center; width: 100%; height: 60px;
  background: linear-gradient(135deg, #ffcc00, #ffb300); border: none; border-radius: 12px;
  font-size: 18px; font-weight: bold; margin-top: 15px; cursor: pointer;
  box-shadow: 0 3px 12px rgba(255,179,0,0.3); transition: all 0.15s ease; color: #333;
}
.btn-submit:active { transform: translateY(1px); box-shadow: 0 1px 4px rgba(255,179,0,0.2); }
.btn-submit:disabled { background: #e0e0e0; border-color: #ccc; color: #999; cursor: not-allowed; box-shadow: none; }

/* カスタムチェックボックス（白背景でも枠がはっきり見える） */
.check-card { display:flex; align-items:center; gap:12px; margin-top:16px; padding:14px 16px;
  background:#fff; border:1px solid #e0e0e0; border-radius:10px; font-size:14px; color:#333; cursor:pointer; }
.check-card input[type="checkbox"] {
  appearance:none; -webkit-appearance:none; width:24px; height:24px; flex-shrink:0; margin:0;
  border:2px solid #bbb; border-radius:6px; background:#fff; cursor:pointer; position:relative;
  transition: all 0.15s ease;
}
.check-card input[type="checkbox"]:checked { background:#f5b400; border-color:#f5b400; }
.check-card input[type="checkbox"]:checked::after {
  content:""; position:absolute; left:7px; top:3px; width:6px; height:11px;
  border:solid #fff; border-width:0 3px 3px 0; transform:rotate(45deg);
}

.btn-burst-reentry {
  background: linear-gradient(135deg, #ff9900, #e68a00); color: #fff; margin-top: 10px;
  box-shadow: 0 3px 12px rgba(230,138,0,0.3);
}
.btn-burst-reentry:active { transform: translateY(1px); box-shadow: 0 1px 4px rgba(230,138,0,0.2); }

select.form-item, select.list-btn-base {
  background-image: url("data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIxMCIgaGVpZ2h0PSIxMCIgdmlld0JveD0iMCAwIDEwIDEwIj48cGF0aCBmaWxsPSIjMzMzIiBkPSZNNSA4bDQtNEgxTDUgOHoiLz48L3N2Zz4=");
  background-repeat: no-repeat; background-position: right 15px center; padding-right: 40px;
}
input.form-item { cursor: text; background-image: none; }

/* ▼ ログテーブル ▼ */
.log-table {
  width: 100%; border-collapse: collapse; font-size: 12px; margin-top: 5px;
  background: #fff; border: 1px solid #e8e8e8; border-radius: 8px; overflow: visible;
}
.log-table th, .log-table td { border: 1px solid #f0f0f0; padding: 8px; text-align: left; }
.log-table th { background: #fafafa; color: #666; font-size: 11px; text-transform: uppercase; letter-spacing: 0.5px; }
.log-table td:last-child { white-space: nowrap; text-align: center; }
.log-action-btn { border: 1px solid #ccc; border-radius: 3px; padding: 0; width: 28px; height: 22px; font-size: 11px; cursor: pointer; margin: 0 2px; }
.log-btn-delete { background: #fff3f3; color: #d32f2f; border-color: #f5c6cb; }
.log-btn-delete:hover { background: #ffcdd2; }
.log-btn-edit { background: #f3f8ff; color: #1565c0; border-color: #bbdefb; }
.log-btn-edit:hover { background: #bbdefb; }
.log-btn-correct { background: #f1f8f2; color: #2e7d32; border-color: #c8e6c9; }
.log-btn-correct:hover { background: #c8e6c9; }
.chip-plus { color: #1565c0; font-weight: bold; }
.chip-minus { color: #c62828; font-weight: bold; }

#selectedOpTitle {
  padding: 12px; background: linear-gradient(135deg, #333, #555); color: #fff;
  text-align: center; border-radius: 10px; margin-bottom: 15px;
  font-weight: bold; font-size: 15px; letter-spacing: 0.5px;
}
#mainIdNameDisplay { margin-top: 8px; margin-bottom: 5px; font-weight: bold; color: #1a73e8; font-size: 14px; padding-left: 5px; min-height: 20px; }

/* ▼ サマリーカード ▼ */
.summary-card { background: #fff; border: 1px solid #e8e8e8; border-radius: 12px; padding: 16px; margin-bottom: 12px; box-shadow: 0 2px 8px rgba(0,0,0,0.04); }
.summary-row { display: flex; justify-content: space-between; align-items: center; padding: 8px 0; border-bottom: 1px solid #f5f5f5; font-size: 14px; }
.summary-row:last-child { border-bottom: none; }
.summary-row > span:first-child { flex: 0 0 auto; color: #6b7280; }
.summary-row > span:last-child { flex: 1 1 auto; min-width: 0; overflow-wrap: anywhere; }
.summary-head { font-weight: bold; border-bottom: 1px solid #eee; margin-bottom: 6px; padding-bottom: 6px; }
.summary-note { margin-top: 10px; font-size: 11.5px; line-height: 1.6; color: #8a8f98; }

/* ▼ ランキング ▼ */
.ranking-table { width: 100%; border-collapse: collapse; font-size: 14px; background: #fff; border: 1px solid #e8e8e8; border-radius: 8px; overflow: hidden; }
.ranking-table th, .ranking-table td { border: 1px solid #f0f0f0; padding: 10px 8px; text-align: center; }
.ranking-table th { background: linear-gradient(135deg, #333, #555); color: #fff; font-size: 12px; letter-spacing: 0.5px; }
.rank-winner { background: linear-gradient(135deg, #fff9c4, #ffe082) !important; font-weight: bold; }
.rank-winner td { color: #e65100; }
.rank-eliminated { background: #fafafa; }
.rank-pending { color: #ccc; }
.rank-number { font-weight: bold; font-size: 16px; }
.survivor-badge {
  display: inline-block; background: linear-gradient(135deg, #e3f2fd, #bbdefb); color: #0d47a1;
  padding: 6px 12px; border-radius: 8px; font-size: 13px; font-weight: bold; margin: 3px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.08);
}

/* サブナビバー */
.sub-header {
  display: flex; align-items: center; gap: 10px; padding: 10px 14px; margin-bottom: 16px;
  background: #fff; border: 1px solid #e8e8e8; border-radius: 12px;
  box-shadow: 0 2px 6px rgba(0,0,0,0.04); font-size: 13px; color: #555;
}
.sub-header-back {
  width: 36px; height: 36px; min-width: 36px; background: #fff; border: 1.5px solid #ddd;
  border-radius: 50%; display: flex; justify-content: center; align-items: center;
  cursor: pointer; font-size: 16px; color: #555; transition: all 0.15s ease;
  box-shadow: 0 1px 4px rgba(0,0,0,0.06);
}
.sub-header-back:active { background: #eee; transform: translateY(1px); }
.sub-header-title { flex-grow: 1; font-weight: bold; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ログ操作名色分け */
.op-entry { color: #0d47a1; } .op-reentry { color: #1b5e20; }
.op-burst { color: #b71c1c; font-weight: bold; } .op-retire { color: #e65100; }
.op-winner { color: #f57f17; font-weight: bold; } .op-addon { color: #006064; }
.op-info { color: #666; font-style: italic; } .op-rate { color: #7b1fa2; }

/* 成功アニメーション */
.success-overlay {
  position: fixed; top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(255,255,255,0.85); display: flex; justify-content: center; align-items: center;
  z-index: 900; animation: fadeInOut 1.2s ease forwards;
}
.success-check { font-size: 80px; animation: popIn 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275); }
@keyframes popIn { from { transform: scale(0); opacity: 0; } to { transform: scale(1); opacity: 1; } }
@keyframes fadeInOut { 0% { opacity: 0; } 20% { opacity: 1; } 80% { opacity: 1; } 100% { opacity: 0; } }

/* フィルター入力 */
.filter-input {
  width: 100%; height: 70px; padding: 0 16px; border: 2px solid #e3f2fd; border-radius: 12px;
  font-size: 16px; background: #fff; margin-bottom: 8px; transition: border 0.2s, box-shadow 0.2s;
}
.filter-input:focus { border-color: #1a73e8; outline: none; box-shadow: 0 0 0 3px rgba(26,115,232,0.12); }
.filter-input::placeholder { color: #aaa; }

/* 連続入力モード */
.continuous-mode {
  display: flex; align-items: center; gap: 8px; padding: 10px 14px;
  background: #f8f9fa; border: 1px solid #e8e8e8; border-radius: 10px;
  font-size: 13px; color: #555; cursor: pointer; margin-top: 5px;
}
.continuous-mode input[type=checkbox] { width: 18px; height: 18px; accent-color: #1a73e8; flex-shrink: 0; appearance: checkbox; -webkit-appearance: checkbox; }

/* スタート画面 */
.start-screen {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  min-height: 70vh; text-align: center; padding: 20px;
}
.start-title { font-size: 22px; font-weight: 800; letter-spacing: 2px; color: #1b5e20; margin-bottom: 4px; padding: 0 10px; }
.start-subtitle { font-size: 12px; color: #999; letter-spacing: 1px; margin-bottom: 6px; }
.start-divider { width: 60px; height: 3px; background: linear-gradient(90deg, #1b5e20, #4caf50); border-radius: 2px; margin: 0 auto 30px; }
.start-select-wrap { width: 100%; max-width: 400px; }

/* Undoバナー */
.undo-banner {
  position: fixed; bottom: 80px; left: 50%; transform: translateX(-50%);
  background: rgba(40,40,40,0.95); color: #fff; padding: 12px 20px;
  border-radius: 12px; font-size: 14px; display: flex; align-items: center; gap: 12px;
  z-index: 998; box-shadow: 0 4px 20px rgba(0,0,0,0.25); backdrop-filter: blur(8px);
  animation: toastIn 0.4s ease-out;
}
.undo-banner button {
  width: auto !important; padding: 6px 14px; background: #fff; color: #333;
  border-radius: 8px; font-weight: bold; font-size: 13px; cursor: pointer; flex-shrink: 0;
}

/* リアルタイムインジケーター */
.realtime-dot {
  display: inline-block; width: 8px; height: 8px; border-radius: 50%;
  background: #4caf50; margin-right: 6px; animation: pulse 2s infinite;
}
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.4; } }

/* SS同期失敗バナー（消えない警告） */
.sync-fail-banner {
  position: fixed; top: 0; left: 0; right: 0; z-index: 1000;
  background: linear-gradient(135deg, #d32f2f, #b71c1c); color: #fff;
  padding: 12px 40px 12px 16px; font-size: 13px; font-weight: 500;
  box-shadow: 0 2px 12px rgba(211,47,47,0.4);
  animation: slideDown 0.3s ease-out;
}
.sync-fail-banner .sync-fail-close {
  position: absolute; top: 8px; right: 10px;
  width: 28px; height: 28px; background: rgba(255,255,255,0.2);
  border: none; border-radius: 50%; color: #fff; font-size: 16px;
  cursor: pointer; display: flex; justify-content: center; align-items: center;
}
.sync-fail-banner .sync-fail-close:hover { background: rgba(255,255,255,0.35); }
@keyframes slideDown { from { transform: translateY(-100%); } to { transform: translateY(0); } }

/* フローティング戻るボタン（全ログ画面用） */
.fab-back-top {
  position: fixed; bottom: 24px; right: 24px; z-index: 900;
  width: 52px; height: 52px; border-radius: 50%;
  background: #1a73e8; color: #fff; border: none;
  font-size: 18px; font-weight: bold; line-height: 1.1;
  box-shadow: 0 4px 12px rgba(26,115,232,0.4);
  cursor: pointer; display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  transition: transform 0.2s, box-shadow 0.2s;
}
.fab-back-top:hover { transform: scale(1.1); box-shadow: 0 6px 20px rgba(26,115,232,0.5); }
.fab-back-top:active { transform: scale(0.95); }

/* ▼ GAS同期ステータスバッジ ▼ */
.gas-sync-badge {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 8px 14px; margin-top: 10px; width: 100%;
  background: linear-gradient(135deg, #fff3e0, #ffe0b2); border: 1.5px solid #ffb74d;
  border-radius: 10px; font-size: 13px; font-weight: 600; color: #e65100;
  cursor: pointer; transition: all 0.15s ease;
  box-shadow: 0 2px 8px rgba(230,81,0,0.12);
  animation: syncBadgePulse 2s infinite;
}
.gas-sync-badge:active { transform: translateY(1px); box-shadow: 0 1px 3px rgba(230,81,0,0.1); }
@keyframes syncBadgePulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.75; } }

/* 再送モーダル */
.gas-sync-modal {
  display: none; position: fixed; inset: 0; background: rgba(0,0,0,0.5);
  z-index: 1002; align-items: center; justify-content: center;
}
.gas-sync-modal-content {
  background: #fff; border-radius: 12px; padding: 24px;
  width: 90%; max-width: 400px; box-shadow: 0 8px 32px rgba(0,0,0,0.3);
  max-height: 80vh; overflow-y: auto;
}
.gas-sync-list { list-style: none; padding: 0; margin: 12px 0; }
.gas-sync-list li {
  display: flex; justify-content: space-between; align-items: center;
  padding: 10px 12px; margin-bottom: 6px;
  background: #f8f9fa; border-radius: 8px; border-left: 3px solid #ffb74d;
  font-size: 13px; color: #555;
}
.gas-sync-list li .sync-label { font-weight: 600; }
.gas-sync-list li .sync-time { font-size: 11px; color: #999; }
.gas-sync-actions {
  display: flex; gap: 10px; margin-top: 16px;
}
.btn-retry-all {
  flex: 1; padding: 14px; border: none; border-radius: 8px;
  background: linear-gradient(135deg, #ff9800, #f57c00); color: #fff;
  font-size: 14px; font-weight: bold; cursor: pointer;
  transition: all 0.15s ease;
}
.btn-retry-all:active { transform: translateY(1px); }
.btn-retry-all:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-clear-sync {
  flex: 1; padding: 14px; border: 1px solid #ddd; border-radius: 8px;
  background: #f5f5f5; color: #777; font-size: 14px; font-weight: bold;
  cursor: pointer;
}

/* ▼ 終了済みトグルボタン ▼ */
.toggle-archived-btn {
  display: flex; align-items: center; justify-content: center;
  width: 100%; margin-top: 10px; padding: 10px 14px;
  background: #f5f5f5; border: 1.5px solid #ddd; border-radius: 10px;
  font-size: 13px; font-weight: 600; color: #999;
  cursor: pointer; transition: all 0.2s ease;
}
.toggle-archived-btn:active { transform: translateY(1px); }
.toggle-archived-btn.active {
  background: #e3f2fd; border-color: #90caf9; color: #1565c0;
}

/* ==========================================================================
   ▼ ブランドロゴ分割（両テーマ共通の字形）
   「MBRT」= Bahnschrift Condensed / 和文 = ゴシック（同サイズ横並び）
   ========================================================================== */
.brand-mark {
  font-family: "Bahnschrift", "DIN Condensed", "Oswald", "Arial Narrow", sans-serif;
  font-weight: 700; font-stretch: 87%; letter-spacing: 0.04em;
}
.brand-jp { letter-spacing: 0.5px; }

/* ▼ テーマ切替トグル（既定＝クラシック配色） ▼ */
.theme-toggle {
  display: inline-flex; gap: 0; margin-top: 22px; padding: 4px;
  background: #fff; border: 1px solid #e0e0e0; border-radius: 12px;
  box-shadow: 0 2px 6px rgba(0,0,0,0.04);
}
.theme-toggle button {
  width: auto !important; padding: 8px 18px; border-radius: 9px;
  font-size: 13px; font-weight: 700; color: #888; background: transparent;
  cursor: pointer; transition: all 0.15s ease;
}
.theme-toggle button.active {
  background: linear-gradient(135deg, #1b5e20, #388e3c); color: #fff;
  box-shadow: 0 2px 6px rgba(27,94,32,0.25);
}

/* 残り火キャンバスは既定（クラシック）では非表示 */
.login-embers { display: none; }

/* ==========================================================================
   ▼▼▼ POSTER テーマ（ログイン画面のみ） ▼▼▼
   html[data-theme="poster"] の時だけ効く追加オーバーライド。
   クラシックのスタイルには一切干渉しない。フェーズ1＝ログイン画面限定。
   ========================================================================== */

/* 認証確認中オーバーレイ（インラインstyleを上書きするため !important） */
html[data-theme="poster"] #authLoading { background: #0b0705 !important; }
html[data-theme="poster"] #authLoading div { color: #b6a897 !important; }

/* ログイン表示中のみ、body全面をポスターのダーク背景に */
html[data-theme="poster"] body.view-login {
  background:
    radial-gradient(120% 55% at 30% 115%, #7a1e10 0%, #3d0f0a 22%, transparent 55%),
    radial-gradient(80% 40% at 82% -6%, #2a140c 0%, transparent 60%),
    linear-gradient(180deg, #120a07 0%, #0b0705 62%, #0a0604 100%);
  background-attachment: fixed;
}

/* 残り火キャンバス（画面全面・最背面）＋ ログイン要素を前面に */
html[data-theme="poster"] .login-embers {
  display: block; position: fixed; inset: 0; z-index: 0; pointer-events: none;
}
html[data-theme="poster"] .login-screen > *:not(.login-embers) {
  position: relative; z-index: 1;
}

/* ロゴ：MBRT＝メタリック金＋立体ベベル / 和文＝アイボリー */
html[data-theme="poster"] .login-logo .brand-mark {
  background: linear-gradient(180deg, #fff4d2 0%, #f4d689 28%, #e8c66a 48%, #b8863a 72%, #8a5f27 100%);
  -webkit-background-clip: text; background-clip: text; color: transparent;
  text-shadow: 0 1px 0 #6b4a1f, 0 2px 5px rgba(0,0,0,0.5);
}
html[data-theme="poster"] .login-logo .brand-jp { color: #e9dcc0; }
html[data-theme="poster"] .login-subtitle {
  color: #d8b871; font-family: Georgia, "Times New Roman", "Yu Mincho", serif; font-style: italic;
}
html[data-theme="poster"] .login-divider {
  background: linear-gradient(90deg, #b8863a, #ff6a1f, #b8863a);
}

/* カード */
html[data-theme="poster"] .login-card {
  background: rgba(28,17,12,0.58); border: 1px solid rgba(232,198,106,0.22);
  box-shadow: 0 8px 34px rgba(0,0,0,0.5);
  backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);
}
html[data-theme="poster"] .pin-title { color: #e8c66a; }
html[data-theme="poster"] .pin-digit {
  background: rgba(255,255,255,0.03); border: 2px solid rgba(232,198,106,0.28); color: #f2e6cf;
}
html[data-theme="poster"] .pin-digit:focus {
  border-color: #ff8a3d; background: rgba(255,106,31,0.06);
  box-shadow: 0 0 0 3px rgba(255,106,31,0.22), 0 0 18px rgba(255,106,31,0.25);
}

/* ログインボタン＝炎グラデ */
html[data-theme="poster"] .btn-pin-login {
  background: linear-gradient(135deg, #ff8a3d 0%, #ff6a1f 45%, #b3210e 100%); color: #fff;
  box-shadow: 0 4px 20px rgba(255,80,20,0.35);
}
html[data-theme="poster"] .login-or { color: #8a7a63; }
html[data-theme="poster"] .login-or::before,
html[data-theme="poster"] .login-or::after { background: rgba(232,198,106,0.18); }
html[data-theme="poster"] .btn-google {
  background: rgba(255,255,255,0.04); border: 1.5px solid rgba(232,198,106,0.22); color: #ead9bd;
}
html[data-theme="poster"] .btn-google:hover {
  background: rgba(255,255,255,0.07); border-color: rgba(232,198,106,0.35);
}
html[data-theme="poster"] .login-error { color: #ff9a7a; }

/* テーマ切替トグル（ポスター配色） */
html[data-theme="poster"] .theme-toggle {
  background: rgba(28,17,12,0.6); border: 1px solid rgba(232,198,106,0.22);
}
html[data-theme="poster"] .theme-toggle button { color: #b09a78; }
html[data-theme="poster"] .theme-toggle button.active {
  background: linear-gradient(135deg, #e8c66a, #b8863a); color: #241708;
  box-shadow: 0 2px 8px rgba(184,134,58,0.3);
}

/* 小型トグル（ユーザーバー内・ログイン後も切替可能） */
.theme-toggle-mini { margin-top: 0; padding: 3px; border-radius: 9px; flex-shrink: 0; }
.theme-toggle-mini button { padding: 5px 9px !important; font-size: 13px; border-radius: 7px; line-height: 1; }

/* ==========================================================================
   ▼▼▼ POSTER テーマ フェーズ2（ログイン後の運営画面 全般） ▼▼▼
   共有部品クラスを一括上書き。クラシックには一切干渉しない。
   ========================================================================== */

/* 画面全体のダーク背景＋基本文字色（落ち着いた上部グロー） */
html[data-theme="poster"] body {
  background:
    radial-gradient(95% 42% at 50% -8%, #2a140c 0%, transparent 55%),
    linear-gradient(180deg, #120a07 0%, #0b0705 44%, #0a0604 100%);
  background-attachment: fixed;
  color: #e6dac2;  /* body直下のモーダル等が継承する既定文字色を明色に */
}
/* 使用中/参照ステータス等の暗めの緑を明色に */
html[data-theme="poster"] [style*="color:#137333"],
html[data-theme="poster"] [style*="color: #137333"] { color: #6cc487 !important; }
html[data-theme="poster"] #mainContent { color: #ece0cd; }

/* ユーザー情報バー */
html[data-theme="poster"] .user-bar {
  background: rgba(26,17,11,0.72); border: 1px solid rgba(232,198,106,0.18);
  box-shadow: 0 4px 14px rgba(0,0,0,0.35); color: #e0d3ba;
}
html[data-theme="poster"] .role-admin { background: rgba(232,198,106,0.16); color: #e8c66a; }
html[data-theme="poster"] .role-staff { background: rgba(109,179,232,0.16); color: #8ec5f0; }
html[data-theme="poster"] .btn-logout {
  background: rgba(255,255,255,0.05); border: 1px solid rgba(232,198,106,0.2); color: #d0c2a6;
}
html[data-theme="poster"] .btn-logout:active { background: rgba(255,255,255,0.09); }
html[data-theme="poster"] .realtime-dot { background: #ff6a1f; }

/* 大会選択（スタート）画面 */
html[data-theme="poster"] .start-title { color: #f4d689; }
html[data-theme="poster"] .start-subtitle { color: #c8ba9c; }
html[data-theme="poster"] .start-divider { background: linear-gradient(90deg, #b8863a, #ff6a1f, #b8863a); }

/* 更新ボタン・ヘッダーのファイル名 */
html[data-theme="poster"] .btn-refresh {
  background: rgba(26,17,11,0.8); border: 1px solid rgba(232,198,106,0.2); color: #e8c66a;
  box-shadow: 0 2px 8px rgba(0,0,0,0.3);
}
html[data-theme="poster"] .btn-refresh:active { background: rgba(40,26,16,0.9); }
html[data-theme="poster"] #homeFileName { color: #e0d3ba !important; }

/* ダッシュボード */
html[data-theme="poster"] .dash-item {
  background: rgba(26,17,11,0.72); border: 1px solid rgba(232,198,106,0.16);
  box-shadow: 0 4px 14px rgba(0,0,0,0.3);
}
html[data-theme="poster"] .dash-label { color: #c8ba9c; }
html[data-theme="poster"] .dash-entry .dash-value { color: #6db3e8; }
html[data-theme="poster"] .dash-alive .dash-value { color: #74c98a; }
html[data-theme="poster"] .dash-avg .dash-value { color: #c79ae0; }

/* HOME 操作ボタン（.home-btn）＝ダークカード＋アクション色アクセント */
html[data-theme="poster"] .home-btn {
  background: rgba(26,17,11,0.72); border: 1px solid rgba(232,198,106,0.16);
  color: #ece0cd; box-shadow: 0 4px 14px rgba(0,0,0,0.3);
}
html[data-theme="poster"] .home-btn small { opacity: 0.85; }
html[data-theme="poster"] .home-btn:active { background: rgba(40,26,16,0.85); }
html[data-theme="poster"] .c-entry   { border-color: rgba(109,179,232,0.4); color: #8ec5f0; background: linear-gradient(135deg, rgba(37,63,88,0.5), rgba(26,17,11,0.72)); }
html[data-theme="poster"] .c-reentry { border-color: rgba(116,201,138,0.4); color: #8fdca0; background: linear-gradient(135deg, rgba(34,63,42,0.5), rgba(26,17,11,0.72)); }
html[data-theme="poster"] .c-addon   { border-color: rgba(77,208,225,0.4);  color: #6fdfe8; background: linear-gradient(135deg, rgba(24,58,63,0.5), rgba(26,17,11,0.72)); }
html[data-theme="poster"] .c-burst   { border-color: rgba(255,122,107,0.45); color: #ff8f80; background: linear-gradient(135deg, rgba(74,24,20,0.55), rgba(26,17,11,0.72)); }
html[data-theme="poster"] .c-retire  { border-color: rgba(255,176,96,0.45); color: #ffbe78; background: linear-gradient(135deg, rgba(74,46,18,0.5), rgba(26,17,11,0.72)); }
html[data-theme="poster"] .c-winner  { border-color: rgba(255,215,106,0.5);  color: #ffdd82; background: linear-gradient(135deg, rgba(74,58,18,0.5), rgba(26,17,11,0.72)); }
html[data-theme="poster"] .c-info    { border-color: rgba(184,184,184,0.3); color: #cfcfcf; background: rgba(26,17,11,0.72); }
html[data-theme="poster"] .c-rate    { border-color: rgba(199,154,224,0.45); color: #d3aae8; background: linear-gradient(135deg, rgba(52,34,63,0.5), rgba(26,17,11,0.72)); }
html[data-theme="poster"] .c-admin   { border-color: rgba(232,198,106,0.24); color: #e0d0b2; background: rgba(26,17,11,0.72); }
/* HOME内「トーナメント選択に戻る」全幅ボタン（インラインstyle上書き） */
html[data-theme="poster"] .home-span-full[style*="f5f5f5"] { background: rgba(255,255,255,0.04) !important; color: #d0c2a6 !important; }

/* 素の list-btn-base（マスタのタブ・保存済み画像ボタン等＝背景/色未指定） */
html[data-theme="poster"] .list-btn-base {
  background: rgba(26,17,11,0.72); border: 1px solid rgba(232,198,106,0.16); color: #ece0cd;
}
/* リスト選択（メニュー）ボタン */
html[data-theme="poster"] .list-option {
  background: rgba(26,17,11,0.72); border: 1px solid rgba(232,198,106,0.16); color: #ece0cd;
}
html[data-theme="poster"] .list-option:active { border-color: #ff8a3d; background: rgba(40,26,16,0.85); }
html[data-theme="poster"] .list-back {
  background: rgba(255,255,255,0.04); border: 1px solid rgba(232,198,106,0.16); color: #d0c2a6;
}

/* サブヘッダ */
html[data-theme="poster"] .sub-header {
  background: rgba(26,17,11,0.72); border: 1px solid rgba(232,198,106,0.16); color: #e0d3ba;
  box-shadow: 0 4px 14px rgba(0,0,0,0.3);
}
html[data-theme="poster"] .sub-header-back {
  background: rgba(255,255,255,0.05); border: 1.5px solid rgba(232,198,106,0.22); color: #e8c66a;
}
html[data-theme="poster"] .sub-header-back:active { background: rgba(255,255,255,0.1); }

/* フォーム入力・チップ操作 */
html[data-theme="poster"] .form-item {
  background-color: rgba(255,255,255,0.03); border: 2px solid rgba(232,198,106,0.2); color: #f2e6cf;
}
html[data-theme="poster"] input.form-item:focus,
html[data-theme="poster"] select.form-item:focus {
  border: 2px solid #ff8a3d; box-shadow: 0 0 0 3px rgba(255,106,31,0.2);
}
html[data-theme="poster"] .form-item::placeholder { color: #9c8b6d; }
html[data-theme="poster"] .form-label { color: #d2c5a8; }
html[data-theme="poster"] .chip-btn {
  background: rgba(255,255,255,0.04); border: 2px solid rgba(232,198,106,0.22); color: #f2e6cf;
}
html[data-theme="poster"] .chip-btn:active { background: rgba(255,255,255,0.09); border-color: rgba(232,198,106,0.4); }
html[data-theme="poster"] .filter-input {
  background: rgba(255,255,255,0.03); border: 2px solid rgba(232,198,106,0.2); color: #f2e6cf;
}
html[data-theme="poster"] .filter-input:focus { border-color: #ff8a3d; box-shadow: 0 0 0 3px rgba(255,106,31,0.18); }
html[data-theme="poster"] .filter-input::placeholder { color: #9c8b6d; }
/* select のドロップダウン矢印を明色に（no-repeat/位置も明示して繰り返し防止） */
html[data-theme="poster"] select.form-item, html[data-theme="poster"] select.list-btn-base {
  background-image: url("data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIxMCIgaGVpZ2h0PSIxMCIgdmlld0JveD0iMCAwIDEwIDEwIj48cGF0aCBmaWxsPSIjZThjNjZhIiBkPSJNNSA4bDQtNEgxTDUgOHoiLz48L3N2Zz4=");
  background-repeat: no-repeat; background-position: right 15px center; padding-right: 40px;
}
/* 選択肢リスト（開いた時）はOSのダーク描画に委ねつつ文字を明色に */
html[data-theme="poster"] select.form-item option, html[data-theme="poster"] select.list-btn-base option {
  color: #1a120d; background-color: #f2e6cf;
}
/* 名簿更新ボタン等の淡色インライン（上書き） */
html[data-theme="poster"] #groupUpdateNames .list-option { background: rgba(109,179,232,0.14) !important; color: #8ec5f0 !important; border-color: rgba(109,179,232,0.4) !important; }

/* チェックボックスカード・連続入力 */
html[data-theme="poster"] .check-card, html[data-theme="poster"] .continuous-mode {
  background: rgba(26,17,11,0.72); border: 1px solid rgba(232,198,106,0.16); color: #e0d3ba;
}
html[data-theme="poster"] .check-card input[type="checkbox"] { background: rgba(255,255,255,0.05); border-color: rgba(232,198,106,0.4); }
html[data-theme="poster"] .check-card input[type="checkbox"]:checked { background: #ff6a1f; border-color: #ff6a1f; }

/* サマリー・テーブル系 */
html[data-theme="poster"] .summary-card {
  background: rgba(26,17,11,0.72); border: 1px solid rgba(232,198,106,0.16); color: #ece0cd;
  box-shadow: 0 4px 14px rgba(0,0,0,0.3);
}
html[data-theme="poster"] .summary-row { border-bottom-color: rgba(232,198,106,0.1); }
html[data-theme="poster"] .summary-row > span:first-child { color: #b0a288; }
html[data-theme="poster"] .summary-head { border-bottom-color: rgba(232,198,106,0.16); }
html[data-theme="poster"] .summary-note { color: #9a8f7a; }
html[data-theme="poster"] .log-table, html[data-theme="poster"] .ranking-table {
  background: rgba(26,17,11,0.72); border: 1px solid rgba(232,198,106,0.16); color: #ddceb4;
}
html[data-theme="poster"] .log-table th { background: rgba(255,255,255,0.03); color: #d2c5a8; }
html[data-theme="poster"] .log-table th, html[data-theme="poster"] .log-table td { border-color: rgba(232,198,106,0.1); }
html[data-theme="poster"] .ranking-table td { border-color: rgba(232,198,106,0.1); }
html[data-theme="poster"] .rank-eliminated { background: rgba(255,255,255,0.02); }

/* 終了済みトグル */
html[data-theme="poster"] .toggle-archived-btn {
  background: rgba(255,255,255,0.04); border: 1.5px solid rgba(232,198,106,0.18); color: #c8ba9c;
}
html[data-theme="poster"] .toggle-archived-btn.active { background: rgba(109,179,232,0.15); border-color: rgba(109,179,232,0.4); color: #8ec5f0; }

/* モーダル */
html[data-theme="poster"] .gas-sync-modal-content {
  background: #17100b; color: #ece0cd; box-shadow: 0 8px 32px rgba(0,0,0,0.6);
}
html[data-theme="poster"] .gas-sync-list li { background: rgba(255,255,255,0.03); color: #e0d3ba; }
html[data-theme="poster"] .btn-clear-sync { background: rgba(255,255,255,0.05); border: 1px solid rgba(232,198,106,0.2); color: #d0c2a6; }

/* ==========================================================================
   ▼ POSTER: インライン直書きの暗い文字/淡い背景を救済（可読性向上）
   HTMLに color:#333/#555/#666/#888/#999 や background:#f8f9fa 等が多数あり、
   ダーク背景で沈む/白地に暗文字化する。poster時のみ一括補正（クラシック無傷）。
   ========================================================================== */
/* 淡いニュートラル/淡色背景 → ダーク（背景を暗くしてから文字を明色化） */
html[data-theme="poster"] [style*="background:#f8f9fa"],
html[data-theme="poster"] [style*="background: #f8f9fa"],
html[data-theme="poster"] [style*="background-color:#f8f9fa"],
html[data-theme="poster"] [style*="background:#f5f5f5"],
html[data-theme="poster"] [style*="background: #f5f5f5"],
html[data-theme="poster"] [style*="background:#fafafa"],
html[data-theme="poster"] [style*="background: #fafafa"],
html[data-theme="poster"] [style*="background:#eef5ff"],
html[data-theme="poster"] [style*="background: #eef5ff"],
html[data-theme="poster"] [style*="background:#e3f2fd"],
html[data-theme="poster"] [style*="background: #e3f2fd"],
html[data-theme="poster"] [style*="background:#f8faff"],
html[data-theme="poster"] [style*="background: #f8faff"],
html[data-theme="poster"] [style*="background:#fff;"],
html[data-theme="poster"] [style*="background: #fff;"],
html[data-theme="poster"] [style*="background:#ffffff"],
html[data-theme="poster"] [style*="background: #ffffff"] {
  background-color: rgba(26,17,11,0.85) !important;
}
/* 淡グレーのピル/読み取り専用フィールド背景 → ダーク */
html[data-theme="poster"] [style*="background:#f1f3f4"],
html[data-theme="poster"] [style*="background: #f1f3f4"],
html[data-theme="poster"] [style*="background:#f2f2f2"],
html[data-theme="poster"] [style*="background: #f2f2f2"] {
  background-color: rgba(255,255,255,0.06) !important;
}
/* 暗い/ほぼ黒の文字（本文・見出し相当）→ 明るいアイボリー */
html[data-theme="poster"] [style*="color:#333"],
html[data-theme="poster"] [style*="color: #333"],
html[data-theme="poster"] [style*="color:#555"],
html[data-theme="poster"] [style*="color: #555"],
html[data-theme="poster"] [style*="color:#666"],
html[data-theme="poster"] [style*="color: #666"],
html[data-theme="poster"] [style*="color:#444"],
html[data-theme="poster"] [style*="color: #444"],
html[data-theme="poster"] [style*="color:#202124"],
html[data-theme="poster"] [style*="color: #202124"],
html[data-theme="poster"] [style*="color:#212121"],
html[data-theme="poster"] [style*="color:#000"],
html[data-theme="poster"] [style*="color: #000"] {
  color: #e6dac2 !important;
}
/* やや薄いグレー文字（補足・ラベル相当）→ 中間の明色 */
html[data-theme="poster"] [style*="color:#888"],
html[data-theme="poster"] [style*="color: #888"],
html[data-theme="poster"] [style*="color:#999"],
html[data-theme="poster"] [style*="color: #999"],
html[data-theme="poster"] [style*="color:#aaa"],
html[data-theme="poster"] [style*="color: #aaa"],
html[data-theme="poster"] [style*="color:#9aa0a6"],
html[data-theme="poster"] [style*="color: #9aa0a6"],
html[data-theme="poster"] [style*="color:#5f6368"],
html[data-theme="poster"] [style*="color: #5f6368"] {
  color: #c8ba9c !important;
}

/* ==========================================================================
   公式LINE QRコード（エントリーメニュー最下部 → モーダル表示）
   ※ QRは白地でないと読み取れない。poster時の一括補正は
      「インラインstyleに background:#fff 等を持つ要素」を暗転させる仕様なので、
      QRの下地は必ず【インラインを使わずクラスで】指定すること（補正の対象外になる）。
   ========================================================================== */
.list-qr {
  justify-content: center; text-align: left; flex-direction: column; align-items: flex-start;
  background-color: #f0faf5; border: 1px solid #9fd9bd; color: #06603a;
}
.list-qr .list-qr-sub { font-size: 11px; font-weight: normal; opacity: 0.75; margin-top: 2px; }
.list-qr:active { border-color: #06603a; }

.qr-modal {
  display: none; position: fixed; inset: 0; background: rgba(0,0,0,0.6);
  z-index: 1002; align-items: center; justify-content: center; padding: 20px;
}
.qr-modal.open { display: flex; }
.qr-modal-card {
  background: #fff; border: 1px solid #e0e0e0; border-radius: 16px; padding: 20px;
  width: 100%; max-width: 340px; text-align: center; box-shadow: 0 8px 32px rgba(0,0,0,0.3);
}
.qr-modal-lead { font-size: 12px; color: #777; margin-bottom: 14px; line-height: 1.7; }
.qr-plate { background: #ffffff; padding: 12px; border-radius: 10px; display: inline-block; }
.qr-image { display: block; width: 100%; max-width: 260px; height: auto; }

/* poster: カードは暗転させるが、QRの下地(.qr-plate)は白のまま維持する */
html[data-theme="poster"] .list-qr {
  background-color: rgba(20,45,30,0.55); border-color: rgba(127,211,160,0.35); color: #7fd3a0;
}
html[data-theme="poster"] .qr-modal-card {
  background: #17100c; border-color: rgba(232,198,106,0.22); color: #e6dac2;
}
html[data-theme="poster"] .qr-modal-lead { color: #bfae90; }
html[data-theme="poster"] .qr-plate { background: #ffffff; }

/* リタイア入力時の注意書き（チップは手で数えて入力する）
   ※ インラインstyleで色を書くと poster の一括補正に巻き込まれるため、必ずクラスで指定する */
.chip-hint-warn {
  margin-top: 8px; padding: 9px 11px; border-radius: 8px;
  background: #fff3f3; border: 1px solid #ffcdd2; color: #c62828;
  font-size: 12px; line-height: 1.7; text-align: center; font-weight: bold;
}
html[data-theme="poster"] .chip-hint-warn {
  background: rgba(74,24,20,0.5); border-color: rgba(255,138,122,0.35); color: #ff9d8f;
}

/* 操作ごとの「お金・現物」表示バー（選択中の見出しの直下）
   ※ 色はクラスで指定すること（インラインだと poster の一括補正に巻き込まれる） */
.op-money {
  display: flex; flex-direction: column; gap: 3px;
  margin: 0 0 4px; padding: 11px 14px; border-radius: 10px;
  font-weight: bold; line-height: 1.6; text-align: center;
}
.op-money .op-money-amt  { font-size: 17px; }
.op-money .op-money-item { font-size: 13px; }
.op-money-take { background: #fff8e1; border: 1px solid #ffe082; color: #a65f00; }
.op-money-none { background: #f4f5f7; border: 1px solid #e0e2e6; color: #6b7280; }
html[data-theme="poster"] .op-money-take {
  background: rgba(74,46,18,0.55); border-color: rgba(255,176,96,0.38); color: #ffc47a;
}
html[data-theme="poster"] .op-money-none {
  background: rgba(255,255,255,0.05); border-color: rgba(255,255,255,0.12); color: #b9ab92;
}

/* 平均枚数の表示（Avg Chip タイルの下段）と、本選のレート提案バッジ
   ※ 色はクラスで指定すること（インラインだと poster の一括補正に巻き込まれる） */
.dash-sub { font-size: 11px; color: #9aa0a6; margin-top: 3px; font-weight: bold; }
html[data-theme="poster"] .dash-sub { color: #b0a288; }

.rate-advice {
  display: flex; align-items: stretch; gap: 4px; width: 100%; margin: 0 0 16px;
  border-radius: 12px; border: 1px solid #ffe082; background: #fff8e1; color: #a65f00;
  font-size: 13.5px; font-weight: bold; line-height: 1.7;
}
.rate-advice .ra-body {
  flex: 1 1 auto; padding: 12px 14px; text-align: center;
  background: none; border: none; color: inherit; font: inherit; cursor: pointer;
}
.rate-advice .ra-close {
  flex: 0 0 auto; width: 40px; padding: 0; border: none; border-left: 1px solid currentColor;
  background: none; color: inherit; opacity: .55; font-size: 15px; cursor: pointer; font-family: inherit;
}
.rate-advice .ra-close:active { opacity: 1; }
.rate-advice .ra-main { font-size: 15px; }
.rate-advice .ra-sub { font-size: 12px; font-weight: normal; opacity: .85; }
html[data-theme="poster"] .rate-advice {
  background: rgba(74,46,18,0.55); border-color: rgba(255,176,96,0.38); color: #ffc47a;
}

/* 設定欄の補足テキスト（リエントリー締切の目安時刻など）
   ※ 色はクラスで指定すること（インラインだと poster の一括補正に巻き込まれる） */
.setting-note {
  font-size: 12px; color: #6b7280; line-height: 1.7;
  margin: 4px 0 12px; padding: 0 2px;
}
.setting-note b { color: #1a73e8; }
html[data-theme="poster"] .setting-note { color: #b0a288; }
html[data-theme="poster"] .setting-note b { color: #e8c66a; }

/* ダッシュボード2段目（現在レート / 平均枚数） */
.dashboard-2 { grid-template-columns: 1fr 1fr; }
.dash-rate .dash-value   { color: #e65100; }
.dash-sheets .dash-value { color: #00695c; }
html[data-theme="poster"] .dash-rate .dash-value   { color: #ffb066; }
html[data-theme="poster"] .dash-sheets .dash-value { color: #6fdfe8; }

/* ダッシュボードのRateタイル → タップでレート変更 */
.dash-clickable { cursor: pointer; transition: all .15s ease; }
.dash-clickable:active { transform: translateY(1px); }
/* ラベルの下に添える小さい注記（平均枚数の計算式など）。色は .dash-label から継承＝テーマ対応済み */
.dash-tap { display: block; font-size: 10px; opacity: .75; margin-top: 1px; letter-spacing: 0; }

/* レート クイック変更モーダル */
.rq-modal {
  display: none; position: fixed; inset: 0; background: rgba(0,0,0,0.55);
  z-index: 1002; align-items: center; justify-content: center; padding: 16px;
}
.rq-modal.open { display: flex; }
.rq-card {
  background: #fff; border: 1px solid #e0e0e0; border-radius: 16px; padding: 20px;
  width: 100%; max-width: 380px; max-height: 88vh; overflow-y: auto;
  box-shadow: 0 8px 32px rgba(0,0,0,0.3);
}
.rq-title { font-weight: bold; font-size: 17px; margin-bottom: 6px; }
.rq-now { font-size: 13px; color: #6b7280; margin-bottom: 14px; line-height: 1.6; }
.rq-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.rq-opt {
  padding: 9px 6px; border-radius: 10px; cursor: pointer; text-align: center;
  border: 1px solid #dfe3e8; background: #fff; color: #3c4450;
  font-family: inherit; line-height: 1.35;
}
.rq-opt .rq-r { display: block; font-size: 16px; font-weight: 800; }
.rq-opt .rq-s { display: block; font-size: 10.5px; opacity: .7; }
.rq-opt.is-current { border-color: #9aa0a6; background: #f1f3f4; }
.rq-opt.is-rec     { border-color: #e6a417; background: #fff8e1; color: #a65f00; }
.rq-opt.is-sel     { border-color: #1a73e8; background: #e8f0fe; color: #0d47a1; box-shadow: 0 0 0 2px rgba(26,115,232,.2); }
.rq-freewrap { margin-top: 14px; }
.rq-freelabel { font-size: 12px; color: #6b7280; margin-bottom: 5px; }
.rq-preview {
  margin-top: 12px; padding: 10px; border-radius: 9px; text-align: center;
  background: #f4f5f7; border: 1px solid #e0e2e6; color: #3c4450;
  font-size: 13px; font-weight: bold; line-height: 1.7; min-height: 22px;
}
/* 前レート表示トグル。レートの選択とは別操作（押した時点で反映）なので区切り線で分ける */
.rq-prevrate { margin-top: 14px; padding-top: 12px; border-top: 1px solid #e6e8ec; }

/* QR申込みの受付待ち（HOME・ENTRYメニュー） */
.entry-queue {
  display: block; width: 100%; margin: 0 0 12px; padding: 12px; border-radius: 12px; cursor: pointer;
  background: #e8f5e9; border: 2px solid #43a047; color: #1b5e20;
  font-family: inherit; font-size: 16px; font-weight: bold;
}
.entry-queue:active { transform: translateY(1px); }
.eq-row {
  display: flex; align-items: center; gap: 8px; padding: 10px 2px; border-bottom: 1px solid #eef0f3;
}
.eq-row:last-child { border-bottom: none; }
.eq-who { flex: 1; min-width: 0; font-size: 15px; }
.eq-who small { display: block; font-size: 11px; color: #9aa0a6; }
/* 全体の button { width:100% } を打ち消して中身の幅にする（名前の横に2つ並べるため） */
.eq-accept, .eq-cancel {
  flex: 0 0 auto; width: auto; white-space: nowrap;
  padding: 8px 12px; border-radius: 8px; cursor: pointer; font-family: inherit; font-weight: bold;
}
.eq-accept { background: #43a047; border: 1px solid #43a047; color: #fff; }
.eq-cancel { background: #fff; border: 1px solid #dadce0; color: #5f6368; }
.eq-cancel[data-armed] { background: #d32f2f; border-color: #d32f2f; color: #fff; }
.eq-row.eq-claimed .eq-who { opacity: 0.5; }
/* エントリー画面の「次の受付待ち」 */
.next-queue {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  margin: 8px 0 4px; padding: 8px 10px; border-radius: 10px;
  background: #e8f5e9; border: 1px solid #a5d6a7; color: #1b5e20; font-size: 14px;
}
/* 全体の button { width:100% } を打ち消す */
.next-queue-btn {
  width: auto; margin-left: auto; padding: 6px 14px; border-radius: 8px; cursor: pointer;
  background: #43a047; color: #fff; font-family: inherit; font-weight: bold; white-space: nowrap;
}
.qr-svg { width: 260px; max-width: 100%; }
.qr-svg svg { width: 100%; height: auto; display: block; }

/* 会員証QRの読み取り（エントリー系・アドオン購入の顧客ID欄の上） */
.qr-scan-btn {
  display: block; width: 100%; margin: 0 0 8px; padding: 10px; border-radius: 10px; cursor: pointer;
  background: #eef4fd; border: 1px solid #c7dcf7; color: #1a4e8a;
  font-family: inherit; font-size: 15px; font-weight: bold;
}
.qr-scan-btn:active { transform: translateY(1px); }
.qr-scan-video-wrap {
  position: relative; width: 100%; aspect-ratio: 1 / 1; max-width: 100%;
  background: #000; border-radius: 12px; overflow: hidden;
}
.qr-scan-video-wrap video { width: 100%; height: 100%; object-fit: cover; display: block; }
/* 読み取り位置の目安（中央の枠） */
.qr-scan-frame {
  position: absolute; inset: 18%; border: 3px solid rgba(255,255,255,0.85); border-radius: 14px;
  box-shadow: 0 0 0 999px rgba(0,0,0,0.25); pointer-events: none;
}

/* 「その操作はこちら」と正しい操作へ飛ばす注意書き（リタイア → 決勝足切） */
.op-note-jump {
  margin: 0 0 12px; padding: 10px 12px; border-radius: 10px; cursor: pointer;
  background: #eef4fd; border: 1px solid #c7dcf7; color: #1a4e8a;
  font-size: 12.5px; line-height: 1.6; text-align: center;
}
.op-note-jump b { display: block; margin-top: 3px; font-size: 13px; }
.op-note-jump:active { transform: translateY(1px); }

/* ダッシュボード詳細モーダルの中身（枠は .rq-card を使い回す） */
.dd-empty { text-align: center; color: #9aa0a6; padding: 18px 0; font-size: 13px; }
.dd-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.dd-chip {
  background: #e3f2fd; color: #0d47a1; padding: 5px 10px; border-radius: 6px;
  font-size: 13px; font-weight: bold;
}
.dd-chip.is-out { background: #f1f3f4; color: #80868b; font-weight: normal; }
.dd-rows { display: flex; flex-direction: column; }
.dd-row {
  display: flex; align-items: baseline; justify-content: space-between; gap: 10px;
  padding: 9px 2px; border-bottom: 1px solid #eef0f3;
}
.dd-row:last-child { border-bottom: none; }
.dd-k { font-size: 13px; color: #6b7280; }
.dd-v { font-size: 16px; font-weight: 800; text-align: right; }
.dd-v small { display: block; font-size: 11px; font-weight: normal; color: #9aa0a6; margin-top: 1px; }

html[data-theme="poster"] .rq-card { background: #17100c; border-color: rgba(232,198,106,0.22); color: #e6dac2; }
html[data-theme="poster"] .rq-now,
html[data-theme="poster"] .rq-freelabel { color: #b0a288; }
html[data-theme="poster"] .rq-opt { background: rgba(255,255,255,0.04); border-color: rgba(255,255,255,0.14); color: #e6dac2; }
html[data-theme="poster"] .rq-opt.is-current { background: rgba(255,255,255,0.10); border-color: rgba(255,255,255,0.30); }
html[data-theme="poster"] .rq-opt.is-rec     { background: rgba(74,46,18,0.6); border-color: rgba(255,176,96,0.45); color: #ffc47a; }
html[data-theme="poster"] .rq-opt.is-sel     { background: rgba(37,63,88,0.6); border-color: rgba(142,197,240,0.6); color: #8ec5f0; box-shadow: 0 0 0 2px rgba(142,197,240,.25); }
html[data-theme="poster"] .rq-preview { background: rgba(255,255,255,0.05); border-color: rgba(255,255,255,0.12); color: #e6dac2; }
html[data-theme="poster"] .rq-prevrate { border-top-color: rgba(255,255,255,0.12); }
html[data-theme="poster"] .next-queue { background: rgba(116,201,138,0.12); border-color: rgba(116,201,138,0.45); color: #9be0ad; }
html[data-theme="poster"] .entry-queue { background: rgba(116,201,138,0.14); border-color: rgba(116,201,138,0.6); color: #9be0ad; }
html[data-theme="poster"] .eq-row { border-bottom-color: rgba(255,255,255,0.10); }
html[data-theme="poster"] .eq-who small { color: #9a8f7a; }
html[data-theme="poster"] .eq-cancel { background: rgba(255,255,255,0.05); border-color: rgba(255,255,255,0.2); color: #c8ba9c; }
html[data-theme="poster"] .qr-scan-btn { background: rgba(109,179,232,0.10); border-color: rgba(142,197,240,0.32); color: #9ecbf0; }
html[data-theme="poster"] .op-note-jump { background: rgba(109,179,232,0.10); border-color: rgba(142,197,240,0.32); color: #9ecbf0; }
html[data-theme="poster"] .dd-chip { background: rgba(109,179,232,0.16); color: #9ecbf0; }
html[data-theme="poster"] .dd-chip.is-out { background: rgba(255,255,255,0.05); color: #9a8f7a; }
html[data-theme="poster"] .dd-row { border-bottom-color: rgba(255,255,255,0.10); }
html[data-theme="poster"] .dd-k { color: #b0a288; }
html[data-theme="poster"] .dd-v small { color: #9a8f7a; }
html[data-theme="poster"] .dd-empty { color: #9a8f7a; }

/* ステージ切替バー（予選 / 本選 / 決勝）＝ HOME最上段。ディスプレイの表示モードと連動 */
.stage-bar { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-bottom: 12px; }
.stage-btn {
  padding: 11px 6px; border-radius: 12px; cursor: pointer; font-family: inherit;
  border: 1px solid #e0e0e0; background: #fff; color: #8a929c;
  font-size: 15px; font-weight: bold; box-shadow: 0 2px 6px rgba(0,0,0,0.04);
  transition: all .15s ease;
}
.stage-btn:active { transform: translateY(1px); }
.stage-btn.active { border-color: #1a73e8; background: #e8f0fe; color: #0d47a1; box-shadow: 0 0 0 2px rgba(26,115,232,.18); }
html[data-theme="poster"] .stage-btn { background: rgba(26,17,11,0.72); border-color: rgba(232,198,106,0.16); color: #9b8f79; }
html[data-theme="poster"] .stage-btn.active {
  border-color: rgba(232,198,106,0.6); background: rgba(74,46,18,0.6); color: #e8c66a;
  box-shadow: 0 0 0 2px rgba(232,198,106,.2);
}

/* いまのステージで使わない操作ボタンを控えめにする（押せなくはしない） */
.home-btn.op-muted { opacity: 0.38; }

/* リスト選択ボタンで補足文を下段に出す（その他メニューの罰符・チョンボ） */
.list-btn-base.list-col { flex-direction: column; align-items: flex-start; justify-content: center; }
.list-btn-base .list-sub { font-size: 11px; font-weight: normal; opacity: 0.72; margin-top: 2px; }

/* ログ表：操作名の下に memo を小さく出す（罰符/チョンボの種別・お知らせの本文） */
.log-memo { display: block; font-size: 10.5px; font-weight: normal; color: #8a929c; line-height: 1.4; margin-top: 1px; }
html[data-theme="poster"] .log-memo { color: #a2937b; }

/* 「前レートで入れる」ワンボタン（バースト／罰符／チョンボの入力画面） */
.btn-prev-rate {
  display: block; width: 100%; margin-top: 8px; padding: 9px 10px;
  border: 1px solid #f59e0b; border-radius: 9px; background: #fff8e1; color: #a65f00;
  font-family: inherit; font-size: 13px; font-weight: bold; cursor: pointer;
}
.btn-prev-rate:active { transform: translateY(1px); }
html[data-theme="poster"] .btn-prev-rate {
  background: rgba(74,46,18,0.6); border-color: rgba(255,176,96,0.45); color: #ffc47a;
}

/* 予選の「次のステージまで」案内（警告ではないので控えめな配色） */
.rate-advice-info { background: #eef4fb; border-color: #c6dcf3; color: #1a4a7a; }
html[data-theme="poster"] .rate-advice-info {
  background: rgba(37,63,88,0.5); border-color: rgba(142,197,240,0.3); color: #8ec5f0;
}

/* 狭い画面（スマホ）ではユーザーバーの余白を詰めて1行に収める */
@media (max-width: 420px) {
  .user-bar { gap: 6px; padding: 8px 10px; }
  .user-bar-role { padding: 2px 6px; }
  .theme-toggle-mini { padding: 2px; }
  .theme-toggle-mini button { padding: 5px 7px !important; }
  .btn-logout { padding: 6px 8px; }
}

/* 前レートを当てている状態（もう一度押すと現レートに戻る） */
.btn-prev-rate.is-on { background: #f59e0b; border-color: #f59e0b; color: #fff; }
html[data-theme="poster"] .btn-prev-rate.is-on {
  background: rgba(255,176,96,0.85); border-color: rgba(255,176,96,0.9); color: #2b1a0a;
}

/* HOMEヘッダーの大会名とステータスバッジ */
.home-title-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.home-title { font-size: 15px; color: #333; }
.home-subtitle { font-size: 12px; color: #888; font-weight: normal; margin-top: 2px; }
.tour-status {
  flex: 0 0 auto; font-size: 11px; font-weight: bold; line-height: 1.7;
  padding: 1px 9px; border-radius: 999px; border: 1px solid transparent; font-family: inherit;
}
.tour-status.is-open { background: #e3f2fd; color: #0d47a1; border-color: #90caf9; }
.tour-status.is-live { background: #e8f5e9; color: #1b5e20; border-color: #a5d6a7; }
.tour-status.is-done { background: #f1f3f4; color: #5f6368; border-color: #dadce0; }
.tour-status.is-none { background: #fff8e1; color: #a65f00; border-color: #ffe082; }
button.tour-status.is-editable { cursor: pointer; width: auto !important; }
button.tour-status.is-editable:active { transform: translateY(1px); }
html[data-theme="poster"] .home-title { color: #ece0cd; }
html[data-theme="poster"] .home-subtitle { color: #a2937b; }
html[data-theme="poster"] .tour-status.is-open { background: rgba(37,63,88,0.6); color: #8ec5f0; border-color: rgba(142,197,240,0.4); }
html[data-theme="poster"] .tour-status.is-live { background: rgba(34,63,42,0.7); color: #8fdca0; border-color: rgba(143,220,160,0.4); }
html[data-theme="poster"] .tour-status.is-done { background: rgba(255,255,255,0.06); color: #b0a288; border-color: rgba(255,255,255,0.16); }
html[data-theme="poster"] .tour-status.is-none { background: rgba(74,46,18,0.6); color: #ffc47a; border-color: rgba(255,176,96,0.4); }

/* ▼ 決勝足切り（チップ入力 → 順位 → 確認モーダル） ▼ */
.co-head { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 8px; }
.co-count { font-size: 12px; color: #888; }
.co-row, .co-rank {
  display: flex; align-items: center; gap: 10px;
  background: #fff; border: 1px solid #e8e8e8; border-radius: 12px; padding: 10px 12px; margin-bottom: 8px;
  box-shadow: 0 2px 6px rgba(0,0,0,0.04);
}
.co-row.is-filled { border-color: #90caf9; }
.co-id { flex: 0 0 auto; font-weight: bold; font-size: 13px; background: #eef2f7; color: #334155; padding: 2px 8px; border-radius: 6px; }
.co-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: bold; }
.co-row input.form-item { width: 120px; flex: 0 0 auto; margin: 0; text-align: right; font-size: 18px; font-weight: bold; }
.co-pos { flex: 0 0 34px; font-size: 22px; font-weight: 800; text-align: center; color: #555; line-height: 1; }
.co-chips { flex: 0 0 auto; font-size: 17px; font-weight: 800; }
.co-rank.is-out { background: #fff5f5; border-color: #ffcdd2; }
.co-rank.is-out .co-pos { color: #c62828; }
.co-rank.is-tie { background: #fff8e1; border-color: #ffb300; }
.co-tie-tag { font-size: 10px; font-weight: bold; background: #ffb300; color: #fff; border-radius: 4px; padding: 1px 5px; margin-left: 6px; vertical-align: middle; }
.co-move { display: flex; flex-direction: column; gap: 3px; flex: 0 0 auto; }
.co-move button { width: auto !important; padding: 2px 9px; font-size: 11px; line-height: 1.4; border: 1px solid #ddd; background: #f5f5f5; border-radius: 6px; color: #555; cursor: pointer; }
.co-move button:disabled { opacity: 0.3; cursor: default; }
.co-divider { text-align: center; font-size: 12px; font-weight: bold; color: #2e7d32; border-top: 2px dashed #2e7d32; margin: 10px 0 8px; padding-top: 4px; }
/* 同点確認: 自作チェックボックス(.check-card)を流用し、未確認=黄色 / 確認済み=緑 */
.co-ack { margin-top: 10px; padding: 10px 12px; font-size: 13px; font-weight: bold; background: #fff8e1; border-color: #ffb300; color: #a65f00; }
.co-ack.is-on { background: #e8f5e9; border-color: #66bb6a; color: #1b5e20; }
.co-ack.is-on input[type="checkbox"]:checked { background: #43a047; border-color: #43a047; }
/* 前回の入力（この端末に記憶。開き直したときに見返せる） */
.co-prev { margin-bottom: 14px; padding: 10px 12px; border-radius: 12px; background: #f4f5f7; border: 1px solid #e0e2e6; }
.co-prev .co-prev-title { display: flex; justify-content: space-between; align-items: baseline; font-size: 13px; font-weight: bold; color: #555; margin-bottom: 8px; }
.co-prev .co-prev-title small { font-weight: normal; color: #888; }
.co-prev .co-rank { padding: 6px 10px; margin-bottom: 5px; box-shadow: none; }
.co-prev .co-pos { font-size: 16px; flex-basis: 26px; }
.co-prev .co-chips { font-size: 14px; }
html[data-theme="poster"] .co-prev { background: rgba(255,255,255,0.04); border-color: rgba(232,198,106,0.16); }
html[data-theme="poster"] .co-prev .co-prev-title { color: #d0c2a6; }
html[data-theme="poster"] .co-prev .co-prev-title small { color: #b0a288; }
html[data-theme="poster"] .co-ack.is-on { background: rgba(46,125,50,0.35); border-color: rgba(116,201,138,0.6); color: #9be0ad; }
#cutoffModal .rq-card { max-width: 420px; }
#cutoffModal .co-rank { padding: 8px 10px; margin-bottom: 6px; }
html[data-theme="poster"] .co-row, html[data-theme="poster"] .co-rank {
  background: rgba(26,17,11,0.72); border-color: rgba(232,198,106,0.16); color: #ece0cd; box-shadow: 0 4px 14px rgba(0,0,0,0.3);
}
html[data-theme="poster"] .co-row.is-filled { border-color: rgba(109,179,232,0.6); }
html[data-theme="poster"] .co-id { background: rgba(255,255,255,0.08); color: #d0c2a6; }
html[data-theme="poster"] .co-count { color: #b0a288; }
html[data-theme="poster"] .co-pos { color: #c8ba9c; }
html[data-theme="poster"] .co-rank.is-out { background: rgba(120,30,30,0.35); border-color: rgba(255,120,120,0.45); }
html[data-theme="poster"] .co-rank.is-out .co-pos { color: #ff8a80; }
html[data-theme="poster"] .co-rank.is-tie { background: rgba(120,80,0,0.35); border-color: rgba(255,179,0,0.6); }
html[data-theme="poster"] .co-move button { background: rgba(255,255,255,0.06); border-color: rgba(232,198,106,0.25); color: #d0c2a6; }
html[data-theme="poster"] .co-divider { color: #74c98a; border-top-color: #74c98a; }
html[data-theme="poster"] .co-ack { background: rgba(120,80,0,0.35); border-color: rgba(255,179,0,0.5); color: #ffc47a; }
/* 入力合計と場のチップ総数の突き合わせ（ズレていれば打ち間違いに気づける） */
.co-totals { display: flex; justify-content: space-between; align-items: center; gap: 8px; font-size: 13px; padding: 8px 12px; border-radius: 8px; background: #f0f7ff; border: 1px solid #bbdefb; color: #1565c0; margin-top: 2px; }
.co-totals b { font-size: 15px; }
.co-totals.is-diff { background: #fff8e1; border-color: #ffe082; color: #a65f00; }
html[data-theme="poster"] .co-totals { background: rgba(37,63,88,0.45); border-color: rgba(142,197,240,0.45); color: #8ec5f0; }
html[data-theme="poster"] .co-totals.is-diff { background: rgba(120,80,0,0.35); border-color: rgba(255,179,0,0.5); color: #ffc47a; }

/* ▼ 顧客管理（管理者）: 一覧の行・バッジ・統合の確認 ▼ */
.cm-row { display: flex; align-items: center; gap: 10px; background: #fff; border: 1px solid #e8e8e8; border-radius: 12px; padding: 10px 12px; margin-bottom: 8px; cursor: pointer; box-shadow: 0 2px 6px rgba(0,0,0,0.04); }
.cm-row:active { border-color: #1a73e8; background: #f8faff; }
.cm-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.cm-name { font-weight: bold; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cm-note { font-size: 12px; color: #6b7280; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cm-badges { flex: 0 0 auto; display: flex; gap: 4px; }
.cm-badge { font-size: 10.5px; font-weight: bold; padding: 2px 7px; border-radius: 999px; white-space: nowrap; }
.cm-unreg { background: #fff3e0; color: #b45309; border: 1px solid #ffcc80; }
.cm-line { background: #e6f9ee; color: #067d3c; border: 1px solid #a7e6c1; }
.cm-mail { background: #e8f0fe; color: #1a56b8; border: 1px solid #b6ccf5; }
.cm-merge { font-size: 13px; line-height: 1.8; padding: 10px 12px; border-radius: 8px; background: #f4f5f7; border: 1px solid #e0e2e6; }
html[data-theme="poster"] .cm-row { background: rgba(26,17,11,0.72); border-color: rgba(232,198,106,0.16); color: #ece0cd; box-shadow: 0 4px 14px rgba(0,0,0,0.3); }
html[data-theme="poster"] .cm-row:active { border-color: #ff8a3d; background: rgba(40,26,16,0.85); }
html[data-theme="poster"] .cm-note { color: #b0a288; }
html[data-theme="poster"] .cm-unreg { background: rgba(120,80,0,0.35); color: #ffc47a; border-color: rgba(255,179,0,0.5); }
html[data-theme="poster"] .cm-line { background: rgba(46,125,50,0.3); color: #9be0ad; border-color: rgba(116,201,138,0.5); }
html[data-theme="poster"] .cm-mail { background: rgba(37,63,88,0.5); color: #8ec5f0; border-color: rgba(142,197,240,0.45); }
html[data-theme="poster"] .cm-merge { background: rgba(255,255,255,0.05); border-color: rgba(255,255,255,0.12); color: #e6dac2; }
.cm-off { background: #eceff1; color: #546e7a; border: 1px solid #cfd8dc; }
html[data-theme="poster"] .cm-off { background: rgba(255,255,255,0.08); color: #b0a288; border-color: rgba(255,255,255,0.2); }

/* ▼ マスタ編集ダイアログ（項目が多いので小さめの入力欄＋トグル） ▼ */
.medit-label { font-size: 12px; font-weight: 700; color: #5f6368; margin-top: 14px; }
.medit-hint { font-size: 11px; color: #9aa0a6; margin: 2px 0 4px; line-height: 1.4; }
.medit-item {
  display: flex; align-items: center; width: 100%; height: 42px; padding: 0 12px; margin-top: 4px;
  background: #fff; border: 1px solid #dadce0; border-radius: 8px;
  font-size: 14px; font-weight: 600; color: #333;
}
input.medit-item { cursor: text; background-image: none; }
select.medit-item {
  background-image: url("data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIxMCIgaGVpZ2h0PSIxMCIgdmlld0JveD0iMCAwIDEwIDEwIj48cGF0aCBmaWxsPSIjMzMzIiBkPSZNNSA4bDQtNEgxTDUgOHoiLz48L3N2Zz4=");
  background-repeat: no-repeat; background-position: right 12px center; padding-right: 34px; cursor: pointer;
}
input.medit-item:focus, select.medit-item:focus { border: 1px solid #1a73e8; box-shadow: 0 0 0 3px rgba(26,115,232,0.15); }
.medit-switch { display: flex; align-items: center; gap: 10px; margin-top: 6px; cursor: pointer; }
.medit-switch input[type="checkbox"] {
  appearance: none; -webkit-appearance: none; position: relative; flex-shrink: 0;
  width: 48px !important; height: 28px; border-radius: 999px; background: #c8ccd0;
  border: none; cursor: pointer; transition: background 0.15s ease;
}
.medit-switch input[type="checkbox"]::after {
  content: ""; position: absolute; top: 3px; left: 3px; width: 22px; height: 22px;
  border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,0.3); transition: transform 0.15s ease;
}
.medit-switch input[type="checkbox"]:checked { background: #1a73e8; }
.medit-switch input[type="checkbox"]:checked::after { transform: translateX(20px); }
.medit-switch .medit-sw-text { font-size: 14px; font-weight: 700; color: #333; }

/* ダイアログの文字は選択できないようにする（ラベルやスイッチを押したときに反転しない）。
   入力欄の中だけは今までどおり選択・編集できる */
#masterEditOverlay { -webkit-user-select: none; user-select: none; -webkit-tap-highlight-color: transparent; }
#masterEditOverlay input, #masterEditOverlay select, #masterEditOverlay textarea {
  -webkit-user-select: text; user-select: text;
}
#masterEditOverlay input[type="checkbox"] { -webkit-user-select: none; user-select: none; }

/* ▼ 管理者メニューの中だけのPC表示 ▼
   body.pc-admin は app.js の _watchAdminLayout が、管理者メニュー系の画面
   （section-admin / admin-poster / create-tournament / master / customers / tourlist）が見えている間だけ付ける。
   大会運営の画面（TOP・HOME・エントリー等）はスマホ幅(600px)のまま */
@media (min-width: 900px) {
  body.pc-admin .app-container { max-width: 1100px; }

  /* 管理者メニュー・ポスターの入口ボタンを2列に */
  body.pc-admin #section-admin .form-stack,
  body.pc-admin #section-admin-poster .form-stack { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; align-items: stretch; }
  body.pc-admin #section-admin .home-btn,
  body.pc-admin #section-admin-poster .home-btn { grid-column: auto; margin-top: 0 !important; height: 96px; }
  body.pc-admin #section-admin .list-back,
  body.pc-admin #section-admin-poster .list-back { grid-column: 1 / -1; margin-top: 4px !important; }

  /* 入力欄はPC向けに少し低く（スマホの指用の70pxは大きすぎる） */
  body.pc-admin .form-item { height: 52px; font-size: 16px; }

  /* 新規作成フォームは1列のまま、読みやすい幅に寄せる */
  body.pc-admin #section-create-tournament .form-stack { max-width: 760px; margin-left: auto; margin-right: auto; }

  /* トーナメント一覧の大会カード・顧客一覧を2列に */
  body.pc-admin #tourListWrap > div { display: grid !important; grid-template-columns: 1fr 1fr; gap: 10px; align-items: start; }
  body.pc-admin #customerListWrap { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; align-items: start; }
  body.pc-admin #customerListWrap .cm-row { margin-bottom: 0; }

  /* 編集ダイアログ（マスタ・トーナメント一覧）は広く、項目は2列に */
  body.pc-admin .admin-dialog { max-width: 820px !important; }
  body.pc-admin .medit-fields { display: grid; grid-template-columns: 1fr 1fr; column-gap: 20px; }
  body.pc-admin .rq-card { max-width: 560px; }
}

/* HOME の前レート表示トグル（ディスプレイに「現レート｜前レート」を並べる）。大会設定・レート変更モーダルの同名トグルと連動 */
.home-prev-rate {
  width: auto; min-width: 84px; padding: 0 12px;
  font-size: 12px; font-weight: bold; line-height: 1.35; font-family: inherit;
  color: #a65f00; border-color: #f59e0b; background: #fff8e1;
}
.home-prev-rate.is-on { background: #f59e0b; border-color: #f59e0b; color: #fff; }
html[data-theme="poster"] .home-prev-rate { background: rgba(74,46,18,0.6); border-color: rgba(255,176,96,0.45); color: #ffc47a; }
html[data-theme="poster"] .home-prev-rate.is-on { background: rgba(255,176,96,0.85); border-color: rgba(255,176,96,0.9); color: #2b1a0a; }
