/* ============================================================
   ScoreBattle · Statistic screen
   Read-only aggregate of fixtures + standings + top stats.
   Layout follows the .mv2 / .fwk pattern: top header, segmented
   tabs, scrollable body, bottom tab bar.
   ============================================================ */

.stsc{
  background:var(--bone);
  display:flex;flex-direction:column;height:100%;overflow:hidden;
  position:relative;
}
.stsc .stat{
  flex:1;display:flex;flex-direction:column;min-height:0;
  padding-bottom:calc(62px + env(safe-area-inset-bottom));
}
@media (min-width:760px){
  .stsc .stat{padding-bottom:0}
}

/* ── header ── */
.stat__top{
  background:linear-gradient(180deg,#fff 0%,#FAF8F2 100%);
  border-bottom:1px solid var(--line);
  padding:18px 22px 14px;
}
.stat__top-row{display:flex;align-items:baseline;gap:12px;flex-wrap:wrap}
.stat__title{
  margin:0;font-family:var(--display);font-size:30px;letter-spacing:.02em;color:var(--ink);
}
.stat__league{
  font-size:13px;color:var(--muted);font-weight:600;
}

/* ── segmented tabs ── */
.stat__seg{
  display:flex;gap:6px;padding:10px 18px;
  background:#fff;border-bottom:1px solid var(--line);
  overflow-x:auto;-webkit-overflow-scrolling:touch;scrollbar-width:none;
}
.stat__seg::-webkit-scrollbar{display:none}
.stat__seg button{
  flex:0 0 auto;border:1px solid var(--line);background:var(--paper);color:var(--ink-2);
  padding:8px 14px;border-radius:99px;font:600 12.5px/1 var(--sans);letter-spacing:-.01em;
  cursor:pointer;transition:background .12s,color .12s,border-color .12s;
}
.stat__seg button:hover{background:var(--field)}
.stat__seg button.is-active{
  background:var(--ink);border-color:var(--ink);color:#fff;
}

/* ── body ── */
.stat__body{flex:1;overflow:auto;background:var(--bone)}
.stat__panel{padding:14px 18px 22px}

.stat__state{display:none;padding:40px 22px;text-align:center;color:var(--muted)}
.stat__state p{margin:8px 0 14px;font-size:14px}
.stsc[data-state="loading"] .stat__state--loading{display:block}
.stsc[data-state="loading"] .stat__panel{display:none}
.stsc[data-state="error"]   .stat__state--error{display:block}
.stsc[data-state="error"]   .stat__panel{display:none}

/* ── Global ranking screen (re-uses .ld__stand-* + .ld-wkm__* widgets) ── */
.glsc{
  background:var(--bone);
  display:flex;flex-direction:column;height:100%;overflow:hidden;
  position:relative;
}
.glsc .gl{
  flex:1;display:flex;flex-direction:column;min-height:0;
  padding-bottom:calc(62px + env(safe-area-inset-bottom));
}
@media (min-width:760px){
  .glsc .gl{padding-bottom:0}
}
.gl__top{
  background:linear-gradient(180deg,#fff 0%,#FAF8F2 100%);
  border-bottom:1px solid var(--line);
  padding:18px 22px 14px;
}
.gl__top-row{display:flex;align-items:baseline;gap:12px;flex-wrap:wrap}
.gl__title{
  margin:0;font-family:var(--display);font-size:30px;letter-spacing:.02em;color:var(--ink);
}
.gl__league{font-size:13px;color:var(--muted);font-weight:600}
.gl__lead{margin:6px 0 0;font-size:13px;color:var(--muted);line-height:1.5}
.gl__body{flex:1;overflow:auto;background:var(--bone);padding:14px 18px 22px}

/* ════════════════════════════════════════════════════════════
   Section · fixtures (grouped by round)
   ════════════════════════════════════════════════════════════ */
.stat-fx__group{
  background:#fff;border:1px solid var(--line);border-radius:14px;
  margin-bottom:14px;overflow:hidden;
}
.stat-fx__round{
  margin:0;padding:12px 16px;font-size:11.5px;letter-spacing:.18em;text-transform:uppercase;
  color:var(--muted);font-weight:800;background:#FAF8F2;border-bottom:1px solid var(--line);
}
.stat-fx__list{list-style:none;margin:0;padding:0}
.stat-fx__row{
  display:grid;grid-template-columns:1fr auto 1fr;align-items:center;gap:14px;
  padding:12px 16px;border-bottom:1px solid var(--line);
}
.stat-fx__row:last-child{border-bottom:0}

.stat-fx__team{
  display:flex;align-items:center;gap:10px;min-width:0;
}
.stat-fx__team--home{justify-content:flex-end;text-align:right}
.stat-fx__team--away{justify-content:flex-start;text-align:left}
.stat-fx__name{
  font-size:13.5px;font-weight:600;color:var(--ink);
  overflow:hidden;text-overflow:ellipsis;white-space:nowrap;
}
.stat-crest{
  width:24px;height:24px;object-fit:contain;flex-shrink:0;
  background:#fff;border-radius:6px;
}
.stat-crest--ph{
  display:inline-block;background:var(--field);
}

.stat-fx__mid{
  display:flex;flex-direction:column;align-items:center;gap:3px;min-width:74px;
}
.stat-fx__score{
  font-family:var(--display);font-size:22px;letter-spacing:.02em;color:var(--ink);
  display:flex;align-items:baseline;gap:6px;
}
.stat-fx__score i{font-style:normal;color:var(--muted);font-size:14px}
.stat-fx__time{
  font-size:12px;font-weight:600;color:var(--ink-2);background:var(--field);
  padding:5px 10px;border-radius:99px;white-space:nowrap;
}
.stat-fx__pill{
  font:700 9.5px/1 var(--sans);letter-spacing:.08em;text-transform:uppercase;
  padding:3px 7px;border-radius:99px;
}
.stat-fx__pill.is-live{background:var(--red);color:#fff}
.stat-fx__pill.is-final{background:var(--field);color:var(--muted)}

/* ════════════════════════════════════════════════════════════
   Section · standings
   ════════════════════════════════════════════════════════════ */

/* group-stage grid (e.g. World Cup A..L) */
.stat-grp-grid{
  display:grid;grid-template-columns:1fr;gap:14px;
}
@media (min-width:760px){
  .stat-grp-grid{grid-template-columns:1fr 1fr}
}
@media (min-width:1100px){
  .stat-grp-grid{grid-template-columns:repeat(3,1fr)}
}
.stat-grp{
  background:#fff;border:1px solid var(--line);border-radius:14px;overflow:hidden;
}
.stat-grp__h{
  margin:0;padding:10px 14px;font-size:11.5px;letter-spacing:.16em;text-transform:uppercase;
  color:var(--muted);font-weight:700;background:#FAF8F2;border-bottom:1px solid var(--line);
}
.stat-grp__h b{color:var(--ink);font-weight:800;letter-spacing:.04em}
.stat-grp .stat-tbl-wrap{border:0;border-radius:0}

.stat-tbl-wrap{
  background:#fff;border:1px solid var(--line);border-radius:14px;overflow:auto;
}
.stat-tbl{
  width:100%;border-collapse:collapse;font-size:13px;
  min-width:560px;
}
.stat-grp .stat-tbl-wrap{overflow:hidden}
.stat-tbl--compact{min-width:0;width:100%;font-size:11.5px;table-layout:fixed}
.stat-tbl--compact th,
.stat-tbl--compact td{padding:6px 2px}
.stat-tbl--compact .c-rank{width:24px}
.stat-tbl--compact .c-team{min-width:0;padding-left:6px;text-align:left}
.stat-tbl--compact .c-team__inner{gap:6px}
.stat-tbl--compact .c-team__inner span{max-width:none;font-size:11px}
.stat-tbl--compact .stat-crest{width:16px;height:16px;flex:0 0 16px}
.stat-tbl--compact th:not(.c-rank):not(.c-team):not(.c-pts),
.stat-tbl--compact td:not(.c-rank):not(.c-team):not(.c-pts){width:8%}
.stat-tbl--compact .c-pts{width:32px}
.stat-tbl thead{
  background:#FAF8F2;
}
.stat-tbl th,
.stat-tbl td{
  padding:10px 8px;text-align:center;vertical-align:middle;
  border-bottom:1px solid var(--line);
}
.stat-tbl tbody tr:last-child td{border-bottom:0}
.stat-tbl th{
  font-size:10.5px;font-weight:800;letter-spacing:.12em;
  text-transform:uppercase;color:var(--muted);
}
.stat-tbl .c-rank{width:36px;color:var(--muted);font-weight:700}
.stat-tbl .c-team{text-align:left;padding-left:14px;min-width:160px}
.stat-tbl tbody td.c-team{font-weight:600;color:var(--ink)}
.stat-tbl .c-team__inner{
  display:flex;align-items:center;gap:10px;
}
.stat-tbl .c-team__inner span{
  overflow:hidden;text-overflow:ellipsis;white-space:nowrap;max-width:200px;
}
.stat-tbl .c-pts{font-weight:800;color:var(--ink);background:#FAF8F2}
.stat-tbl .c-form{white-space:nowrap}
.stat-tbl .c-form i{
  display:inline-block;width:18px;height:18px;border-radius:5px;
  font:700 10px/18px var(--sans);color:#fff;text-align:center;margin:0 1px;
  vertical-align:middle;font-style:normal;
}
.stat-tbl .c-form i.w{background:var(--success)}
.stat-tbl .c-form i.d{background:#a8a8a8}
.stat-tbl .c-form i.l{background:var(--red)}

/* zebra */
.stat-tbl tbody tr:nth-child(even) td{background:rgba(244,242,236,.4)}
.stat-tbl tbody tr:nth-child(even) td.c-pts{background:#F5F2EC}

/* ════════════════════════════════════════════════════════════
   Section · top stats
   ════════════════════════════════════════════════════════════ */
.stat-ts-grid{
  display:grid;grid-template-columns:1fr;gap:14px;
}
@media (min-width:760px){
  .stat-ts-grid{grid-template-columns:1fr 1fr}
}
@media (min-width:1100px){
  .stat-ts-grid{grid-template-columns:repeat(4,1fr)}
}

.ts-card{
  background:#fff;border:1px solid var(--line);border-radius:14px;overflow:hidden;
  display:flex;flex-direction:column;
}
.ts-card__list{max-height:none}
@media (min-width:1100px){
  .ts-card__list{max-height:560px;overflow:auto}
}
.ts-card__h{
  margin:0;padding:12px 16px;font-size:11.5px;letter-spacing:.18em;text-transform:uppercase;
  color:var(--ink);font-weight:800;background:#FAF8F2;border-bottom:1px solid var(--line);
  display:flex;align-items:center;gap:8px;
}
.ts-card__h::before{
  content:'';width:8px;height:8px;border-radius:99px;background:var(--ink);
}
.ts-card--scorers .ts-card__h::before{background:var(--red)}
.ts-card--assists .ts-card__h::before{background:var(--navy)}
.ts-card--yellow  .ts-card__h::before{background:#F5C518}
.ts-card--red     .ts-card__h::before{background:#C8202F}

.ts-card__list{list-style:none;margin:0;padding:0}
.ts-card__empty{margin:0;padding:14px 16px;color:var(--muted);font-size:13px}

.ts-row{
  display:grid;grid-template-columns:24px 32px 1fr auto;
  align-items:center;gap:10px;
  padding:8px 14px;border-bottom:1px solid var(--line);
}
.ts-row:last-child{border-bottom:0}
.ts-row__rank{
  font-size:12px;font-weight:700;color:var(--muted);text-align:center;
}
.ts-ph{
  width:32px;height:32px;border-radius:99px;background:var(--field);object-fit:cover;
}
.ts-row__who{display:flex;flex-direction:column;min-width:0}
.ts-row__name{
  font-size:13.5px;font-weight:600;color:var(--ink);
  overflow:hidden;text-overflow:ellipsis;white-space:nowrap;
}
.ts-row__team{
  font-size:11.5px;color:var(--muted);font-weight:500;
  overflow:hidden;text-overflow:ellipsis;white-space:nowrap;
}
.ts-row__val{
  font-family:var(--display);font-size:20px;color:var(--ink);letter-spacing:.02em;
  min-width:32px;text-align:right;
}

/* ── empty / loading inside panels ── */
.stat-empty{
  padding:36px 16px;text-align:center;color:var(--muted);font-size:13.5px;
  background:#fff;border:1px solid var(--line);border-radius:14px;
}

/* ── desktop padding tweaks ── */
@media (min-width:760px){
  .stat__panel{padding:18px 22px 28px}
  .stat__top{padding:22px 22px 16px}
  .stat__title{font-size:34px}
}
