/* ── Basketball Data Service – Styles ── */

:root {
  --bg: #0f1117;
  --bg-card: #1a1d27;
  --bg-input: #242836;
  --border: #2e3345;
  --text: #e8eaed;
  --text-muted: #8b92a5;
  --primary: #f97316;
  --primary-hover: #ea580c;
  --success: #22c55e;
  --danger: #ef4444;
  --warning: #eab308;
  --radius: 10px;
  --shadow: 0 4px 24px rgba(0,0,0,.35);
  --font: 'Segoe UI', system-ui, -apple-system, sans-serif;
}

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  line-height: 1.6;
}

a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ── Layout ── */

.app-header {
  background: var(--bg-card);
  border-bottom: 1px solid var(--border);
  padding: 0 2rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 60px;
  position: sticky;
  top: 0;
  z-index: 100;
}

.logo {
  display: flex;
  align-items: center;
  gap: .6rem;
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--text);
  text-decoration: none;
}

.logo-icon {
  width: 32px;
  height: 32px;
  background: var(--primary);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
}

.nav-links {
  display: flex;
  gap: .25rem;
  list-style: none;
}

.nav-links a {
  display: inline-flex;
  align-items: center;
  color: var(--text-muted);
  padding: .45rem 1rem;
  border-radius: 8px;
  font-size: .9rem;
  font-weight: 500;
  line-height: 1.2;
  white-space: nowrap;
  transition: all .2s;
  text-decoration: none;
}

.nav-links a:hover,
.nav-links a.active {
  color: var(--text);
  background: var(--bg-input);
  text-decoration: none;
}

.nav-links a.active {
  color: var(--primary);
}

.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 2rem;
}

.page-title {
  font-size: 1.6rem;
  font-weight: 700;
  margin-bottom: .25rem;
}

.page-subtitle {
  color: var(--text-muted);
  margin-bottom: 2rem;
  font-size: .95rem;
}

/* ── Cards ── */

.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
  margin-bottom: 1.5rem;
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.25rem;
}

.card-title {
  font-size: 1.05rem;
  font-weight: 600;
}

/* ── Stats Grid ── */

.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1rem;
  margin-bottom: 2rem;
}

.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
  text-align: center;
}

.stat-value {
  font-size: 2rem;
  font-weight: 700;
  color: var(--primary);
}

.stat-label {
  color: var(--text-muted);
  font-size: .85rem;
  margin-top: .25rem;
}

/* ── Forms ── */

.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1rem;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: .35rem;
}

.form-group label {
  font-size: .85rem;
  color: var(--text-muted);
  font-weight: 500;
}

.form-group input,
.form-group select,
.form-group textarea {
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: .55rem .75rem;
  color: var(--text);
  font-size: .9rem;
  font-family: inherit;
  transition: border-color .2s;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  outline: none;
  border-color: var(--primary);
}

.form-group input[type="color"] {
  height: 40px;
  padding: 4px;
  cursor: pointer;
}

.form-actions {
  display: flex;
  gap: .75rem;
  margin-top: 1.25rem;
}

/* ── Buttons ── */

.btn {
  display: inline-flex;
  align-items: center;
  gap: .4rem;
  padding: .5rem 1.1rem;
  border: none;
  border-radius: 8px;
  font-size: .9rem;
  font-weight: 500;
  cursor: pointer;
  transition: all .2s;
  font-family: inherit;
}

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

.btn-ghost {
  background: transparent;
  color: var(--text-muted);
  border: 1px solid var(--border);
}
.btn-ghost:hover { color: var(--text); border-color: var(--text-muted); }

.btn-danger {
  background: var(--danger);
  color: #fff;
}
.btn-danger:hover { opacity: .85; }

.btn-sm {
  padding: .3rem .7rem;
  font-size: .8rem;
}

.btn-icon {
  padding: .35rem;
  min-width: 32px;
  justify-content: center;
}

/* ── Tables ── */

.table-wrap {
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: .9rem;
}

thead th {
  text-align: left;
  padding: .65rem .75rem;
  color: var(--text-muted);
  font-weight: 500;
  font-size: .8rem;
  text-transform: uppercase;
  letter-spacing: .03em;
  border-bottom: 1px solid var(--border);
}

tbody td {
  padding: .65rem .75rem;
  border-bottom: 1px solid var(--border);
}

tbody tr:hover {
  background: rgba(255,255,255,.02);
}

.team-badge {
  display: inline-flex;
  align-items: center;
  gap: .4rem;
}

.team-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}

.team-logo {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
  display: block;
}
.team-logo-xs { width: 18px; height: 18px; }
.team-logo-sm { width: 24px; height: 24px; }
.team-logo-md { width: 32px; height: 32px; }
.team-logo-lg { width: 48px; height: 48px; }
.team-logo-xl { width: 64px; height: 64px; }

/* ── Tabs ── */

.tabs {
  display: flex;
  gap: .25rem;
  margin-bottom: 1.5rem;
  border-bottom: 1px solid var(--border);
  padding-bottom: 0;
}

.tab {
  padding: .6rem 1.2rem;
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: .9rem;
  font-weight: 500;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  transition: all .2s;
  font-family: inherit;
}

.tab:hover { color: var(--text); }
.tab.active {
  color: var(--primary);
  border-bottom-color: var(--primary);
}

.tab-panel { display: none; }
.tab-panel.active { display: block; }

/* ── Score Display ── */

.score-display {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1.5rem;
  padding: 1rem 0;
}

.score-team {
  text-align: center;
  flex: 1;
  min-width: 0;
}

.score-team-name {
  font-size: .9rem;
  color: var(--text-muted);
  margin-bottom: .25rem;
}

.score-number {
  font-size: 2.5rem;
  font-weight: 700;
}

.score-vs {
  font-size: 1rem;
  color: var(--text-muted);
  font-weight: 600;
}

.score-winner {
  color: var(--primary);
}

/* ── Game Card ── */

.game-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
  margin-bottom: 0;
  transition: border-color .2s;
  cursor: pointer;
}

.schedule-section + .schedule-section {
  margin-top: 2rem;
}
.schedule-section-title {
  display: flex;
  align-items: center;
  gap: .6rem;
  font-size: 1.05rem;
  font-weight: 700;
  margin-bottom: .85rem;
}
.schedule-section-title span {
  min-width: 1.5rem;
  padding: .05rem .45rem;
  border-radius: 999px;
  background: var(--bg-input);
  color: var(--text-muted);
  font-size: .75rem;
  text-align: center;
}
.schedule-empty {
  color: var(--text-muted);
  margin-bottom: .5rem;
}
.games-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1rem;
}
@media (max-width: 720px) {
  .games-grid { grid-template-columns: 1fr; }
}

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

.game-card-meta {
  display: flex;
  justify-content: space-between;
  font-size: .8rem;
  color: var(--text-muted);
  margin-bottom: .75rem;
}
.game-id-badge {
  display: inline-block;
  margin-right: .35rem;
  padding: .1rem .45rem;
  border-radius: 999px;
  background: rgba(249, 115, 22, .12);
  color: var(--primary);
  font-weight: 700;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

/* ── Player Stats Input ── */

.stats-table input {
  width: 60px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: .3rem .4rem;
  color: var(--text);
  font-size: .85rem;
  text-align: center;
  font-family: inherit;
}

.stats-table input:focus {
  outline: none;
  border-color: var(--primary);
}

/* ── Modal ── */

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.6);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}

.modal {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
  max-width: 420px;
  width: 90%;
  box-shadow: var(--shadow);
}

.modal p {
  margin-bottom: 1.25rem;
  font-size: .95rem;
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: .75rem;
}
.shot-choice p {
  text-align: center;
  font-size: 1.2rem;
  font-weight: 700;
}
.shot-choice-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: .75rem;
}
.shot-make,
.shot-miss {
  min-height: 4.25rem;
  font-size: 1.45rem;
}
.shot-make {
  border-color: #16a34a;
  background: rgba(22, 163, 74, .16);
  color: #4ade80;
}
.shot-miss {
  border-color: #dc2626;
  background: rgba(220, 38, 38, .12);
  color: #f87171;
}

/* ── Toast ── */

.toast {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  padding: .75rem 1.25rem;
  border-radius: 8px;
  font-size: .9rem;
  font-weight: 500;
  z-index: 2000;
  opacity: 0;
  transform: translateY(10px);
  transition: all .3s;
}

.toast.show {
  opacity: 1;
  transform: translateY(0);
}

.toast-success { background: var(--success); color: #fff; }
.toast-error { background: var(--danger); color: #fff; }

/* ── Empty State ── */

.empty-state {
  text-align: center;
  padding: 3rem 1rem;
  color: var(--text-muted);
}

.empty-state-icon {
  font-size: 2.5rem;
  margin-bottom: .75rem;
}

/* ── Filter Bar ── */

.filter-bar {
  display: flex;
  gap: 1rem;
  align-items: center;
  margin-bottom: 1.5rem;
  flex-wrap: wrap;
}

.filter-bar select {
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: .45rem .75rem;
  color: var(--text);
  font-size: .9rem;
  font-family: inherit;
}

/* ── Hero (Home) ── */

.hero {
  text-align: center;
  padding: 3rem 1rem 2rem;
}

.hero h1 {
  font-size: 2.2rem;
  font-weight: 800;
  margin-bottom: .5rem;
  background: linear-gradient(135deg, var(--primary), #fbbf24);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.hero p {
  color: var(--text-muted);
  font-size: 1.05rem;
  max-width: 500px;
  margin: 0 auto 2.5rem;
}

.feature-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1.25rem;
  margin-top: 1rem;
}

.feature-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.75rem;
  text-align: left;
  transition: all .25s;
  cursor: pointer;
  text-decoration: none;
  color: inherit;
  display: block;
}

.feature-card:hover {
  border-color: var(--primary);
  transform: translateY(-2px);
  box-shadow: var(--shadow);
  text-decoration: none;
}

.feature-icon {
  font-size: 1.8rem;
  margin-bottom: .75rem;
}

.feature-card h3 {
  font-size: 1.1rem;
  margin-bottom: .4rem;
}

.feature-card p {
  color: var(--text-muted);
  font-size: .88rem;
  line-height: 1.5;
}

/* ── Responsive ── */

@media (max-width: 640px) {
  .app-header:not(.stat-edit-header) {
    height: 52px;
    flex-wrap: nowrap;
    align-items: center;
    padding: 0 .5rem;
    gap: .25rem;
  }
  .app-header:not(.stat-edit-header) nav { flex: 1 1 auto; min-width: 0; }
  .app-header:not(.stat-edit-header) .logo {
    font-size: .95rem;
    gap: .35rem;
    flex-shrink: 0;
  }
  .app-header:not(.stat-edit-header) .logo-icon {
    width: 24px;
    height: 24px;
    font-size: .9rem;
  }
  .nav-links { justify-content: flex-end; flex-wrap: nowrap; gap: 0; }
  .nav-links a { padding: .35rem .28rem; font-size: .78rem; }
  .container { padding: 1.25rem; }
  .score-number { font-size: 1.8rem; }
}

/* ── Boxscore (虎扑风格) ── */

.game-status {
  display: inline-block;
  padding: .2rem .55rem;
  border-radius: 4px;
  font-size: .75rem;
  font-weight: 600;
}
.status-scheduled { background: #374151; color: #9ca3af; }
.status-live { background: #dc2626; color: #fff; animation: pulse 2s infinite; }
.status-done { background: #166534; color: #86efac; }

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: .7; }
}

.game-card-live { border-color: #dc2626; }
.game-card-active { border-color: var(--primary); box-shadow: 0 0 0 1px var(--primary); }

.boxscore-panel { margin-top: .5rem; }
.boxscore-toolbar {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1.25rem;
  flex-wrap: wrap;
}
.boxscore-toolbar .card-title { flex: 1; margin: 0; }

.boxscore-header { margin-bottom: 1rem; }
.boxscore-scoreline {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1.25rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 1rem;
}
.bs-team {
  display: flex;
  align-items: center;
  gap: .75rem;
  flex: 1;
}
.bs-team.away { justify-content: flex-start; }
.bs-team.home { justify-content: flex-end; }
.bs-team-identity {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: .2rem;
  text-align: center;
  max-width: 6rem;
}
.boxscore-header.readonly .bs-team { gap: .45rem; }
.boxscore-header.readonly .bs-team-identity .team-logo {
  width: 32px;
  height: 32px;
}
.boxscore-header.readonly .bs-team-name { font-size: .8rem; }
.boxscore-header.readonly .bs-big-score { font-size: 1.45rem; }
.bs-team-name { font-weight: 600; font-size: .95rem; line-height: 1.25; }
.bs-big-score { font-size: 2.2rem; font-weight: 800; color: var(--primary); }
.bs-role { font-size: .75rem; color: var(--text-muted); }
.bs-mid { text-align: center; }
.bs-datetime { color: var(--text-muted); font-size: .9rem; margin-top: .35rem; }
.bs-extra { color: var(--text-muted); font-size: .8rem; }

.quarter-table {
  width: 100%;
  border-collapse: collapse;
  font-size: .9rem;
}
.quarter-table th, .quarter-table td {
  padding: .5rem .75rem;
  text-align: center;
  border-bottom: 1px solid var(--border);
}
.quarter-table th:first-child, .quarter-table td:first-child { text-align: left; }

.boxscore-team { margin-top: 1.5rem; }
.boxscore-team-title {
  display: flex;
  align-items: center;
  gap: .5rem;
  margin-bottom: .75rem;
  font-size: 1.05rem;
}

.boxscore-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-size: .82rem;
  white-space: nowrap;
  min-width: 760px;
}
.boxscore-table th {
  padding: .28rem .22rem;
  color: var(--text-muted);
  font-weight: 500;
  font-size: .75rem;
  border-bottom: 1px solid var(--border);
  text-align: center;
}
.boxscore-table th:first-child { text-align: left; }
.boxscore-table td {
  padding: .22rem .18rem;
  border-bottom: 1px solid var(--border);
  text-align: center;
}
.boxscore-table .col-player {
  text-align: left;
  max-width: 150px;
}
.boxscore-table .col-pts { color: var(--primary); }

/* 球员列横向滚动时固定（同选秀页） */
.boxscore-table th:first-child,
.boxscore-table td.col-player {
  position: sticky;
  left: 0;
  z-index: 2;
  background: var(--bg-card);
  box-shadow: 2px 0 8px rgba(0, 0, 0, .28);
}
.boxscore-table thead th:first-child {
  z-index: 3;
}
.boxscore-table th:first-child {
  min-width: 92px;
  padding-left: .45rem;
}
.boxscore-table .col-player {
  min-width: 92px;
  padding-left: .45rem;
  padding-right: .3rem;
}
.boxscore-table .player-pos {
  margin-left: .35rem;
  font-size: .78rem;
  color: var(--text-muted);
  font-weight: 500;
}
.boxscore-table .row-starter .col-player { background: #1c1f28; }
.boxscore-table .row-bench .col-player { background: var(--bg-card); }
.boxscore-table .section-row .col-player {
  z-index: 2;
  background: #211c18;
}
.boxscore-table .total-row .col-player {
  background: #1e212b;
  font-weight: 600;
}
.boxscore-table .pct-row .col-player {
  background: var(--bg-card);
  color: var(--text-muted);
  font-size: .8rem;
}
.boxscore-team {
  max-width: 100%;
  min-width: 0;
}
.boxscore-team .table-wrap {
  max-width: 100%;
  overflow-x: auto;
  overflow-y: hidden;
  overscroll-behavior-x: contain;
  -webkit-overflow-scrolling: touch;
  touch-action: pan-x pan-y;
}

.boxscore-table .section-row td {
  background: rgba(249, 115, 22, .08);
  color: var(--primary);
  font-weight: 600;
  font-size: .8rem;
  text-align: left !important;
  padding: .45rem .75rem !important;
}
.boxscore-table .section-row .col-player {
  background: #211c18;
}
.total-row td { font-weight: 600; background: rgba(255,255,255,.03); }
.pct-row td { color: var(--text-muted); font-size: .8rem; }
.row-starter td { background: rgba(255,255,255,.01); }

.bs-input {
  width: 42px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: .2rem .25rem;
  color: var(--text);
  font-size: .8rem;
  text-align: center;
  font-family: inherit;
}
.bs-input:focus { outline: none; border-color: var(--primary); }
.bs-shoot { width: 32px; }
.shoot-cell { display: inline-flex; align-items: center; gap: 2px; }
.shoot-cell span { color: var(--text-muted); font-size: .75rem; }

.starter-check {
  display: flex;
  align-items: center;
  gap: .35rem;
  cursor: pointer;
  font-weight: 500;
}
.starter-check input { width: auto; }

/* ── Home Hub ── */

.home-hub {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: calc(100vh - 120px);
  padding: 2rem 0;
}
.home-title {
  font-size: 1.5rem;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 2.5rem;
}
.hub-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1.25rem;
  width: 100%;
  max-width: 720px;
}
.hub-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: .75rem;
  padding: 2rem 1rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  text-decoration: none;
  color: var(--text);
  transition: all .25s;
}
.hub-card:hover {
  border-color: var(--primary);
  transform: translateY(-3px);
  box-shadow: var(--shadow);
  color: var(--text);
  text-decoration: none;
}
.hub-icon { font-size: 2.2rem; }
.hub-label { font-size: 1.1rem; font-weight: 600; }

/* ── Breadcrumb ── */

.breadcrumb {
  font-size: .85rem;
  color: var(--text-muted);
  margin-bottom: 1rem;
}
.breadcrumb a { color: var(--text-muted); text-decoration: none; }
.breadcrumb a:hover { color: var(--primary); }

.page-header-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.5rem;
  flex-wrap: wrap;
}
.admin-bar {
  display: flex;
  align-items: center;
  gap: .5rem;
  flex-wrap: wrap;
  padding: .55rem 1rem;
  background: var(--bg-card);
  border-bottom: 1px solid var(--border);
}
.admin-bar a {
  padding: .35rem .7rem;
  border-radius: 999px;
  text-decoration: none;
  color: var(--text-muted);
  font-size: .85rem;
}
.admin-bar a.active {
  background: rgba(249, 115, 22, .14);
  color: var(--primary);
  font-weight: 600;
}
.admin-bar #btn-logout { margin-left: auto; }
.login-wrap { max-width: 28rem; }
.login-card { padding: 1.25rem; }

/* ── Team Cards ── */

.team-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 1rem;
}
.team-card {
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  transition: border-color .2s;
}
.team-card:hover { border-color: var(--primary); }
.team-card-link {
  display: flex;
  text-decoration: none;
  color: inherit;
}
.team-card-link:hover { text-decoration: none; color: inherit; }
.team-card-logo {
  width: 56px;
  height: 56px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: .5rem;
  background: rgba(255,255,255,.03);
}
.team-card-logo img {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  object-fit: cover;
}
.form-hint {
  font-size: .8rem;
  color: var(--text-muted);
  margin-top: .35rem;
}
.team-logo-preview {
  min-height: 48px;
  display: flex;
  align-items: center;
  margin-bottom: .5rem;
}
.logo-upload-actions {
  display: flex;
  gap: .5rem;
  flex-wrap: wrap;
  align-items: center;
}
.logo-file-btn {
  cursor: pointer;
  margin: 0;
}
.team-card-body { padding: 1rem; flex: 1; }
.team-card-body h3 { font-size: 1.05rem; margin-bottom: .25rem; }
.team-card-body p { font-size: .85rem; color: var(--text-muted); margin: 0; }
.team-card-actions {
  display: flex;
  gap: .5rem;
  padding: .5rem 1rem 1rem;
  border-top: 1px solid var(--border);
}

.team-header { margin-bottom: 1.5rem; }
.team-header-inner {
  display: flex;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
}
.team-header-dot {
  width: 48px;
  height: 48px;
  border-radius: 10px;
  flex-shrink: 0;
}

@media (max-width: 640px) {
  .hub-grid { grid-template-columns: repeat(2, 1fr); }
}

/* ── Draft Board ── */

.draft-board-wrap { overflow-x: auto; }
.draft-table {
  width: 100%;
  border-collapse: collapse;
  font-size: .82rem;
  min-width: 900px;
}
.draft-table th, .draft-table td {
  padding: .45rem .5rem;
  border: 1px solid var(--border);
  text-align: center;
}
.draft-table th:first-child, .draft-table td:first-child {
  text-align: left;
  min-width: 100px;
  position: sticky;
  left: 0;
  background: var(--bg-card);
  z-index: 1;
}
.draft-cell-yi { background: rgba(249, 115, 22, .12); }
.draft-cell-er { background: rgba(59, 130, 246, .1); }
.draft-legend {
  margin-top: .75rem;
  font-size: .85rem;
  color: var(--text-muted);
}
.draft-legend .legend {
  display: inline-block;
  padding: .1rem .4rem;
  border-radius: 3px;
}
.draft-cell-pick {
  cursor: pointer;
  transition: background .15s;
}
.draft-cell-pick:hover {
  filter: brightness(1.08);
  text-decoration: underline;
}
.draft-cell-empty {
  color: var(--text-muted);
}

/* ── 数据录入：左右球队，中间统计项 ── */

.entry-board {
  display: grid;
  grid-template-columns: 4.5rem minmax(0, 1fr) 4.5rem;
  gap: .4rem;
  align-items: start;
}
.entry-side,
.entry-stats {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: .45rem .35rem;
  min-width: 0;
}
.entry-side .stat-edit-btns {
  flex-direction: column;
  flex-wrap: nowrap;
  align-items: stretch;
}
.entry-side .tap-num {
  width: 100%;
  min-width: 0;
  min-height: 2.4rem;
  padding: .25rem .15rem;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
}
.entry-side-head {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: .05rem;
  margin-bottom: .4rem;
}
.entry-side-name {
  font-size: .68rem;
  line-height: 1.25;
  color: var(--text-muted);
  word-break: break-all;
}
.entry-side-score {
  font-size: 1.15rem;
  font-weight: 700;
  line-height: 1.1;
  color: var(--primary);
}
.entry-stats .entry-show-hidden {
  width: 100%;
  margin-top: .45rem;
}
.entry-feed {
  list-style: none;
  margin-top: .4rem;
  max-height: calc(1.4em * 4);
  overflow-y: auto;
  font-size: .72rem;
  line-height: 1.4;
}
.entry-feed li {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.entry-log {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: .65rem .75rem .4rem;
}
.entry-log-team + .entry-log-team {
  margin-top: .75rem;
  padding-top: .65rem;
  border-top: 1px solid var(--border);
}
.entry-log-team h3 {
  display: flex;
  align-items: center;
  gap: .35rem;
  font-size: .85rem;
  margin-bottom: .35rem;
}
.entry-log-team h3 small {
  margin-left: auto;
  color: var(--text-muted);
  font-weight: 500;
}
.entry-log-team ul {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: .35rem;
}
.entry-log-item {
  display: flex;
  flex-direction: column;
  gap: .1rem;
  padding: .35rem .45rem;
  border-radius: 8px;
  background: var(--bg-input);
}
.entry-log-item.active {
  box-shadow: inset 0 0 0 1px var(--primary);
}
.entry-log-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .4rem;
}
.entry-log-actions {
  display: flex;
  flex-shrink: 0;
  gap: .25rem;
}
.entry-log-form {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: .4rem .5rem;
  margin-top: .35rem;
}
.entry-log-form label {
  display: flex;
  flex-direction: column;
  gap: .15rem;
  font-size: .72rem;
  color: var(--text-muted);
}
.entry-log-form input {
  width: 100%;
  min-height: 2rem;
  padding: .2rem .35rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--bg);
  color: var(--text);
  font: inherit;
  font-size: .9rem;
}
.entry-log-shoot {
  display: flex;
  align-items: center;
  gap: .2rem;
}
.entry-log-form-actions {
  grid-column: 1 / -1;
  display: flex;
  justify-content: flex-end;
  gap: .35rem;
}
.entry-log-who {
  font-size: .85rem;
  font-weight: 600;
}
.entry-log-who b { color: var(--primary); margin-right: .15rem; }
.entry-log-stats {
  font-size: .78rem;
  line-height: 1.35;
  color: var(--text-muted);
}
.entry-side .tap-bench {
  opacity: .72;
}
.entry-side .tap-pick {
  border-color: var(--primary);
  color: var(--primary);
}
.team-sub-hint {
  font-size: .72rem;
  color: var(--primary);
  margin-top: .35rem;
  line-height: 1.3;
}
.team-sub-hint:empty {
  display: none;
}
.entry-side .team-sub-actions {
  display: flex;
  flex-direction: column;
  gap: .3rem;
  margin-top: .4rem;
}
.entry-side .team-sub-actions .btn {
  width: 100%;
  padding: .28rem .15rem;
}
#stat-attrs {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: .35rem;
}
#stat-attrs .tap-stat {
  width: 100%;
  min-width: 0;
  flex: none;
  padding: .35rem .15rem;
}
@media (min-width: 768px) {
  .entry-board {
    grid-template-columns: 6.2rem minmax(0, 1fr) 6.2rem;
    gap: .65rem;
  }
  #stat-attrs {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}

/* 触屏数据录入页 */
.stat-edit-body {
  background: var(--bg);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}
.stat-edit-header {
  display: flex;
  align-items: center;
  gap: .75rem;
  padding: .65rem 1rem;
  position: sticky;
  top: 0;
  z-index: 10;
  background: var(--bg-card);
  border-bottom: 1px solid var(--border);
}
.stat-edit-title {
  flex: 1;
  font-weight: 600;
  font-size: .95rem;
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.stat-edit-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  padding: .75rem;
  gap: .65rem;
  max-width: 1100px;
  margin: 0 auto;
  width: 100%;
}
.stat-edit-scorebar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .5rem;
  padding: .75rem 1rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}
.ses-team {
  display: flex;
  align-items: center;
  gap: .4rem;
  font-size: .85rem;
  flex: 1;
}
.ses-team.away { justify-content: flex-start; }
.ses-team.home { justify-content: flex-end; }
.ses-team strong { font-size: 1.6rem; color: var(--primary); }
.ses-vs { color: var(--text-muted); font-size: .75rem; font-weight: 600; }
.stat-edit-hint {
  text-align: center;
  font-size: .9rem;
  color: var(--text-muted);
  padding: .35rem;
}
.stat-edit-hint.active { color: var(--text); }
.stat-edit-hint.ready { color: var(--primary); font-weight: 600; }
.stat-edit-player-preview {
  background: rgba(249, 115, 22, .08);
  border: 1px solid rgba(249, 115, 22, .25);
  border-radius: var(--radius);
  padding: .6rem .85rem;
  min-height: 3rem;
}
.stat-edit-player-preview:empty { display: none; }
.preview-name { font-weight: 600; margin-bottom: .35rem; }
.preview-stats {
  display: flex;
  flex-wrap: wrap;
  gap: .35rem .75rem;
  font-size: .8rem;
  color: var(--text-muted);
}
.preview-stats b { color: var(--primary); }
.stat-edit-panel {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: .65rem;
}
.stat-edit-row {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: .55rem .65rem;
}
.stat-edit-row-label {
  font-size: .75rem;
  color: var(--text-muted);
  margin-bottom: .45rem;
  display: flex;
  align-items: center;
  gap: .35rem;
}
.stat-edit-btns {
  display: flex;
  flex-wrap: wrap;
  gap: .4rem;
}
.stat-edit-actions {
  display: flex;
  gap: .65rem;
  padding: .65rem !important;
}
.tap-btn {
  min-width: 3rem;
  min-height: 2.75rem;
  padding: .35rem .55rem;
  border: 2px solid var(--border);
  border-radius: 10px;
  background: var(--bg-input);
  color: var(--text);
  font-size: .95rem;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  touch-action: manipulation;
  user-select: none;
  transition: border-color .15s, background .15s, transform .1s;
}
.tap-btn:active { transform: scale(.96); }
.tap-num {
  min-width: 3.6rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  line-height: 1.1;
}
.tap-num small {
  font-size: .65rem;
  color: var(--primary);
  font-weight: 700;
}
.tap-num.active {
  border-color: var(--primary);
  background: rgba(249, 115, 22, .12);
  box-shadow: 0 0 0 1px var(--primary);
}
.tap-stat {
  flex: 1 1 calc(20% - .4rem);
  min-width: 3.5rem;
  font-size: .85rem;
}
.tap-stat.active {
  border-color: var(--primary);
  background: rgba(249, 115, 22, .15);
  color: var(--primary);
}
.tap-btn-sub {
  flex: 1;
  width: 100%;
  min-height: 3.5rem;
  font-size: 1.05rem;
}
.game-status-actions {
  display: flex;
  gap: .65rem;
}
.tap-btn-start,
.tap-btn-finish {
  flex: 1;
  min-height: 3.5rem;
  font-size: 1.05rem;
}
.tap-btn-start {
  border-color: #16a34a;
  background: rgba(22, 163, 74, .14);
  color: #4ade80;
}
.tap-btn-start:disabled,
.tap-btn-finish:disabled {
  opacity: .55;
  cursor: default;
}
.tap-btn-sub {
  border-color: #dc2626;
  background: rgba(220, 38, 38, .1);
  color: #f87171;
}
.tap-btn-sub:disabled {
  opacity: .45;
  cursor: default;
}
.tap-btn-finish {
  border-color: var(--primary);
  background: rgba(249, 115, 22, .16);
  color: var(--primary);
}
@media (max-width: 480px) {
  .stat-edit-title { font-size: .85rem; }
  #stat-attrs .tap-stat { font-size: .75rem; min-height: 2.35rem; }
  .entry-side .tap-num { font-size: .85rem; }
}
