* { margin: 0; padding: 0; box-sizing: border-box; }
:root {
  --bg: #f4f6f9; --card: #fff; --text: #1f2937; --muted: #6b7280; --line: #e5e7eb;
  --primary: #2563eb; --primary-dark: #1d4ed8; --green: #059669; --red: #dc2626; --gold: #d97706;
  --shadow: 0 1px 3px rgba(0,0,0,.08), 0 1px 2px rgba(0,0,0,.04);
}
body { font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif; background: var(--bg); color: var(--text); line-height: 1.5; }
.hidden { display: none !important; }

.topbar { background: #111827; color: #fff; display: flex; align-items: center; justify-content: space-between; padding: 12px 20px; }
.brand { font-size: 18px; font-weight: 700; }
.top-actions { display: flex; align-items: center; gap: 12px; }
.auth-status { font-size: 12px; color: #9ca3af; }
.auth-status.on { color: #34d399; }

.tabs { display: flex; gap: 4px; background: #fff; border-bottom: 1px solid var(--line); padding: 0 16px; overflow-x: auto; }
.tab { background: none; border: none; padding: 14px 18px; font-size: 15px; color: var(--muted); cursor: pointer; white-space: nowrap; border-bottom: 2px solid transparent; }
.tab:hover { color: var(--text); }
.tab.active { color: var(--primary); border-bottom-color: var(--primary); font-weight: 600; }

main { max-width: 1100px; margin: 24px auto; padding: 0 16px; }
.panel { display: none; }
.panel.active { display: block; }

.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 16px; margin-bottom: 20px; }
.stat-card { background: var(--card); border-radius: 12px; padding: 22px; text-align: center; box-shadow: var(--shadow); }
.stat-num { font-size: 36px; font-weight: 800; color: var(--primary); }
.stat-label { color: var(--muted); font-size: 14px; margin-top: 4px; }

.card { background: var(--card); border-radius: 12px; padding: 20px; box-shadow: var(--shadow); margin-bottom: 20px; }
.card h2 { font-size: 17px; margin-bottom: 16px; }
.card-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; }
.card-head h2 { margin: 0; }
.hint { font-size: 12px; color: var(--muted); font-weight: 400; }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { padding: 10px 12px; text-align: left; border-bottom: 1px solid var(--line); white-space: nowrap; }
th { color: var(--muted); font-weight: 600; font-size: 13px; background: #f9fafb; }
tbody tr:hover { background: #f9fafb; }
.ops { text-align: right; }
.empty { text-align: center; color: var(--muted); padding: 30px; }

.btn { background: var(--primary); color: #fff; border: none; border-radius: 8px; padding: 9px 16px; font-size: 14px; cursor: pointer; }
.btn:hover { background: var(--primary-dark); }
.btn-sm { padding: 6px 12px; font-size: 13px; }
.btn-ghost { background: #f3f4f6; color: var(--text); }
.btn-ghost:hover { background: #e5e7eb; }
.btn-danger { background: #fee2e2; color: var(--red); }
.btn-danger:hover { background: #fecaca; }
.icon-btn { background: none; border: none; font-size: 24px; cursor: pointer; color: var(--muted); line-height: 1; }
.row-ops { display: flex; gap: 6px; justify-content: flex-end; }
.mini { padding: 4px 10px; font-size: 12px; border-radius: 6px; border: 1px solid var(--line); background: #fff; cursor: pointer; }
.mini:hover { background: #f3f4f6; }

.score { font-weight: 700; font-variant-numeric: tabular-nums; }
.badge { display: inline-block; padding: 2px 8px; border-radius: 10px; font-size: 12px; }
.badge-win { background: #d1fae5; color: var(--green); }
.badge-lose { background: #fee2e2; color: var(--red); }
.badge-draw { background: #f3f4f6; color: var(--muted); }
.rank-1 { color: var(--gold); font-weight: 800; } .rank-2 { color: #6b7280; font-weight: 700; } .rank-3 { color: #b45309; font-weight: 700; }

/* 球队卡片 */
.card-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 16px; }
.team-card { background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 18px; text-align: center; cursor: pointer; transition: transform .15s, box-shadow .15s; }
.team-card:hover { transform: translateY(-2px); box-shadow: 0 6px 16px rgba(0,0,0,.1); }
.team-logo { width: 72px; height: 72px; border-radius: 50%; object-fit: cover; background: #f3f4f6; margin: 0 auto 12px; display: flex; align-items: center; justify-content: center; font-size: 30px; overflow: hidden; }
.team-logo img { width: 100%; height: 100%; object-fit: cover; }
.team-name { font-size: 16px; font-weight: 700; }
.team-meta { font-size: 12px; color: var(--muted); margin-top: 4px; }
.captain-tag { display: inline-block; margin-top: 8px; font-size: 11px; color: var(--gold); background: #fef3c7; padding: 2px 8px; border-radius: 10px; }

/* 详情页 */
.detail-bar { background: #fff; border-bottom: 1px solid var(--line); padding: 12px 20px; display: flex; align-items: center; gap: 16px; position: sticky; top: 0; z-index: 10; }
.detail-bar span { font-size: 17px; font-weight: 700; }
.detail-hero { background: #fff; border-radius: 12px; padding: 24px; box-shadow: var(--shadow); margin-bottom: 20px; display: flex; gap: 24px; align-items: center; flex-wrap: wrap; }
.hero-logo { width: 96px; height: 96px; border-radius: 50%; object-fit: cover; background: #f3f4f6; display: flex; align-items: center; justify-content: center; font-size: 40px; overflow: hidden; flex-shrink: 0; }
.hero-logo img { width: 100%; height: 100%; object-fit: cover; }
.hero-info h1 { font-size: 24px; margin-bottom: 8px; }
.hero-info p { color: var(--muted); font-size: 14px; margin: 2px 0; }
.hero-photo { width: 120px; height: 150px; border-radius: 12px; object-fit: cover; background: #f3f4f6; display: flex; align-items: center; justify-content: center; font-size: 44px; overflow: hidden; flex-shrink: 0; }
.hero-photo img { width: 100%; height: 100%; object-fit: cover; }
.stat-row { display: flex; gap: 24px; flex-wrap: wrap; }
.stat-item { text-align: center; }
.stat-item b { display: block; font-size: 26px; color: var(--primary); }
.stat-item span { font-size: 12px; color: var(--muted); }
.honor-list { list-style: none; }
.honor-list li { padding: 8px 0 8px 26px; border-bottom: 1px solid var(--line); position: relative; font-size: 14px; }
.honor-list li::before { content: '🏆'; position: absolute; left: 0; }
.player-link { cursor: pointer; color: var(--primary); font-weight: 600; }
.player-link:hover { text-decoration: underline; }

.modal { position: fixed; inset: 0; background: rgba(0,0,0,.45); display: flex; align-items: center; justify-content: center; z-index: 100; padding: 16px; }
.modal-box { background: #fff; border-radius: 12px; width: 100%; max-width: 520px; max-height: 90vh; overflow-y: auto; }
.modal-head { display: flex; align-items: center; justify-content: space-between; padding: 16px 20px; border-bottom: 1px solid var(--line); }
.modal-head h3 { font-size: 16px; }
#modalBody { padding: 20px; }
.modal-foot { display: flex; justify-content: flex-end; gap: 10px; padding: 16px 20px; border-top: 1px solid var(--line); }
.field { margin-bottom: 14px; }
.field label { display: block; font-size: 13px; color: var(--muted); margin-bottom: 5px; }
.field input, .field select, .field textarea { width: 100%; padding: 9px 11px; border: 1px solid var(--line); border-radius: 8px; font-size: 14px; font-family: inherit; }
.field input:focus, .field select:focus, .field textarea:focus { outline: none; border-color: var(--primary); }
.field textarea { min-height: 70px; resize: vertical; }
.upload-row { display: flex; align-items: center; gap: 12px; }
.upload-preview { width: 56px; height: 56px; border-radius: 8px; object-fit: cover; background: #f3f4f6; display: flex; align-items: center; justify-content: center; font-size: 22px; overflow: hidden; }
.upload-preview img { width: 100%; height: 100%; object-fit: cover; }
.upload-tip { font-size: 11px; color: var(--muted); margin-top: 4px; }
.stats-editor { border: 1px solid var(--line); border-radius: 8px; max-height: 260px; overflow-y: auto; }
.stats-editor table { font-size: 13px; }
.stats-editor th, .stats-editor td { padding: 6px 8px; }
.stats-editor input[type=number] { width: 54px; padding: 4px; border: 1px solid var(--line); border-radius: 4px; }
.toast { position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%); background: #111827; color: #fff; padding: 10px 20px; border-radius: 8px; font-size: 14px; z-index: 200; }

@media (max-width: 600px) {
  .topbar { padding: 10px 14px; } .brand { font-size: 16px; }
  main { margin: 16px auto; padding: 0 12px; } .card { padding: 14px; }
  th, td { padding: 8px; font-size: 13px; }
  .detail-hero { padding: 16px; gap: 16px; }
}
