:root {
  --page: #090d16;
  --panel: #141b29;
  --panel-2: #1a2232;
  --line: #2a3448;
  --text: #f8fafc;
  --muted: #9eabc0;
  --accent: #38bdf8;
  --gold: #f6ad28;
  --team: #e6002d;
  --team-text: #fff;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body {
  background: var(--page);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Noto Sans TC", "PingFang TC", sans-serif;
  font-size: 16px;
}
button, input, select { font: inherit; }
button, select { cursor: pointer; }

.topbar {
  min-height: 72px;
  padding: 10px 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  background: var(--panel);
  border-bottom: 1px solid var(--line);
}
.eyebrow { color: var(--accent); font-size: .72rem; font-weight: 800; letter-spacing: .08em; }
h1 { margin: 2px 0 0; font-size: 1.15rem; }
h1 span { color: var(--muted); font-weight: 600; }
.topbar-actions { display: flex; gap: 8px; }
.secondary-button {
  padding: 8px 12px;
  color: var(--text);
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.fixture-panel {
  display: grid;
  grid-template-columns: minmax(130px, 230px) 1fr auto 1fr minmax(130px, 230px);
  align-items: end;
  gap: 10px;
  padding: 10px 18px;
  border-bottom: 1px solid var(--line);
}
.fixture-panel label { color: var(--muted); font-size: .72rem; }
.fixture-panel select {
  display: block;
  width: 100%;
  margin-top: 3px;
  padding: 8px;
  color: var(--text);
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 7px;
}
.fixture-team {
  min-height: 42px;
  padding: 8px 12px;
  color: var(--text);
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  font-weight: 800;
}
.fixture-team.active { color: var(--team-text); background: var(--team); border-color: var(--team); }
.versus { padding-bottom: 10px; color: var(--muted); font-size: .75rem; font-weight: 900; }

.workspace { display: grid; grid-template-columns: 310px minmax(0, 1fr); min-height: calc(100vh - 136px); }
.sidebar {
  position: sticky;
  top: 0;
  height: calc(100vh - 136px);
  overflow: auto;
  background: var(--panel);
  border-right: 1px solid var(--line);
}
.sidebar-tools { position: sticky; top: 0; z-index: 2; padding: 10px; background: var(--panel); border-bottom: 1px solid var(--line); }
#player-search { width: 100%; padding: 9px 11px; color: var(--text); background: var(--page); border: 1px solid var(--line); border-radius: 7px; }
.shirt-grid { display: grid; grid-template-columns: repeat(8, 1fr); gap: 4px; margin-top: 8px; }
.shirt-button { min-height: 30px; padding: 3px; color: var(--muted); background: var(--panel-2); border: 1px solid var(--line); border-radius: 5px; font-size: .76rem; font-weight: 800; }
.shirt-button:hover, .shirt-button.active { color: var(--team-text); background: var(--team); }
.roster-heading { padding: 10px 12px 5px; color: var(--accent); font-size: .72rem; font-weight: 900; letter-spacing: .08em; }
.roster-item { display: grid; grid-template-columns: 42px 1fr auto; gap: 7px; align-items: center; width: 100%; padding: 9px 12px; color: var(--text); background: transparent; border: 0; border-left: 4px solid transparent; text-align: left; }
.roster-item:hover { background: rgba(255,255,255,.04); }
.roster-item.active { background: rgba(255,255,255,.08); border-left-color: var(--team); }
.roster-number { color: var(--muted); font-weight: 900; }
.roster-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.roster-position { color: var(--muted); font-size: .72rem; font-weight: 800; }

.detail { min-width: 0; padding: 18px; overflow: auto; }
.panel { max-width: 1180px; margin: 0 auto; background: var(--panel); border: 1px solid var(--line); border-radius: 12px; overflow: hidden; box-shadow: 0 10px 35px rgba(0,0,0,.18); }
.hero { display: flex; align-items: center; justify-content: space-between; gap: 18px; min-height: 112px; padding: 18px 22px; color: var(--team-text); background: linear-gradient(110deg, var(--team), color-mix(in srgb, var(--team) 32%, #090d16)); }
.hero-main { display: flex; align-items: center; gap: 16px; min-width: 0; }
.player-photo { width: 84px; height: 84px; flex: 0 0 84px; object-fit: cover; object-position: top center; background: rgba(255,255,255,.12); border: 2px solid rgba(255,255,255,.35); border-radius: 10px; }
.hero-number { color: inherit; font-size: .9rem; font-weight: 900; opacity: .82; }
.hero h2 { margin: 2px 0; font-size: clamp(1.45rem, 3vw, 2.15rem); line-height: 1.08; }
.hero .english { font-size: .86rem; opacity: .86; }
.team-logo { width: 76px; height: 76px; object-fit: contain; filter: drop-shadow(0 3px 7px rgba(0,0,0,.35)); }
.badges { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.badge { padding: 3px 8px; color: #fff; background: rgba(0,0,0,.34); border: 1px solid rgba(255,255,255,.35); border-radius: 999px; font-size: .72rem; font-weight: 900; }
.audit-badge { color: #201300; background: var(--gold); border-color: var(--gold); }

.content { padding: 20px 22px 28px; }
.notice { margin-bottom: 16px; padding: 10px 12px; color: #fee9a7; background: rgba(246,173,40,.09); border: 1px solid rgba(246,173,40,.35); border-radius: 7px; font-size: .82rem; }
.vitals { display: grid; grid-template-columns: repeat(4, minmax(0,1fr)); gap: 8px; }
.vital { min-height: 67px; padding: 10px 12px; background: var(--panel-2); border: 1px solid var(--line); border-radius: 8px; }
.vital label { display: block; margin-bottom: 4px; color: var(--muted); font-size: .7rem; }
.vital strong { font-size: .91rem; overflow-wrap: anywhere; }
.section { margin-top: 24px; }
.section h3 { margin: 0 0 10px; color: var(--accent); font-size: 1rem; }
.section p { margin: 0; color: #d4dbea; line-height: 1.65; }
.section-meta { margin: -4px 0 10px; color: var(--muted); font-size: .76rem; }
.metric-grid { display: grid; grid-template-columns: repeat(4, minmax(0,1fr)); gap: 8px; }
.metric-card, .story-card, .interview-card { padding: 11px 13px; background: var(--panel-2); border: 1px solid var(--line); border-radius: 8px; }
.metric-card label, .metric-card span { display: block; color: var(--muted); font-size: .7rem; }
.metric-card strong { display: block; margin: 3px 0; color: var(--text); font-size: 1.12rem; }
.analysis-list { margin-top: 12px; }
.story-grid, .interview-list { display: grid; gap: 8px; }
.story-grid { grid-template-columns: repeat(2, minmax(0,1fr)); }
.story-meta { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; color: var(--muted); font-size: .7rem; }
.story-meta a { color: var(--accent); }
.interview-card blockquote { margin: 10px 0; padding-left: 12px; color: #fff3c4; border-left: 3px solid var(--gold); font-size: 1rem; line-height: 1.55; }
.interview-card details { margin: 8px 0; color: var(--muted); font-size: .78rem; }
.interview-card .source-link { display: inline-block; margin-top: 10px; }
.match-week { padding: 14px; background: rgba(56,189,248,.05); border: 1px solid rgba(56,189,248,.25); border-radius: 9px; }
.selection-note { margin: 8px 0 10px; }
.achievement-grid { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 8px; }
.achievement { padding: 11px 13px; color: #fff3c4; background: rgba(246,173,40,.08); border-left: 3px solid var(--gold); border-radius: 5px; line-height: 1.45; }
.fact-list { margin: 0; padding-left: 1.25rem; color: #d4dbea; line-height: 1.55; }
.fact-list li + li { margin-top: 6px; }
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: 8px; }
table { width: 100%; min-width: 760px; border-collapse: collapse; font-size: .86rem; }
th { padding: 9px 10px; color: var(--accent); background: rgba(255,255,255,.045); text-align: left; white-space: nowrap; }
td { padding: 9px 10px; color: #d4dbea; border-top: 1px solid rgba(255,255,255,.055); vertical-align: top; }
td.numeric { width: 58px; text-align: center; }
.empty { color: var(--muted); }
.source-list { display: flex; flex-wrap: wrap; gap: 6px; }
.source-link { padding: 5px 8px; color: var(--accent); background: var(--panel-2); border: 1px solid var(--line); border-radius: 5px; font-size: .78rem; text-decoration: none; }
.source-link:hover { text-decoration: underline; }
.loading-panel, .empty-panel { padding: 50px 20px; color: var(--muted); text-align: center; }
.spinner { width: 30px; height: 30px; margin: auto; border: 3px solid var(--line); border-top-color: var(--accent); border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

@media (max-width: 900px) {
  .fixture-panel { grid-template-columns: 1fr auto 1fr; }
  .fixture-panel label { display: none; }
  .workspace { grid-template-columns: 255px minmax(0,1fr); }
  .sidebar { height: calc(100vh - 136px); }
  .vitals { grid-template-columns: repeat(2, minmax(0,1fr)); }
  .achievement-grid { grid-template-columns: 1fr; }
  .metric-grid { grid-template-columns: repeat(2, minmax(0,1fr)); }
  .story-grid { grid-template-columns: 1fr; }
}

@media (max-width: 650px) {
  .topbar { min-height: 60px; }
  .eyebrow { display: none; }
  h1 { font-size: 1rem; }
  #open-team-picker { display: none; }
  .fixture-panel { padding: 8px; }
  .workspace { display: block; }
  .sidebar { position: relative; width: 100%; height: auto; max-height: 35vh; border-right: 0; border-bottom: 1px solid var(--line); }
  .detail { padding: 10px; }
  .hero { min-height: 92px; padding: 14px; }
  .player-photo { width: 64px; height: 64px; flex-basis: 64px; }
  .team-logo { width: 54px; height: 54px; }
  .content { padding: 15px; }
}

@media print {
  body { color: #111; background: #fff; }
  .topbar, .fixture-panel, .sidebar { display: none !important; }
  .workspace { display: block; }
  .detail { padding: 0; }
  .panel { max-width: none; color: #111; background: #fff; border: 0; box-shadow: none; }
  .content { padding: 12mm; }
  .vital, .source-link { color: #111; background: #fff; border-color: #bbb; }
  .section p, td, .fact-list { color: #111; }
  .table-wrap { overflow: visible; border-color: #bbb; }
  table { min-width: 0; font-size: 8pt; }
  th, td { padding: 5px; border-color: #ccc; }
}

/* Match centre: shared row boundaries keep both teams aligned. */
[hidden] { display: none !important; }
button:focus-visible, a:focus-visible, input:focus-visible, select:focus-visible, summary:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
.match-button { white-space: nowrap; color: var(--accent); }
.match-button.active { background: #38bdf8; color: #091321; border-color: #38bdf8; }
.match-nav-heading { padding: 24px 18px 18px; color: var(--muted); font-size: .68rem; letter-spacing: .16em; }
.match-nav-heading span { display: block; margin-top: 7px; color: var(--text); font-size: 1.2rem; font-weight: 800; letter-spacing: 0; }
.match-nav-item { display: flex; gap: 13px; align-items: flex-start; width: 100%; min-height: 68px; padding: 14px 18px; border: 0; border-left: 3px solid transparent; background: transparent; color: var(--text); text-align: left; font-weight: 700; }
.match-nav-item small { display: block; margin-top: 5px; color: var(--muted); font-size: .72rem; font-weight: 400; }
.match-nav-number { padding-top: 2px; color: #6d7e99; font-size: .75rem; }
.match-nav-item.active { background: #38bdf810; border-left-color: var(--accent); }
.match-nav-item.active .match-nav-number { color: var(--accent); }
.match-nav-item:hover { background: #ffffff08; }
.match-panel { max-width: 1440px; }
.match-hero { display: flex; align-items: center; justify-content: space-between; gap: 20px; padding: 28px; background: linear-gradient(115deg,#1b3047,#121a28); border-bottom: 1px solid var(--line); }
.match-hero h2 { margin: 10px 0; font-size: clamp(1.3rem,2.4vw,2rem); }
.match-hero h2 span { color: var(--muted); font-size: .8em; margin: 0 8px; }
.match-hero p { margin: 0; color: var(--muted); font-size: .84rem; }
.match-date-label { color: var(--muted); font-size: .74rem; flex: 0 0 155px; }
.match-date-label input { width: 100%; display: block; margin-top: 7px; padding: 10px; border: 1px solid var(--line); border-radius: 7px; background: var(--page); color: var(--text); }
.match-content { padding: 22px 28px 35px; }
.match-status { display: flex; align-items: center; gap: 12px; padding: 12px 14px; margin-bottom: 20px; background: #f6ad2809; border: 1px solid #f6ad2835; border-radius: 8px; }
.match-status span { flex-shrink: 0; font-size: .75rem; color: #f6cd74; font-weight: 700; }
.match-status p { margin: 0; color: var(--muted); font-size: .75rem; line-height: 1.6; }
.match-status.ready { border-color: #38bdf840; background: #38bdf809; }
.comparison-headings, .comparison-pair { display: grid; grid-template-columns: minmax(0,1fr) minmax(0,1fr); }
.comparison-headings { border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
.comparison-club { display: flex; align-items: center; gap: 12px; padding: 20px; min-width: 0; background: var(--panel-2); }
.comparison-club + .comparison-club { border-left: 1px solid var(--line); }
.comparison-club img { width: 48px; height: 54px; object-fit: contain; }
.comparison-club small { color: var(--accent); font-size: .7rem; }
.comparison-club h3 { margin: 3px 0; font-size: 1.08rem; }
.comparison-club span { color: var(--muted); font-size: .7rem; }
.club-link { margin-left: auto; color: var(--accent); font-size: .7rem; text-decoration: none; }
.comparison-label { margin: 28px 0 0; padding: 0 0 11px; color: var(--accent); border-bottom: 1px solid var(--line); font-size: .94rem; }
.comparison-cell { min-width: 0; padding: 18px 20px 18px 0; }
.comparison-cell + .comparison-cell { padding: 18px 0 18px 20px; border-left: 1px solid var(--line); }
.comparison-cell p, .match-section p { margin: 0 0 10px; line-height: 1.8; color: #d4dbea; font-size: .92rem; white-space: pre-line; }
.research-pending { color: #7f90a8; font-size: .8rem; }
.snapshot-label, .claim-meta { color: var(--muted); font-size: .7rem; line-height: 1.6; margin: 5px 0 10px; }
.match-metrics { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 8px; }
.match-metrics > div { padding: 12px; border-radius: 7px; background: var(--page); }
.match-metrics small { display: block; margin-bottom: 5px; color: var(--muted); font-size: .72rem; }
.match-metrics strong { display: block; font-size: 1.25rem; }
.record-line { margin-top: 13px !important; }
.match-section { margin-top: 24px; }
.match-section h3 { color: var(--accent); font-size: 1rem; margin-bottom: 12px; }
.preview-outline { display: grid; gap: 12px; padding: 22px; background: var(--panel-2); border-radius: 9px; margin-top: 24px; color: var(--muted); }
.preview-article { max-width: 900px; }
.match-description { color: var(--muted); line-height: 1.8; font-size: .85rem; margin-top: 24px; }
.quote-speaker { font-weight: 800; }
.quote-speaker small { color: var(--muted); font-weight: 400; }
.event-quotes { display: grid; gap: 16px; }
.event-quote { padding: 18px; border: 1px solid var(--line); border-radius: 10px; background: rgba(255,255,255,.025); }
.event-quote h4 { margin: 10px 0; color: var(--muted); font-size: .9rem; }
.event-quote blockquote { border-left: 3px solid var(--gold); padding-left: 15px; margin: 14px 0; line-height: 1.8; color: #fff3c4; }
.event-quote details, .match-section p.quote-date-note { color: var(--muted); font-size: .8rem; }
.comparison-cell blockquote { border-left: 3px solid var(--gold); padding-left: 15px; margin: 18px 0; line-height: 1.8; color: #fff3c4; }
.comparison-cell details { color: var(--muted); font-size: .8rem; margin: 10px 0; }
.formation-demo { margin-top: 12px; color: var(--muted); font-size: .8rem; }
.formation-caption { font-size: .75rem; color: var(--muted); margin-bottom: 10px; }
.football-pitch { position: relative; display: flex; flex-direction: column; justify-content: space-around; gap: 13px; aspect-ratio: 1.2; max-width: 440px; padding: 15px 5px; border: 1px solid #648376; border-radius: 7px; background: repeating-linear-gradient(0deg,#163d30 0%,#163d30 20%,#194434 20%,#194434 40%); }
.football-pitch:before { content: ''; position: absolute; inset: 10px; border: 1px solid #ffffff45; pointer-events: none; }
.football-pitch:after { content: ''; position: absolute; top: 50%; left: 10px; right: 10px; border-top: 1px solid #ffffff45; }
.pitch-centre { position: absolute; top: 50%; left: 50%; width: 65px; height: 65px; border: 1px solid #ffffff45; border-radius: 50%; transform: translate(-50%,-50%); }
.pitch-row { display: flex; justify-content: space-around; position: relative; z-index: 1; }
.pitch-player { text-align: center; flex: 1; }
.pitch-player span { display: inline-flex; align-items: center; justify-content: center; width: 28px; height: 28px; border-radius: 50%; background: #eef7f3; color: #123225; border: 2px solid #99cbb4; font-size: .7rem; font-weight: 800; }
.pitch-player small { display: block; color: #fff; font-size: .64rem; padding-top: 4px; }
.focus-player { margin-bottom: 20px; padding: 15px; border: 1px solid var(--line); border-radius: 9px; }
.focus-player-heading { display: flex; gap: 12px; align-items: center; margin-bottom: 14px; }
.focus-player-heading img { width: 52px; height: 64px; object-fit: cover; border-radius: 6px; }
.focus-player-heading h4 { margin: 5px 0; }
.focus-player a { color: var(--text); }
.focus-player-heading small, .focus-player-heading span { color: var(--muted); font-size: .75rem; }
.match-table { min-width: 440px; font-size: .75rem; }
.match-table th, .match-table td { padding: 9px 7px; }
.selected-fixture { background: #38bdf813; box-shadow: inset 3px 0 #38bdf8; }
@media (max-width: 1100px) { .workspace { grid-template-columns: 240px minmax(0,1fr); } .club-link { display: none; } .match-content { padding: 18px; } .comparison-club { padding: 14px; } }
@media (max-width: 900px) { .fixture-panel label { display: block; grid-row: 2; } .fixture-panel label:first-child { grid-column: 1; } .fixture-panel label:last-child { grid-column: 3; } .match-hero { padding: 20px; flex-wrap: wrap; } .match-status { flex-direction: column; align-items: flex-start; } .comparison-club img { width: 34px; } .comparison-club span { display: none; } }
@media (max-width: 650px) { .workspace { display: block; } .eyebrow { display: block; font-size: .65rem; } .topbar { flex-wrap: wrap; } .match-nav { display: flex; overflow-x: auto; } .match-nav-heading { display: none; } .match-nav-item { min-width: 125px; width: auto; min-height: 62px; padding: 11px; border-left: 0; border-bottom: 3px solid transparent; } .match-nav-item.active { border-bottom-color: var(--accent); } .match-nav-item small, .match-nav-number { display: none; } .match-content { padding: 14px; } .match-metrics { grid-template-columns: repeat(2,minmax(0,1fr)); } .comparison-cell { padding: 14px 10px 14px 0; } .comparison-cell + .comparison-cell { padding: 14px 0 14px 10px; } .comparison-club { padding: 11px 8px; gap: 6px; } .comparison-club h3 { font-size: .9rem; } .comparison-club img { width: 25px; height: 35px; } .fixture-team { padding: 8px; font-size: .82rem; } }
.foreign-roster-link { display: block; margin: 7px 0; padding: 12px; border: 1px solid var(--line); border-radius: 7px; color: var(--text); text-decoration: none; }
.foreign-roster-link span { display: block; margin-top: 5px; font-size: .75rem; color: var(--muted); }
.foreign-roster-link:hover { border-color: var(--accent); }

.match-date-label strong { display:block; font-size:1.15rem; color:var(--text); }
.match-date-label span { display:block; margin-top:6px; }

.fixture-match-control { display:flex; align-items:center; gap:8px; min-width:0; }
.fixture-match-control #match-selector { width:clamp(150px,23vw,310px); margin:0; min-width:0; font-size:.85rem; }
@media(max-width:650px) { .fixture-match-control { flex-direction:column; gap:4px; max-width:160px; } .fixture-match-control #match-selector { width:100%; font-size:.72rem; } }

.quick-read { padding:16px; margin:16px 0 24px; background:var(--panel); border:1px solid var(--line); border-radius:10px; }
.quick-read summary { cursor:pointer; font-weight:600; }
.quick-read summary small { color:var(--muted); margin-left:12px; font-weight:400; }
.quick-read-grid { display:grid; grid-template-columns:repeat(4,minmax(0,1fr)); gap:16px; margin-top:16px; }
.quick-read-grid p { margin:6px 0; font-size:.88rem; line-height:1.6; }
.quick-links { display:flex; flex-wrap:wrap; gap:8px; margin-top:12px; }
.quick-links a { padding:7px 10px; border:1px solid var(--line); border-radius:7px; color:var(--accent); text-decoration:none; font-size:.8rem; }
.match-section .match-table th { position:sticky; top:0; background:var(--panel); }
.fixture-note { font-size:.88rem; color:var(--muted); }
@media(max-width:900px){.quick-read-grid{grid-template-columns:repeat(2,minmax(0,1fr));}}
@media(max-width:650px){.quick-read-grid{grid-template-columns:1fr;} .match-content .comparison-pair{grid-template-columns:repeat(2,minmax(0,1fr));} .match-table{font-size:.78rem;} }

.commentary-partner { display:flex; flex-wrap:wrap; align-items:baseline; gap:10px 20px; margin-bottom:12px; }
.commentary-partner strong { font-size:1.15rem; }
.commentary-partner small { color:var(--muted); }
.match-date-label .partner-header { margin-top:8px; color:var(--accent); }

/* Live commentary: repeated team identity and readable section navigation. */
.match-panel .source-list { display:none; }
.match-nav-item { font-size:1rem; line-height:1.5; }
.match-nav-item small { font-size:.88rem; line-height:1.5; }
.match-nav-number { font-size:.9rem; }
.comparison-cell.team-column { padding:16px; border-left:4px solid var(--column-team-color); background:color-mix(in srgb,var(--column-team-color) 12%,#101929); border-radius:8px; }
.comparison-pair:has(>.team-column) { gap:14px; }
.column-team-label { position:sticky; top:0; z-index:3; display:flex; align-items:center; gap:8px; padding:10px 12px; margin:-2px -2px 16px; color:#fff; font-weight:800; font-size:1rem; background:#142035; border-bottom:2px solid var(--column-team-color); border-radius:5px; }
.column-team-label small { margin-left:auto; color:#bdc9da; font-size:.8rem; font-weight:500; }
.column-team-dot { height:12px; width:12px; border-radius:50%; background:var(--column-team-color); outline:1px solid #ffffff60; flex-shrink:0; }
@media(max-width:650px) { .comparison-cell.team-column { padding:10px; } .column-team-label { font-size:.88rem; padding:9px 5px; gap:5px; } .column-team-label small { font-size:.7rem; } .match-nav-item { font-size:1rem; } }
