:root {
  --bg: #0d1117;
  --panel: #161b22;
  --line: #30363d;
  --text: #e6edf3;
  --muted: #8b949e;
  --blue: #58a6ff;
  --green: #3fb950;
  --amber: #d29922;
  --red: #f85149;
  --home: var(--amber);
  --away: var(--blue);
}
* { box-sizing: border-box; margin: 0; padding: 0; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
  font-size: 14px;
  padding: 20px;
  min-width: 1280px;
  display: grid;
  row-gap: 12px;
}
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 14px 16px; overflow: hidden; }
.panel-head { display: flex; align-items: center; justify-content: space-between; min-height: 26px; margin-bottom: 10px; gap: 12px; }
.panel-title { font-size: 15px; font-weight: 600; }
.panel-sub { font-size: 12px; color: var(--muted); margin-left: 8px; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
.chip { font-size: 12px; color: var(--muted); border: 1px solid var(--line); border-radius: 999px; padding: 3px 10px; cursor: pointer; user-select: none; }
.chip.on { color: var(--text); border-color: var(--blue); }
.chip.off { opacity: 0.45; cursor: default; }
.muted { color: var(--muted); }
.small { font-size: 12px; }

/*header*/
header { display: flex; align-items: center; justify-content: space-between; }
.brand .name { font-size: 22px; font-weight: 700; }
.brand .match { font-size: 13px; color: var(--muted); margin-top: 2px; }
.score { display: flex; align-items: center; gap: 14px; }
.team { font-size: 16px; font-weight: 600; }
.num { font-size: 28px; font-weight: 700; background: var(--panel); border: 1px solid var(--line); border-radius: 8px; width: 48px; height: 48px; display: grid; place-items: center; }
.clock { font-size: 16px; color: var(--muted); margin-left: 10px; min-width: 64px; }
.tags { display: flex; gap: 8px; }
.tag { font-size: 12px; border: 1px solid var(--line); border-radius: 6px; padding: 5px 10px; color: var(--muted); }
.tag.live { color: var(--green); border-color: var(--green); }
button.tag { background: none; font: inherit; font-size: 12px; cursor: pointer; }
button.tag:hover { background: rgba(63, 185, 80, 0.1); }

/*timeline*/
.timeline { display: flex; align-items: center; gap: 12px; padding: 8px 16px; }
.timeline svg { flex: 1; height: 64px; cursor: pointer; }
.btn { background: none; color: var(--text); border: 1px solid var(--line); border-radius: 6px; padding: 6px 12px; font: inherit; font-size: 13px; cursor: pointer; min-width: 64px; }
.btn:hover { border-color: var(--blue); }
.btn.skip { min-width: 56px; padding: 6px 8px; }
.speeds { display: flex; gap: 4px; }
.speeds .chip { padding: 3px 8px; }

/*rows*/
.row { display: grid; column-gap: 12px; }
.row.top { grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr); height: 560px; }
.row.cards { grid-template-columns: minmax(0, 1fr) minmax(0, 0.8fr) minmax(0, 1fr); height: 420px; }
.row.cards:has([data-slot="context"]:not(.used)) { grid-template-columns: minmax(0, 1fr) minmax(0, 0.8fr); }
.row.cards [data-slot="context"]:not(.used) { display: none; }
.row.mid { grid-template-columns: minmax(0, 2fr) minmax(0, 1.2fr); height: 340px; }

/*pitch*/
.row.top > .panel { display: flex; flex-direction: column; min-height: 0; }
.pitch-body { display: grid; grid-template-columns: 1fr 210px; column-gap: 14px; flex: 1; min-height: 0; padding-bottom: 6px; }
.pitch-body .side { min-height: 0; overflow-y: auto; }
#pitch { cursor: pointer; }
.pitch-wrap { position: relative; min-width: 0; min-height: 0; }
#pitch { position: absolute; inset: 0; width: 100%; height: 100%; }
.side { display: flex; flex-direction: column; gap: 18px; padding-top: 4px; }
.legend { display: flex; flex-direction: column; gap: 8px; font-size: 12px; color: var(--muted); }
.legend .it { display: flex; align-items: center; gap: 8px; }
.sw { width: 12px; height: 12px; border-radius: 50%; flex: none; }
.caption { font-size: 12.5px; line-height: 1.5; color: var(--muted); }
.caption b { color: var(--text); font-weight: 600; }

/*video*/
.video-panel { display: flex; flex-direction: column; }
.video-wrap { position: relative; flex: 1; min-height: 0; background: #000; border-radius: 8px; overflow: hidden; }
.video-wrap video, .video-wrap iframe { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; border: 0; }
.video-wrap .empty { padding: 14px; }
.video-wrap a.btn { display: inline-block; text-decoration: none; }
.video-panel .caption { margin-top: 10px; }

/*possession context*/
.poss { display: flex; flex-direction: column; gap: 12px; font-size: 13px; overflow-y: auto; flex: 1; min-height: 0; }
.poss .big { font-size: 16px; font-weight: 600; }
.poss .line { color: var(--muted); font-size: 12.5px; line-height: 1.5; }
.poss .line b { color: var(--text); font-weight: 500; }
.poss .box { border: 1px solid var(--line); border-radius: 8px; padding: 9px 11px; }
.poss .lbl { font-size: 11px; color: var(--muted); margin-bottom: 4px; }

/*slots the layers mount their panels into*/
.slot { display: flex; flex-direction: column; gap: 12px; min-width: 0; min-height: 0; }
.slot > .panel { flex: 1; display: flex; flex-direction: column; min-height: 0; }
.panel-body { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.slot.extra { display: none; }
.slot.extra.used { display: grid; grid-template-columns: repeat(auto-fit, minmax(420px, 1fr)); gap: 12px; }
.slot.extra > .panel { min-height: 300px; }
.head-right { display: flex; align-items: center; }

/*feed*/
.feed { overflow-y: auto; display: flex; flex-direction: column; gap: 10px; padding-right: 4px; flex: 1; min-height: 0; }
.card { border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px; cursor: pointer; }
.card.latest { border-color: var(--green); }
.card .ch { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; font-size: 12.5px; }
.card .t { color: var(--muted); }
.pill { font-size: 10.5px; border-radius: 4px; padding: 1px 6px; border: 1px solid; }
.card ul { list-style: none; display: flex; flex-direction: column; gap: 3px; font-size: 13px; }
.card li b { font-weight: 600; }
.card .lv { margin-top: 7px; font-size: 12.5px; color: var(--muted); line-height: 1.45; }
.card .lv b { color: var(--text); font-weight: 500; }
.empty { color: var(--muted); font-size: 13px; line-height: 1.5; }

/*moments*/
.mlist { display: grid; row-gap: 0; overflow-y: auto; max-height: calc(100% - 36px); }
.m { display: grid; grid-template-columns: 56px 1fr; align-items: center; font-size: 13px; padding: 6px 0; border-top: 1px solid var(--line); cursor: pointer; }
.m:first-child { border-top: none; }
.m .t { color: var(--muted); }
.m.now, .m.now .t { color: var(--green); }
.m.future { opacity: 0.4; }
.m .k { font-size: 11px; color: var(--muted); }

/*charts*/
svg.chart { width: 100%; flex: 1; min-height: 0; }

/*now table*/
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th { text-align: left; font-weight: 500; color: var(--muted); font-size: 11px; padding: 0 6px 6px 0; }
td { padding: 5px 6px 5px 0; border-top: 1px solid var(--line); }
td.v { font-variant-numeric: tabular-nums; }
td .u { color: var(--muted); font-size: 11.5px; }
.up { color: var(--green); }
.down { color: var(--red); }

/*layers*/
.layer-grid { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 10px; }
.layer { border: 1px solid var(--line); border-radius: 8px; padding: 9px 11px; font-size: 12.5px; }
.layer .n { font-weight: 600; margin-bottom: 3px; }
.layer .d { color: var(--muted); line-height: 1.4; }
.layer .s { font-size: 11px; margin-top: 6px; }
.layer.built .s { color: var(--green); }
.layer.next .s { color: var(--amber); }
.layer.planned .s { color: var(--muted); }

/*two tables side by side*/
.two-col { display: grid; grid-template-columns: 1fr 1fr; column-gap: 18px; }

/*bench options inside a feed card*/
.opts { margin-top: 8px; padding-top: 8px; border-top: 1px dashed var(--line); display: flex; flex-direction: column; gap: 6px; font-size: 12.5px; line-height: 1.45; }
.opt b { font-weight: 600; }
.opt .why { color: var(--muted); font-size: 11.5px; }
.opt.actual { color: var(--muted); }
.opt.actual b { color: var(--text); }
.card .ctx { margin-top: 5px; font-size: 11.5px; color: var(--muted); }
.opt.said { font-size: 12px; font-style: italic; color: var(--text); border-left: 2px solid var(--line); padding-left: 8px; }
.opt.said .src { display: block; font-style: normal; font-size: 11px; color: var(--muted); }
.opt.said a { color: var(--muted); }
.m .said { margin-top: 5px; font-size: 11.5px; font-style: italic; line-height: 1.45; border-left: 2px solid var(--line); padding-left: 8px; }
.m .said .src { display: block; font-style: normal; font-size: 10.5px; color: var(--muted); }
.m .said a { color: var(--muted); }

#loading {
  position: fixed; inset: 0; z-index: 50; background: var(--bg);
  display: flex; align-items: center; justify-content: center;
  transition: opacity 0.35s;
}
#loading.done { opacity: 0; pointer-events: none; }
#loading .box { text-align: center; }
#loading .spin {
  width: 34px; height: 34px; margin: 0 auto 14px; border-radius: 50%;
  border: 3px solid var(--line); border-top-color: var(--blue);
  animation: spin 0.8s linear infinite;
}
#loading .lt { font-size: 15px; font-weight: 600; }
#loading .ls { color: var(--muted); font-size: 13px; margin-top: 4px; }
#loading.fail .spin { display: none; }
#loading.fail .ls { color: var(--red); }
@keyframes spin { to { transform: rotate(360deg); } }

.row.top.solo { grid-template-columns: minmax(0, 1fr); height: 640px; }
.ytbox { margin-top: 18px; }
.ytbtn { display: block; text-align: center; padding: 9px 12px; border-radius: 8px; border: 1px solid var(--blue); color: var(--blue); background: rgba(88, 166, 255, 0.08); text-decoration: none; font-size: 13px; font-weight: 600; }
.ytbtn:hover { background: rgba(88, 166, 255, 0.18); }
.ytat { margin-top: 6px; font-size: 11.5px; color: var(--muted); text-align: center; }
.yttip { margin-top: 10px; font-size: 11.5px; line-height: 1.45; color: var(--muted); }
#play { min-width: 96px; padding: 8px 18px; font-size: 14px; font-weight: 600; border-color: var(--blue); }
.tapicon {
  position: absolute; left: 50%; top: 50%; width: 84px; height: 84px; margin: -42px 0 0 -42px;
  border-radius: 50%; background: rgba(13, 17, 23, 0.6); color: var(--text);
  display: flex; align-items: center; justify-content: center;
  pointer-events: none; opacity: 0;
}
.tapicon.pop { animation: tappop 0.65s ease-out; }
@keyframes tappop { 0% { opacity: 0.95; transform: scale(0.8); } 100% { opacity: 0; transform: scale(1.35); } }
