/* CROWS スコア管理システム 共通スタイル */
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: "Hiragino Kaku Gothic ProN", "Yu Gothic", Meiryo, system-ui, sans-serif;
  font-size: 15px;
  line-height: 1.6;
  color: #1f2430;
  background: #f2f4f7;
}
a { color: #1d4ed8; }
h1 { font-size: 1.35rem; margin: 1rem 0 .6rem; }
h2 { font-size: 1.05rem; margin: 0 0 .6rem; border-left: 4px solid #f0b429; padding-left: .5rem; }
hr { border: none; border-top: 1px solid #e5e7eb; margin: 1rem 0; }
.wrap { max-width: 1080px; margin: 0 auto; padding: 0 12px; }
.small { font-size: .85em; }
.nowrap { white-space: nowrap; }

/* ---- ヘッダー ---- */
.site-header {
  background: #171a21;
  color: #fff;
}
.site-header .wrap {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 16px;
  padding-top: 10px;
  padding-bottom: 8px;
}
.brand {
  color: #f0b429;
  font-weight: bold;
  font-size: 1.15rem;
  text-decoration: none;
}
.main-nav { display: flex; flex-wrap: wrap; gap: 2px; }
.main-nav a {
  color: #cbd2e0;
  text-decoration: none;
  padding: 6px 10px;
  border-radius: 6px;
  font-size: .92rem;
}
.main-nav a:hover { background: #2a2f3a; color: #fff; }
.main-nav a.active { background: #f0b429; color: #171a21; font-weight: bold; }
.main-nav a.nav-admin { border: 1px solid #4b5563; margin-left: 8px; }

.admin-nav { background: #2a2f3a; }
.admin-nav .wrap {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 2px;
  padding-top: 6px;
  padding-bottom: 6px;
}
.admin-nav a {
  color: #cbd2e0;
  text-decoration: none;
  padding: 4px 10px;
  border-radius: 6px;
  font-size: .88rem;
}
.admin-nav a:hover { background: #3d4450; color: #fff; }
.admin-nav a.active { background: #4c5568; color: #fff; font-weight: bold; }
.admin-user { margin-left: auto; color: #9aa3b5; font-size: .85rem; }
.admin-user a { color: #cbd2e0; }

main.wrap { padding-top: 8px; padding-bottom: 32px; }
.site-footer {
  background: #171a21;
  color: #8b93a5;
  font-size: .8rem;
  padding: 14px 0;
  text-align: center;
}

/* ---- カード ---- */
.card {
  background: #fff;
  border-radius: 10px;
  box-shadow: 0 1px 3px rgba(16, 24, 40, .08);
  padding: 14px 16px;
  margin: 12px 0;
}
.cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 12px;
  margin: 12px 0;
}
.cards .card { margin: 0; }
.stat-card { text-align: center; }
.stat-label { color: #6b7280; font-size: .85rem; }
.stat-value { font-size: 1.7rem; font-weight: bold; margin: 2px 0; }
.stat-sub { color: #6b7280; font-size: .82rem; }
.link-card { text-decoration: none; color: inherit; display: block; }
.link-card:hover { box-shadow: 0 3px 8px rgba(16, 24, 40, .15); }
.grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}
@media (max-width: 760px) { .grid-2 { grid-template-columns: 1fr; } }

/* ---- テーブル ---- */
.table { border-collapse: collapse; width: 100%; font-size: .9rem; }
.table th, .table td {
  border-bottom: 1px solid #e7eaf0;
  padding: 6px 8px;
  text-align: left;
  white-space: nowrap;
}
.table th { background: #f6f7f9; color: #4b5563; font-weight: 600; font-size: .82rem; }
.table td.num { text-align: right; font-variant-numeric: tabular-nums; }
.table .total-row td { background: #fdf6e3; font-weight: bold; }
.table-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.table .sticky-col { position: sticky; left: 0; background: #fff; }
.actions { white-space: nowrap; }

/* ---- バッジ ---- */
.badge {
  display: inline-block;
  padding: 1px 8px;
  border-radius: 999px;
  font-size: .78rem;
  font-weight: bold;
}
.badge-w { background: #dbeafe; color: #1d4ed8; }
.badge-l { background: #fee2e2; color: #dc2626; }
.badge-d, .badge-n { background: #e5e7eb; color: #4b5563; }
.badge-live { background: #dc2626; color: #fff; }
.badge-final { background: #d1fae5; color: #047857; }
.text-win { color: #1d4ed8; font-weight: bold; }
.text-lose { color: #dc2626; font-weight: bold; }
.text-muted { color: #6b7280; }
.text-warn { color: #b45309; }
.text-danger { color: #dc2626; }

/* ---- ランキング ---- */
.rank-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 12px;
}
.rank-grid .card { margin: 0; }
.rank-block.rank-best h2 { border-left-color: #2563eb; }
.rank-block.rank-worst h2 { border-left-color: #dc2626; }
.rank {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  font-weight: bold;
  font-size: .82rem;
}
.rank-1 { background: #fde68a; color: #92400e; }   /* 金 */
.rank-2 { background: #e5e7eb; color: #374151; }   /* 銀 */
.rank-3 { background: #fed7aa; color: #9a3412; }   /* 銅 */

/* ---- 選手アバター（写真／頭文字） ---- */
.avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  object-fit: cover;
  vertical-align: middle;
  background: #e2e8f0;
  flex: none;
}
.avatar-txt {
  color: #475569;
  font-size: .72rem;
  font-weight: bold;
}
.avatar-lg { width: 44px; height: 44px; }
.avatar-lg.avatar-txt { font-size: 1.05rem; }
.rank-name { white-space: nowrap; }

/* ---- フォーム ---- */
label { display: block; margin: 8px 0; font-size: .92rem; }
label.check { display: flex; align-items: center; gap: 6px; }
input[type="text"], input[type="password"], input[type="date"],
input[type="number"], select, textarea {
  font-size: 16px; /* スマホでの自動ズーム防止 */
  padding: 7px 9px;
  border: 1px solid #cbd2e0;
  border-radius: 8px;
  background: #fff;
  width: 100%;
  max-width: 420px;
}
input.in-num { width: 4.2em; min-width: 3.6em; padding: 6px 4px; text-align: right; }
.form-row { display: flex; flex-wrap: wrap; gap: 4px 16px; align-items: flex-end; }
.form-row label { flex: 0 1 auto; }
.form-row input, .form-row select { width: auto; }
.input-table td, .input-table th { padding: 3px 4px; }
form.inline { display: inline; }

.btn {
  display: inline-block;
  padding: 8px 14px;
  border: 1px solid #cbd2e0;
  border-radius: 8px;
  background: #fff;
  color: #1f2430;
  font-size: .92rem;
  cursor: pointer;
  text-decoration: none;
}
.btn:hover { background: #f3f4f6; }
.btn-primary { background: #1d4ed8; border-color: #1d4ed8; color: #fff; font-weight: bold; }
.btn-primary:hover { background: #1e40af; }
.btn-danger { background: #fff; border-color: #fca5a5; color: #dc2626; }
.btn-danger:hover { background: #fef2f2; }
.btn-sm { padding: 3px 9px; font-size: .82rem; }

/* ---- 通知 ---- */
.flash {
  padding: 10px 14px;
  border-radius: 8px;
  margin: 10px 0;
  font-size: .92rem;
}
.flash-ok { background: #d1fae5; color: #065f46; }
.flash-err { background: #fee2e2; color: #991b1b; }
.flash-info { background: #dbeafe; color: #1e40af; }

/* ---- 試合速報・ライブ入力 ---- */
.live-banner {
  display: block;
  background: #dc2626;
  color: #fff;
  font-weight: bold;
  border-radius: 10px;
  padding: 10px 14px;
  margin: 10px 0;
  text-decoration: none;
}
.live-score { font-size: 1.3rem; text-align: center; margin: 4px 0; }
.live-inning { text-align: center; color: #4b5563; margin-bottom: 4px; }
.live-atk { color: #b45309; font-weight: bold; }
.out-dot {
  display: inline-block;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: #e5e7eb;
  margin: 0 2px;
  vertical-align: middle;
}
.out-dot.on { background: #dc2626; }

.diamond { position: relative; width: 230px; height: 120px; margin: 10px auto 2px; }
.base {
  position: absolute;
  width: 64px;
  height: 34px;
  border-radius: 8px;
  background: #eef1f5;
  border: 2px solid #d3d9e3;
  font-size: .72rem;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  color: #374151;
}
.base.on { background: #fde68a; border-color: #d97706; font-weight: bold; }
.base.b2 { top: 0; left: 50%; transform: translateX(-50%); }
.base.b1 { top: 44px; right: 0; }
.base.b3 { top: 44px; left: 0; }
.base.home { width: 26px; height: 26px; bottom: 0; left: 50%; transform: translateX(-50%); border-radius: 50%; }

.btn-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(96px, 1fr));
  gap: 8px;
  margin: 10px 0;
}
.btn-result { min-height: 46px; font-weight: bold; }
.runner-actions { margin-top: 6px; color: #4b5563; }
.live-utils { display: flex; flex-wrap: wrap; gap: 8px; }
.ent-row { padding: 6px 0; border-bottom: 1px dashed #e5e7eb; }
.btn-dest { min-width: 8.5em; font-weight: bold; background: #eff6ff; border-color: #93c5fd; }
.lu-btns { float: right; display: inline-flex; gap: 4px; }
.linescore th, .linescore td { text-align: center; }
.linescore th:first-child, .linescore td:first-child { text-align: left; }
.in-score { width: 3.2em; }
.feed { list-style: none; margin: 0; padding: 0; font-size: .9rem; }
.feed li { padding: 4px 0; border-bottom: 1px dashed #e7eaf0; }
.live-title { font-size: 1.1rem; }

@media (max-width: 560px) {
  body { font-size: 14px; }
  .table { font-size: .82rem; }
  .card { padding: 10px 10px; }
}
