:root {
  color-scheme: dark;
  --bg: #101114;
  --surface: #181a1f;
  --surface-strong: #20232a;
  --text: #f4f6fb;
  --muted: #a7adba;
  --border: #2f3440;
  --edge: rgba(148, 163, 184, 0.22);
  --edge-strong: rgba(148, 163, 184, 0.46);
  --accent: #facc15;
  --danger: #f97316;
  --shadow: rgba(0, 0, 0, 0.36);
}

html[data-theme="light"] {
  color-scheme: light;
  --bg: #f5f7fb;
  --surface: #ffffff;
  --surface-strong: #eef2f7;
  --text: #111827;
  --muted: #5d6678;
  --border: #d8dee9;
  --edge: rgba(71, 85, 105, 0.2);
  --edge-strong: rgba(71, 85, 105, 0.42);
  --accent: #b7791f;
  --danger: #c2410c;
  --shadow: rgba(15, 23, 42, 0.16);
}

* {
  box-sizing: border-box;
}

html,
body {
  height: 100%;
  width: 100%;
  max-width: 100%;
  overscroll-behavior: none;
}

body {
  margin: 0;
  min-height: 100%;
  overflow: hidden;
  touch-action: manipulation;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) 40px;
  background: var(--bg);
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-weight: 400;
}

strong {
  font-weight: 650;
}

.topbar {
  min-height: 58px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 14px;
  border-bottom: 1px solid var(--border);
  background: color-mix(in srgb, var(--surface) 94%, transparent);
  box-shadow: 0 8px 22px var(--shadow);
  position: relative;
  z-index: 3;
}

.brand {
  display: flex;
  align-items: center;
  min-width: 230px;
}

.brand-copy {
  min-width: 0;
  padding-left: 12px;
  border-left: 3px solid #34d399;
}

h1,
h2,
p {
  margin: 0;
}

h1 {
  font-size: 17px;
  font-weight: 750;
  line-height: 1.05;
  letter-spacing: 0;
  color: var(--text);
}

#statusLine {
  margin-top: 4px;
  color: #34d399;
  font-size: 11px;
  font-weight: 700;
  line-height: 1.2;
  text-transform: uppercase;
}

.controls {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.controls-toggle {
  display: none;
}

.menu-icon,
.menu-icon::before,
.menu-icon::after {
  display: block;
  width: 18px;
  height: 2px;
  border-radius: 999px;
  background: currentColor;
}

.menu-icon {
  position: relative;
}

.menu-icon::before,
.menu-icon::after {
  content: "";
  position: absolute;
  left: 0;
}

.menu-icon::before {
  top: -6px;
}

.menu-icon::after {
  top: 6px;
}

.controls label,
.controls button,
.controls select,
.controls input[type="search"],
.controls input[type="number"] {
  min-height: 34px;
  border: 1px solid var(--border);
  background: var(--surface-strong);
  color: var(--text);
  border-radius: 7px;
  padding: 5px 8px;
  font-size: 12px;
}

.controls label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.controls select {
  min-height: 24px;
  padding: 3px 6px;
}

.controls input[type="search"] {
  width: 160px;
  min-height: 24px;
  padding: 4px 8px;
}

.controls input[type="number"] {
  width: 46px;
  min-height: 24px;
  padding: 3px 5px;
}

.search-control,
.select-control,
.range-control,
.check-control {
  padding: 4px 7px;
}

.controls button {
  cursor: pointer;
}

.controls button:hover {
  border-color: var(--accent);
}

.step-button {
  min-width: 24px;
  min-height: 24px;
  padding: 2px 7px;
  font-weight: 650;
}

.shell {
  min-height: 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 320px;
}

.graph-wrap {
  position: relative;
  min-width: 0;
  min-height: 0;
}

.stage-label {
  position: absolute;
  top: 14px;
  right: 14px;
  z-index: 2;
  pointer-events: none;
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 6px 10px;
  background: var(--surface-glass);
  color: var(--text);
  font-size: 12px;
  font-weight: 750;
  letter-spacing: 0;
  box-shadow: 0 10px 24px var(--shadow);
}

#graphCanvas {
  width: 100%;
  height: 100%;
  display: block;
  cursor: grab;
  touch-action: none;
}

#graphCanvas.dragging {
  cursor: grabbing;
}

.graph-hint {
  position: absolute;
  left: 16px;
  bottom: 14px;
  padding: 7px 10px;
  border-radius: 8px;
  background: color-mix(in srgb, var(--surface) 86%, transparent);
  border: 1px solid var(--border);
  color: var(--muted);
  font-size: 12px;
  pointer-events: none;
}

.graph-quick-controls {
  position: absolute;
  left: 12px;
  top: 12px;
  z-index: 4;
  display: none;
  gap: 6px;
}

.graph-quick-controls button {
  min-height: 34px;
  border: 1px solid color-mix(in srgb, var(--border) 78%, transparent);
  border-radius: 8px;
  background: color-mix(in srgb, var(--surface) 88%, transparent);
  color: var(--text);
  padding: 6px 9px;
  font: inherit;
  font-size: 12px;
  font-weight: 600;
  box-shadow: 0 10px 24px color-mix(in srgb, var(--shadow) 34%, transparent);
  cursor: pointer;
}

.graph-quick-controls button:hover,
.graph-quick-controls button:focus-visible {
  border-color: color-mix(in srgb, var(--accent) 72%, var(--border));
  outline: none;
  box-shadow:
    0 0 0 2px color-mix(in srgb, var(--accent) 26%, transparent),
    0 10px 24px color-mix(in srgb, var(--shadow) 34%, transparent);
}

.tooltip {
  position: absolute;
  width: min(310px, calc(100% - 24px));
  max-width: 310px;
  padding: 9px 10px;
  border-radius: 8px;
  background: var(--surface);
  border: 1px solid var(--border);
  box-shadow: 0 12px 30px var(--shadow);
  color: var(--text);
  font-size: 12px;
  pointer-events: none;
  z-index: 5;
}

.tooltip-head {
  display: flex;
  align-items: center;
  gap: 9px;
  margin-bottom: 8px;
}

.tooltip-title {
  font-size: 13px;
  font-weight: 650;
  line-height: 1.2;
}

.tooltip-muted {
  color: var(--muted);
  font-size: 11px;
  line-height: 1.35;
}

.tooltip-flag,
.tooltip-mini-flags img {
  border-radius: 50%;
  object-fit: cover;
  background: #f8fafc;
  border: 1px solid var(--border);
}

.tooltip-flag {
  width: 34px;
  height: 34px;
  flex: 0 0 auto;
}

.tooltip-emoji {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--surface-strong);
}

.tooltip-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px;
  margin: 8px 0;
}

.tooltip-grid > div,
.tooltip-stat {
  border: 1px solid var(--border);
  background: var(--surface-strong);
  border-radius: 7px;
  padding: 7px;
}

.tooltip-grid span,
.tooltip-stat span {
  display: block;
  color: var(--muted);
  font-size: 10px;
  margin-bottom: 2px;
}

.tooltip-grid strong,
.tooltip-stat strong {
  display: block;
  font-size: 12px;
  line-height: 1.25;
}

.tooltip-mini-flags {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-top: 8px;
}

.tooltip-mini-flags img,
.tooltip-mini-flags span {
  width: 22px;
  height: 22px;
}

.panel {
  border-left: 1px solid var(--border);
  background:
    linear-gradient(180deg, color-mix(in srgb, var(--surface) 96%, #38bdf8 4%), var(--surface));
  overflow: auto;
  padding: 18px;
}

.panel-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding-bottom: 14px;
  border-bottom: 1px solid color-mix(in srgb, var(--border) 76%, transparent);
}

.panel-title {
  min-width: 0;
}

.panel-tools {
  display: none;
}

.panel-tools button {
  border: 1px solid var(--border);
  border-radius: 7px;
  background: var(--surface-strong);
  color: var(--text);
  min-height: 28px;
  padding: 4px 8px;
  font: inherit;
  font-size: 12px;
  cursor: pointer;
}

.eyebrow {
  color: color-mix(in srgb, var(--muted) 72%, #38bdf8);
  font-size: 11px;
  text-transform: uppercase;
  font-weight: 650;
  letter-spacing: 0.08em;
  margin-bottom: 6px;
}

.panel h2 {
  font-size: 22px;
  font-weight: 650;
  line-height: 1.2;
  color: var(--text);
}

.detail-body {
  padding-top: 14px;
  display: grid;
  gap: 12px;
}

.info-section {
  display: grid;
  gap: 8px;
}

.info-section h3 {
  margin: 2px 0 0;
  font-size: 13px;
  line-height: 1.2;
  color: var(--muted);
  text-transform: uppercase;
  font-weight: 650;
  letter-spacing: 0.08em;
}

.section-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.panel-micro-button {
  appearance: none;
  border: 1px solid color-mix(in srgb, var(--border) 82%, transparent);
  border-radius: 999px;
  background: color-mix(in srgb, var(--surface-strong) 94%, #38bdf8 6%);
  color: var(--text);
  padding: 4px 8px;
  font: inherit;
  font-size: 11px;
  font-weight: 650;
  cursor: pointer;
}

.panel-micro-button:hover,
.panel-micro-button:focus-visible {
  border-color: color-mix(in srgb, var(--accent) 72%, var(--border));
  outline: none;
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--accent) 24%, transparent);
}

.metric {
  position: relative;
  overflow: hidden;
  border: 1px solid color-mix(in srgb, var(--border) 78%, transparent);
  background:
    linear-gradient(135deg, color-mix(in srgb, var(--surface-strong) 94%, #ffffff 6%), var(--surface-strong));
  border-radius: 10px;
  padding: 11px 12px 11px 14px;
  box-shadow:
    inset 0 1px 0 color-mix(in srgb, #ffffff 8%, transparent),
    0 10px 24px color-mix(in srgb, var(--shadow) 42%, transparent);
}

.metric::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 4px;
  background: #94a3b8;
}

.metric::after {
  content: "";
  position: absolute;
  inset: 0 0 auto;
  height: 1px;
  background: linear-gradient(90deg, color-mix(in srgb, #ffffff 22%, transparent), transparent);
}

.metric-group::before,
.metric-publication::before {
  background: #38bdf8;
}

.metric-champion::before,
.metric-probability::before {
  background: #facc15;
}

.metric-round::before,
.metric-weather::before {
  background: #22c55e;
}

.metric-final::before {
  background: #a855f7;
}

.metric-fixtures::before {
  background: #14b8a6;
}

.metric-missing::before {
  background: #fb7185;
}

.metric-label {
  color: color-mix(in srgb, var(--muted) 86%, var(--text));
  font-size: 11px;
  margin-bottom: 5px;
  font-weight: 500;
}

.metric-value {
  font-size: 20px;
  font-weight: 700;
  letter-spacing: 0;
}

.badge-row {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

.badge {
  padding: 5px 7px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--surface-strong) 94%, #ffffff 4%);
  color: var(--text);
  border: 1px solid color-mix(in srgb, var(--border) 78%, transparent);
  font-size: 12px;
  font-weight: 550;
}

.panel-action {
  width: 100%;
  appearance: none;
  border: 0;
  font: inherit;
  color: inherit;
  text-align: left;
  cursor: pointer;
}

.panel-action:hover,
.panel-action:focus-visible {
  border-color: color-mix(in srgb, var(--accent) 72%, var(--border));
  outline: none;
  box-shadow:
    inset 0 1px 0 color-mix(in srgb, #ffffff 9%, transparent),
    0 0 0 2px color-mix(in srgb, var(--accent) 28%, transparent);
}

.summary-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.summary-card {
  position: relative;
  overflow: hidden;
  border: 1px solid color-mix(in srgb, var(--border) 80%, transparent);
  border-radius: 10px;
  background:
    linear-gradient(135deg, color-mix(in srgb, var(--surface-strong) 92%, #38bdf8 8%), var(--surface-strong));
  padding: 10px 10px 10px 14px;
  box-shadow: inset 0 1px 0 color-mix(in srgb, #ffffff 7%, transparent);
}

.summary-card::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 4px;
  background: #38bdf8;
}

.summary-card span {
  display: block;
  color: var(--muted);
  font-size: 11px;
  font-weight: 500;
}

.summary-card strong {
  display: block;
  margin-top: 4px;
  font-size: 20px;
  font-weight: 700;
  line-height: 1;
}

.summary-groups::before {
  background: #a855f7;
}

.summary-fixtures::before {
  background: #14b8a6;
}

.summary-knockout::before {
  background: #94a3b8;
}

.agent-review-section {
  gap: 10px;
}

.agent-review-grid .summary-card strong {
  font-size: 17px;
  line-height: 1.1;
}

.agent-review-reason {
  border-left: 4px solid #38bdf8;
}

.agent-review-list {
  gap: 7px;
}

.agent-review-row {
  position: relative;
  display: grid;
  grid-template-columns: 54px minmax(0, 1fr);
  gap: 8px;
  align-items: start;
  border: 1px solid color-mix(in srgb, var(--border) 78%, transparent);
  border-radius: 10px;
  background: color-mix(in srgb, var(--surface-strong) 92%, #ffffff 5%);
  padding: 8px 9px;
}

.agent-review-row > span {
  border-radius: 999px;
  padding: 4px 6px;
  text-align: center;
  font-size: 10px;
  font-weight: 650;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.agent-review-row strong {
  display: block;
  color: var(--text);
  font-size: 12px;
  font-weight: 650;
}

.agent-review-row small {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.3;
}

.review-pass > span {
  background: color-mix(in srgb, #22c55e 18%, var(--surface-strong));
  color: color-mix(in srgb, #22c55e 88%, var(--text));
}

.review-warn > span {
  background: color-mix(in srgb, #facc15 18%, var(--surface-strong));
  color: color-mix(in srgb, #ca8a04 88%, var(--text));
}

.review-block > span {
  background: color-mix(in srgb, #fb7185 18%, var(--surface-strong));
  color: color-mix(in srgb, #fb7185 88%, var(--text));
}

.summary-live::before {
  background: #22c55e;
}

.summary-completed::before {
  background: #facc15;
}

.match-filter-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.match-filter {
  display: grid;
  gap: 5px;
  border: 1px solid color-mix(in srgb, var(--border) 80%, transparent);
  border-radius: 10px;
  background: color-mix(in srgb, var(--surface-strong) 92%, #38bdf8 8%);
  padding: 8px;
}

.match-filter span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 550;
}

.match-filter select {
  width: 100%;
  min-width: 0;
  border: 1px solid var(--border);
  border-radius: 7px;
  background: var(--surface);
  color: var(--text);
  padding: 6px 7px;
  font: inherit;
  font-size: 12px;
}

.group-preview-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.group-preview-card {
  display: grid;
  gap: 9px;
  border: 1px solid color-mix(in srgb, var(--border) 80%, transparent);
  border-radius: 10px;
  background:
    linear-gradient(135deg, color-mix(in srgb, var(--surface-strong) 88%, var(--group-color) 12%), var(--surface-strong));
  padding: 9px;
  box-shadow: inset 0 1px 0 color-mix(in srgb, #ffffff 7%, transparent);
}

.group-preview-head {
  display: grid;
  gap: 2px;
}

.group-preview-head strong {
  font-size: 13px;
  font-weight: 650;
}

.group-preview-head span {
  color: var(--muted);
  font-size: 10px;
  line-height: 1.2;
}

.group-preview-standings {
  display: grid;
  gap: 4px;
}

.group-preview-standing {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  min-width: 0;
  font-size: 11px;
}

.group-preview-standing span {
  min-width: 0;
  overflow: hidden;
  color: var(--text);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.group-preview-standing strong {
  flex: 0 0 auto;
  color: var(--group-color);
  font-size: 11px;
  font-weight: 700;
}

.group-preview-flags {
  display: flex;
  align-items: center;
}

.group-preview-flags img,
.group-preview-flags span {
  width: 22px;
  height: 22px;
  margin-right: -4px;
  border-radius: 50%;
  object-fit: cover;
  background: #f8fafc;
  border: 1px solid color-mix(in srgb, var(--border) 70%, transparent);
}

.top-list {
  display: grid;
  gap: 8px;
}

.top-row {
  display: grid;
  grid-template-columns: 30px minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  border: 1px solid color-mix(in srgb, var(--border) 80%, transparent);
  background:
    linear-gradient(135deg, color-mix(in srgb, var(--surface-strong) 94%, #38bdf8 6%), var(--surface-strong));
  border-radius: 10px;
  padding: 9px 10px;
  box-shadow: inset 0 1px 0 color-mix(in srgb, #ffffff 7%, transparent);
}

.simulation-row {
  grid-template-columns: minmax(0, 1fr) auto;
}

.top-flag {
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  overflow: hidden;
  border-radius: 50%;
  background: #f8fafc;
  border: 1px solid color-mix(in srgb, var(--border) 72%, transparent);
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--surface-strong) 78%, transparent);
}

.top-flag img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
}

.top-flag span {
  font-size: 18px;
  line-height: 1;
}

.team-summary-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  border: 1px solid color-mix(in srgb, var(--border) 80%, transparent);
  background:
    linear-gradient(135deg, color-mix(in srgb, var(--surface-strong) 94%, #38bdf8 6%), var(--surface-strong));
  border-radius: 10px;
  padding: 9px 10px;
  box-shadow: inset 0 1px 0 color-mix(in srgb, #ffffff 7%, transparent);
}

.team-summary-name {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 8px;
}

.team-summary-name img {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  object-fit: cover;
  background: #f8fafc;
  border: 1px solid var(--border);
  flex: 0 0 auto;
}

.team-summary-name strong,
.team-summary-name span {
  display: block;
}

.team-summary-name strong {
  font-size: 13px;
}

.team-summary-name span {
  color: var(--muted);
  font-size: 11px;
  margin-top: 2px;
}

.top-name {
  font-size: 13px;
  font-weight: 650;
}

.top-sub {
  margin-top: 2px;
  color: var(--muted);
  font-size: 11px;
}

.top-value {
  font-size: 14px;
  font-weight: 700;
  color: var(--accent);
}

.team-profile {
  display: grid;
  gap: 10px;
  border: 1px solid color-mix(in srgb, var(--border) 76%, transparent);
  border-radius: 12px;
  background:
    linear-gradient(135deg, color-mix(in srgb, var(--surface-strong) 88%, #38bdf8 12%), var(--surface-strong));
  padding: 12px;
  box-shadow:
    inset 0 1px 0 color-mix(in srgb, #ffffff 8%, transparent),
    0 12px 26px color-mix(in srgb, var(--shadow) 36%, transparent);
}

.team-profile-main {
  display: grid;
  grid-template-columns: 48px minmax(0, 1fr);
  gap: 11px;
  align-items: center;
}

.team-profile-flag {
  width: 48px;
  height: 48px;
  display: grid;
  place-items: center;
  overflow: hidden;
  border-radius: 50%;
  background: #f8fafc;
  border: 1px solid var(--border);
  box-shadow: 0 0 0 5px color-mix(in srgb, var(--surface-strong) 70%, transparent);
}

.team-profile-flag img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
}

.team-profile-flag span {
  font-size: 28px;
  line-height: 1;
}

.team-profile p,
.team-profile span {
  color: var(--muted);
  font-size: 12px;
}

.team-profile h3 {
  margin: 1px 0 3px;
  color: var(--text);
  font-size: 20px;
  font-weight: 650;
  line-height: 1.1;
  text-transform: none;
  letter-spacing: 0;
}

.team-profile-prob {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border: 1px solid color-mix(in srgb, var(--border) 78%, transparent);
  border-radius: 9px;
  background:
    linear-gradient(135deg, color-mix(in srgb, var(--surface-strong) 96%, #ffffff 4%), var(--surface-strong));
  padding: 8px 10px;
}

.team-profile-prob strong {
  color: var(--accent);
  font-size: 20px;
  font-weight: 700;
}

.knockout-team-card {
  background:
    linear-gradient(135deg, color-mix(in srgb, var(--surface-strong) 90%, #8b5cf6 10%), var(--surface-strong));
}

.knockout-team-card strong {
  display: block;
  color: var(--text);
  font-size: 18px;
  font-weight: 650;
  line-height: 1.15;
}

.knockout-team-card small {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.25;
}

.path-panel {
  position: relative;
  overflow: hidden;
  border: 1px solid color-mix(in srgb, var(--border) 78%, transparent);
  border-radius: 12px;
  background:
    radial-gradient(circle at 0 0, color-mix(in srgb, #38bdf8 16%, transparent), transparent 34%),
    linear-gradient(135deg, color-mix(in srgb, var(--surface-strong) 90%, #14b8a6 10%), var(--surface-strong));
  padding: 12px;
  box-shadow:
    inset 0 1px 0 color-mix(in srgb, #ffffff 8%, transparent),
    0 12px 28px color-mix(in srgb, var(--shadow) 34%, transparent);
}

.path-panel-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: start;
}

.path-panel-head h3 {
  margin: 0 0 4px;
  color: var(--text);
  font-size: 14px;
  font-weight: 650;
  text-transform: none;
  letter-spacing: 0;
}

.path-panel-head p {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
}

.path-panel-head > span {
  border: 1px solid color-mix(in srgb, var(--border) 74%, transparent);
  border-radius: 999px;
  background: color-mix(in srgb, var(--surface-strong) 92%, #ffffff 5%);
  color: var(--text);
  padding: 4px 8px;
  font-size: 11px;
  font-weight: 650;
}

.path-stage-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.path-stage-card {
  position: relative;
  overflow: hidden;
  display: grid;
  gap: 4px;
  border: 1px solid color-mix(in srgb, var(--border) 78%, transparent);
  border-radius: 10px;
  background: color-mix(in srgb, var(--surface-strong) 90%, #38bdf8 10%);
  padding: 9px 10px 9px 13px;
}

.path-stage-card::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 4px;
  background: #38bdf8;
}

.path-stage-slot {
  background: color-mix(in srgb, var(--surface-strong) 88%, #a855f7 12%);
}

.path-stage-slot::before {
  background: #a855f7;
}

.path-stage-card span,
.path-stage-card small {
  color: var(--muted);
  font-size: 11px;
}

.path-stage-card strong {
  color: var(--text);
  font-size: 13px;
  font-weight: 650;
}

.probability-path {
  display: grid;
  gap: 8px;
  border: 1px solid color-mix(in srgb, var(--border) 76%, transparent);
  border-radius: 10px;
  background: color-mix(in srgb, var(--surface-strong) 92%, #facc15 8%);
  padding: 9px;
}

.probability-step {
  display: grid;
  gap: 5px;
}

.probability-step > div {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  color: var(--muted);
  font-size: 11px;
}

.probability-step strong {
  color: var(--text);
  font-size: 12px;
  font-weight: 650;
}

.probability-step i {
  display: block;
  height: 7px;
  overflow: hidden;
  border-radius: 999px;
  background: color-mix(in srgb, var(--surface) 82%, #94a3b8 18%);
}

.probability-step i::before {
  content: "";
  display: block;
  width: calc(var(--probability) * 100%);
  min-width: 2px;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #22c55e, #facc15);
}

.path-chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.path-chip-row span {
  display: inline-grid;
  gap: 2px;
  border: 1px solid color-mix(in srgb, var(--border) 78%, transparent);
  border-radius: 999px;
  background: color-mix(in srgb, var(--surface-strong) 88%, #ffffff 6%);
  color: var(--text);
  padding: 5px 8px;
  font-size: 11px;
  font-weight: 600;
}

.path-chip-row small {
  color: var(--muted);
  font-size: 9px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.path-subsection {
  display: grid;
  gap: 7px;
}

.path-subsection h4 {
  margin: 0;
  color: var(--muted);
  font-size: 11px;
  font-weight: 650;
  text-transform: uppercase;
  letter-spacing: 0.07em;
}

.path-fixture-list,
.path-opponent-list {
  display: grid;
  gap: 7px;
}

.fixture-timeline {
  position: relative;
  display: grid;
  gap: 7px;
}

.fixture-timeline::before {
  content: "";
  position: absolute;
  inset: 8px auto 8px 14px;
  width: 2px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--border) 62%, #38bdf8);
}

.timeline-item {
  position: relative;
  display: grid;
  grid-template-columns: 30px minmax(0, 1fr);
  gap: 9px;
  align-items: center;
  border: 1px solid color-mix(in srgb, var(--border) 80%, transparent);
  border-radius: 10px;
  background:
    linear-gradient(135deg, color-mix(in srgb, var(--surface-strong) 96%, #ffffff 4%), var(--surface-strong));
  padding: 8px 9px;
  box-shadow: inset 0 1px 0 color-mix(in srgb, #ffffff 7%, transparent);
}

.timeline-item > span {
  z-index: 1;
  width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  border: 1px solid color-mix(in srgb, var(--border) 70%, transparent);
  border-radius: 50%;
  background: color-mix(in srgb, var(--surface-strong) 92%, #ffffff 5%);
  color: var(--text);
  font-size: 11px;
  font-weight: 650;
}

.timeline-item.status-completed {
  background:
    linear-gradient(135deg, color-mix(in srgb, var(--surface-strong) 96%, #ffffff 4%), var(--surface-strong));
  border-color: color-mix(in srgb, var(--border) 70%, transparent);
}

.timeline-item.status-completed > span {
  border-color: color-mix(in srgb, var(--border) 52%, #22c55e);
  background: color-mix(in srgb, var(--surface-strong) 78%, #22c55e 22%);
}

.timeline-item.status-upcoming {
  background:
    linear-gradient(135deg, color-mix(in srgb, var(--surface-strong) 96%, #ffffff 4%), var(--surface-strong));
  border-color: color-mix(in srgb, var(--border) 70%, transparent);
}

.timeline-item.status-upcoming > span {
  border-color: color-mix(in srgb, var(--border) 56%, #38bdf8);
  background: color-mix(in srgb, var(--surface-strong) 82%, #38bdf8 18%);
}

.timeline-item.status-live {
  background:
    linear-gradient(135deg, color-mix(in srgb, var(--surface-strong) 96%, #ffffff 4%), var(--surface-strong));
  border-color: color-mix(in srgb, var(--border) 70%, transparent);
}

.timeline-item.status-live > span {
  border-color: color-mix(in srgb, var(--border) 50%, #22c55e);
  background: color-mix(in srgb, var(--surface-strong) 80%, #22c55e 20%);
}

.timeline-item strong,
.timeline-item small {
  display: block;
}

.timeline-item strong {
  font-size: 12px;
  font-weight: 650;
}

.timeline-item small {
  margin-top: 2px;
  color: var(--muted);
  font-size: 11px;
}

.path-fixture-row,
.path-opponent-row {
  border: 1px solid color-mix(in srgb, var(--border) 80%, transparent);
  border-radius: 10px;
  background:
    linear-gradient(135deg, color-mix(in srgb, var(--surface-strong) 96%, #ffffff 4%), var(--surface-strong));
  box-shadow: inset 0 1px 0 color-mix(in srgb, #ffffff 7%, transparent);
}

.path-fixture-row {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 8px;
  align-items: center;
  padding: 8px 9px;
}

.path-fixture-row span,
.path-fixture-row em {
  color: var(--muted);
  font-size: 11px;
  font-style: normal;
}

.path-fixture-row strong {
  min-width: 0;
  overflow: hidden;
  color: var(--text);
  font-size: 12px;
  font-weight: 650;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.path-fixture-row em {
  justify-self: end;
}

.path-fixture-row.status-completed {
  background:
    linear-gradient(135deg, color-mix(in srgb, var(--surface-strong) 96%, #ffffff 4%), var(--surface-strong));
  border-color: color-mix(in srgb, var(--border) 70%, transparent);
}

.path-fixture-row.status-upcoming {
  background:
    linear-gradient(135deg, color-mix(in srgb, var(--surface-strong) 88%, #38bdf8 12%), var(--surface-strong));
  border-color: color-mix(in srgb, var(--border) 54%, #38bdf8);
}

.path-fixture-row.status-live {
  background:
    linear-gradient(135deg, color-mix(in srgb, var(--surface-strong) 86%, #22c55e 14%), var(--surface-strong));
  border-color: color-mix(in srgb, var(--border) 50%, #22c55e);
}

.path-opponent-row {
  display: grid;
  grid-template-columns: 30px minmax(0, 1fr);
  gap: 9px;
  align-items: center;
  padding: 8px 9px;
}

.path-opponent-flag {
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  overflow: hidden;
  border-radius: 50%;
  background: #f8fafc;
  border: 1px solid color-mix(in srgb, var(--border) 72%, transparent);
}

.path-opponent-flag img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
}

.path-opponent-row strong,
.path-opponent-row small {
  display: block;
}

.path-opponent-row strong {
  font-size: 12px;
  font-weight: 650;
}

.path-opponent-row small {
  margin-top: 2px;
  color: var(--muted);
  font-size: 11px;
}

.compare-panel {
  position: relative;
  overflow: hidden;
  border: 1px solid color-mix(in srgb, var(--border) 78%, transparent);
  border-radius: 12px;
  background:
    radial-gradient(circle at 100% 0, color-mix(in srgb, #a855f7 16%, transparent), transparent 34%),
    linear-gradient(135deg, color-mix(in srgb, var(--surface-strong) 92%, #38bdf8 8%), var(--surface-strong));
  padding: 12px;
  box-shadow:
    inset 0 1px 0 color-mix(in srgb, #ffffff 8%, transparent),
    0 12px 28px color-mix(in srgb, var(--shadow) 32%, transparent);
}

.compare-panel-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: start;
}

.compare-panel-head h3 {
  margin: 0 0 4px;
  color: var(--text);
  font-size: 14px;
  font-weight: 650;
  text-transform: none;
  letter-spacing: 0;
}

.compare-panel-head p {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
}

.compare-clear {
  width: auto;
  border: 1px solid color-mix(in srgb, var(--border) 70%, #fb7185);
  border-radius: 999px;
  background: color-mix(in srgb, var(--surface-strong) 82%, #fb7185 18%);
  color: var(--text);
  padding: 5px 9px;
  font-size: 11px;
  font-weight: 650;
}

.compare-candidate-list,
.compare-status-list {
  display: grid;
  gap: 8px;
}

.compare-candidate-row {
  display: grid;
  grid-template-columns: 30px minmax(0, 1fr) auto;
  gap: 9px;
  align-items: center;
  border: 1px solid color-mix(in srgb, var(--border) 80%, transparent);
  border-radius: 10px;
  background:
    linear-gradient(135deg, color-mix(in srgb, var(--surface-strong) 92%, #38bdf8 8%), var(--surface-strong));
  padding: 8px 9px;
  box-shadow: inset 0 1px 0 color-mix(in srgb, #ffffff 7%, transparent);
}

.compare-candidate-row strong,
.compare-candidate-row small,
.compare-candidate-row em {
  display: block;
}

.compare-candidate-row strong {
  font-size: 12px;
  font-weight: 650;
}

.compare-candidate-row small {
  margin-top: 2px;
  color: var(--muted);
  font-size: 11px;
}

.compare-candidate-row em {
  border: 1px solid color-mix(in srgb, var(--border) 58%, #38bdf8);
  border-radius: 999px;
  background: color-mix(in srgb, var(--surface-strong) 80%, #38bdf8 20%);
  color: var(--text);
  padding: 4px 7px;
  font-size: 10px;
  font-style: normal;
  font-weight: 650;
}

.compare-flag {
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  overflow: hidden;
  border-radius: 50%;
  background: #f8fafc;
  border: 1px solid color-mix(in srgb, var(--border) 72%, transparent);
}

.compare-flag img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
}

.compare-team-pair {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.compare-team-card {
  display: grid;
  gap: 7px;
  min-width: 0;
  border: 1px solid color-mix(in srgb, var(--border) 78%, transparent);
  border-radius: 10px;
  background:
    linear-gradient(135deg, color-mix(in srgb, var(--surface-strong) 90%, #14b8a6 10%), var(--surface-strong));
  padding: 9px;
}

.compare-team-card > span,
.compare-team-card small {
  color: var(--muted);
  font-size: 11px;
}

.compare-team-card > div {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 8px;
}

.compare-team-card strong {
  min-width: 0;
  overflow: hidden;
  font-size: 13px;
  font-weight: 650;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.compare-metric-grid {
  display: grid;
  gap: 7px;
}

.compare-metric-row {
  display: grid;
  grid-template-columns: minmax(72px, 0.75fr) minmax(0, 1fr) minmax(0, 1fr);
  gap: 8px;
  align-items: center;
  border: 1px solid color-mix(in srgb, var(--border) 80%, transparent);
  border-radius: 10px;
  background:
    linear-gradient(135deg, color-mix(in srgb, var(--surface-strong) 94%, #ffffff 5%), var(--surface-strong));
  padding: 8px 9px;
  box-shadow: inset 0 1px 0 color-mix(in srgb, #ffffff 7%, transparent);
}

.compare-metric-row span {
  color: var(--muted);
  font-size: 11px;
}

.compare-metric-row strong {
  min-width: 0;
  overflow: hidden;
  color: var(--text);
  font-size: 12px;
  font-weight: 650;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.fixture-list {
  display: grid;
  gap: 8px;
}

.fixture-row {
  display: grid;
  gap: 8px;
  border: 1px solid color-mix(in srgb, var(--border) 80%, transparent);
  border-radius: 10px;
  background:
    linear-gradient(135deg, color-mix(in srgb, var(--surface-strong) 93%, #14b8a6 7%), var(--surface-strong));
  padding: 9px 10px;
}

.fixture-teams {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  gap: 8px;
  align-items: center;
}

.fixture-team {
  min-width: 0;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.fixture-team:last-child {
  justify-content: flex-end;
}

.fixture-team strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 12px;
}

.fixture-flag {
  width: 23px;
  height: 23px;
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  overflow: hidden;
  border-radius: 50%;
  background: #f8fafc;
  border: 1px solid var(--border);
}

.fixture-flag img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
}

.fixture-score,
.fixture-meta span {
  color: var(--muted);
  font-size: 11px;
}

.fixture-score {
  min-width: 30px;
  justify-self: center;
  display: inline-grid;
  place-items: center;
  border: 1px solid color-mix(in srgb, var(--border) 80%, transparent);
  border-radius: 999px;
  background: color-mix(in srgb, var(--surface-strong) 82%, #94a3b8 18%);
  padding: 3px 6px;
  font-weight: 650;
}

.fixture-score.is-final {
  color: var(--accent);
  background: color-mix(in srgb, var(--surface-strong) 78%, #facc15 22%);
  border-color: color-mix(in srgb, var(--border) 48%, #facc15);
}

.fixture-meta {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 8px;
  align-items: center;
  color: var(--muted);
  font-size: 11px;
}

.fixture-meta strong {
  color: var(--text);
  font-size: 11px;
}

.fixture-meta span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.fixture-meta em {
  justify-self: end;
  padding: 2px 6px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--surface-strong) 86%, #14b8a6 14%);
  border: 1px solid color-mix(in srgb, var(--border) 70%, #14b8a6);
  color: var(--muted);
  font-size: 10px;
  font-style: normal;
  font-weight: 550;
}

.fixture-row.has-result .fixture-meta em {
  color: var(--accent);
  background: color-mix(in srgb, var(--surface-strong) 76%, #facc15 24%);
  border-color: color-mix(in srgb, var(--border) 48%, #facc15);
}

.fixture-row.status-live {
  background:
    linear-gradient(135deg, color-mix(in srgb, var(--surface-strong) 82%, #22c55e 18%), var(--surface-strong));
}

.fixture-row.has-result {
  background:
    linear-gradient(135deg, color-mix(in srgb, var(--surface-strong) 84%, #facc15 16%), var(--surface-strong));
}

.fixture-detail-score {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  align-items: center;
  gap: 8px;
  border: 1px solid color-mix(in srgb, var(--border) 70%, #facc15);
  border-radius: 12px;
  background:
    linear-gradient(135deg, color-mix(in srgb, var(--surface-strong) 84%, #facc15 16%), var(--surface-strong));
  padding: 10px;
}

.fixture-detail-score > strong {
  color: var(--accent);
  font-size: 18px;
}

.event-row {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
  border: 1px solid color-mix(in srgb, var(--border) 82%, transparent);
  border-radius: 10px;
  background: color-mix(in srgb, var(--surface-strong) 92%, #ffffff 5%);
  padding: 8px 9px;
}

.event-row > span {
  color: var(--accent);
  font-weight: 650;
}

.event-row strong,
.event-row small {
  display: block;
}

.event-row small,
.event-row em {
  color: var(--muted);
  font-size: 11px;
  font-style: normal;
}

.event-goal {
  border-color: color-mix(in srgb, var(--border) 55%, #22c55e);
}

.event-yellow_card {
  border-color: color-mix(in srgb, var(--border) 45%, #facc15);
}

.event-red_card {
  border-color: color-mix(in srgb, var(--border) 45%, #fb7185);
}

.badge-result {
  background: color-mix(in srgb, var(--surface-strong) 94%, #ffffff 4%);
  border-color: color-mix(in srgb, var(--border) 62%, #38bdf8);
}

.round-preview-list {
  display: grid;
  gap: 8px;
}

.round-preview-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  border: 1px solid color-mix(in srgb, var(--border) 80%, transparent);
  border-radius: 10px;
  background:
    linear-gradient(135deg, color-mix(in srgb, var(--surface-strong) 92%, #94a3b8 8%), var(--surface-strong));
  padding: 9px 10px;
}

.round-preview-row.is-current {
  border-color: color-mix(in srgb, var(--border) 50%, #facc15);
  background:
    linear-gradient(135deg, color-mix(in srgb, var(--surface-strong) 86%, #facc15 14%), var(--surface-strong));
}

.round-preview-row span {
  font-size: 12px;
  font-weight: 600;
}

.round-preview-row strong {
  color: var(--muted);
  font-size: 12px;
}

.standings-wrap {
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface-strong);
}

.standings-table {
  width: 100%;
  min-width: 360px;
  border-collapse: collapse;
  font-size: 12px;
}

.standings-table th,
.standings-table td {
  padding: 7px 8px;
  text-align: right;
  border-bottom: 1px solid var(--border);
}

.standings-table th:first-child,
.standings-table td:first-child {
  text-align: left;
  font-weight: 600;
}

.standings-table tbody tr:last-child td {
  border-bottom: 0;
}

.leader-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
}

.leader-card,
.compact-row,
.player-row,
.stat-pair > div,
.empty-note {
  border: 1px solid color-mix(in srgb, var(--border) 80%, transparent);
  border-radius: 10px;
  background:
    linear-gradient(135deg, color-mix(in srgb, var(--surface-strong) 94%, #ffffff 5%), var(--surface-strong));
  padding: 9px 10px;
  box-shadow: inset 0 1px 0 color-mix(in srgb, #ffffff 7%, transparent);
}

.leader-card,
.compact-row,
.player-row {
  position: relative;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.leader-card {
  padding-left: 14px;
}

.leader-card::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 4px;
  background: #94a3b8;
}

.leader-scorer {
  background:
    linear-gradient(135deg, color-mix(in srgb, var(--surface-strong) 96%, #ffffff 4%), var(--surface-strong));
  border-color: color-mix(in srgb, var(--border) 74%, transparent);
}

.leader-scorer::before {
  background: #facc15;
}

.leader-assist {
  background:
    linear-gradient(135deg, color-mix(in srgb, var(--surface-strong) 96%, #ffffff 4%), var(--surface-strong));
  border-color: color-mix(in srgb, var(--border) 74%, transparent);
}

.leader-assist::before {
  background: #38bdf8;
}

.leader-clean-sheet {
  background:
    linear-gradient(135deg, color-mix(in srgb, var(--surface-strong) 96%, #ffffff 4%), var(--surface-strong));
  border-color: color-mix(in srgb, var(--border) 74%, transparent);
}

.leader-clean-sheet::before {
  background: #22c55e;
}

.leader-card span,
.compact-row span,
.player-row span,
.stat-pair span {
  color: var(--muted);
  font-size: 12px;
}

.leader-card strong,
.compact-row strong,
.stat-pair strong {
  font-size: 13px;
  font-weight: 650;
  text-align: right;
}

.compact-list {
  display: grid;
  gap: 8px;
}

.player-row > div {
  min-width: 0;
  display: grid;
  gap: 3px;
}

.player-row strong {
  font-size: 13px;
  font-weight: 650;
}

.status-pill {
  flex: 0 0 auto;
  max-width: 120px;
  padding: 4px 6px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--surface-strong) 94%, #ffffff 4%);
  border: 1px solid color-mix(in srgb, var(--border) 78%, transparent);
  text-align: center;
}

.stat-pair {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.stat-pair > div {
  position: relative;
  overflow: hidden;
  display: grid;
  gap: 4px;
  padding-left: 14px;
}

.stat-pair > div::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 4px;
  background: #94a3b8;
}

.stat-pair > .card-yellow {
  background:
    linear-gradient(135deg, color-mix(in srgb, var(--surface-strong) 84%, #facc15 16%), var(--surface-strong));
  border-color: color-mix(in srgb, var(--border) 46%, #facc15);
}

.stat-pair > .card-yellow::before {
  background: #facc15;
}

.stat-pair > .card-red {
  background:
    linear-gradient(135deg, color-mix(in srgb, var(--surface-strong) 86%, #fb7185 14%), var(--surface-strong));
  border-color: color-mix(in srgb, var(--border) 50%, #fb7185);
}

.stat-pair > .card-red::before {
  background: #fb7185;
}

.empty-note {
  color: var(--muted);
  font-size: 12px;
}

.legend {
  height: 40px;
  display: flex;
  align-items: center;
  gap: 12px;
  overflow-x: auto;
  padding: 7px 14px;
  border-top: 1px solid var(--border);
  background: var(--surface);
}

.legend-item {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--muted);
  font-size: 12px;
}

.swatch {
  width: 10px;
  height: 10px;
  border-radius: 50%;
}

.qa-harness {
  position: fixed;
  left: 0;
  top: 0;
  width: 96px;
  height: 24px;
  overflow: visible;
  opacity: 0.01;
  z-index: 20;
  display: flex;
}

.qa-harness button {
  width: 24px;
  height: 24px;
  margin: 0;
  padding: 0;
}

.qa-harness pre {
  position: absolute;
  left: -10000px;
  top: 0;
  width: 1px;
  height: 1px;
  overflow: hidden;
  pointer-events: none;
  white-space: pre;
}

@media (max-width: 900px) {
  body {
    width: 100vw;
    max-width: 100vw;
    min-height: 100dvh;
    overflow: hidden;
    display: grid;
    grid-template-rows: auto minmax(0, 1fr) 38px;
  }

  .topbar {
    height: auto;
    align-items: center;
    flex-direction: row;
    flex-wrap: wrap;
    gap: 8px;
    padding: 7px 10px;
    width: 100vw;
    max-width: 100vw;
    overflow: hidden;
  }

  .brand {
    flex: 1 1 auto;
    min-width: 0;
  }

  .controls-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 auto;
    width: 44px;
    height: 44px;
    min-height: 44px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--surface-strong);
    color: var(--text);
    padding: 0;
  }

  .controls-toggle[aria-expanded="true"] {
    border-color: var(--accent);
    box-shadow: 0 0 0 1px color-mix(in srgb, var(--accent) 42%, transparent);
  }

  .controls {
    flex: 0 0 100%;
    order: 3;
    width: 100%;
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: 6px;
    overflow: hidden;
    padding: 8px;
    max-width: 100%;
    min-width: 0;
    border: 1px solid color-mix(in srgb, var(--border) 88%, transparent);
    border-radius: 10px;
    background: color-mix(in srgb, var(--surface) 96%, transparent);
    box-shadow: 0 14px 28px color-mix(in srgb, var(--shadow) 44%, transparent);
    max-height: 0;
    opacity: 0;
    transform: translateY(-6px);
    visibility: hidden;
    pointer-events: none;
    transition:
      max-height 220ms cubic-bezier(0.2, 0.8, 0.2, 1),
      opacity 160ms ease,
      transform 220ms cubic-bezier(0.2, 0.8, 0.2, 1),
      visibility 0s linear 220ms;
  }

  body[data-controls-open="true"] .controls {
    max-height: 220px;
    opacity: 1;
    transform: translateY(0);
    visibility: visible;
    pointer-events: auto;
    transition:
      max-height 240ms cubic-bezier(0.2, 0.8, 0.2, 1),
      opacity 160ms ease,
      transform 240ms cubic-bezier(0.2, 0.8, 0.2, 1),
      visibility 0s linear 0s;
  }

  .controls > * {
    min-width: 0;
  }

  .controls .desktop-control {
    display: none;
  }

  .controls .stage-control {
    display: none;
  }

  body[data-view-mode="round_of_32"] .controls .stage-control,
  body[data-view-mode="round_of_16"] .controls .stage-control,
  body[data-view-mode="quarterfinal"] .controls .stage-control,
  body[data-view-mode="semifinal"] .controls .stage-control,
  body[data-view-mode="final"] .controls .stage-control,
  body[data-view-mode="champion"] .controls .stage-control {
    display: inline-flex;
    justify-content: center;
  }

  body[data-view-mode="round_of_32"] .controls,
  body[data-view-mode="round_of_16"] .controls,
  body[data-view-mode="quarterfinal"] .controls,
  body[data-view-mode="semifinal"] .controls,
  body[data-view-mode="final"] .controls,
  body[data-view-mode="champion"] .controls {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .select-control {
    grid-column: 1 / -1;
    grid-row: 1;
    width: 100%;
  }

  #themeToggle {
    grid-column: 1;
    grid-row: 3;
    width: 100%;
  }

  .search-control {
    grid-column: 1 / -1;
    grid-row: 2;
    width: 100%;
  }

  .check-control {
    grid-column: 2;
    grid-row: 3;
    width: 100%;
  }

  #freezeToggle,
  #saveLayout,
  #resetLayout {
    grid-row: 4;
    width: 100%;
  }

  #freezeToggle {
    grid-column: 1;
  }

  #saveLayout {
    grid-column: 2;
  }

  #resetLayout {
    grid-column: 3;
  }

  .controls label,
  .controls button,
  .controls select,
  .controls input[type="search"],
  .controls input[type="number"] {
    min-height: 38px;
    padding: 7px 9px;
    font-size: 14px;
  }

  .select-control select,
  .search-control input[type="search"] {
    flex: 1 1 auto;
    min-width: 0;
  }

  .controls input[type="search"] {
    width: 100%;
  }

  .controls select {
    max-width: 100%;
    min-height: 28px;
    font-size: 14px;
  }

  .controls select option {
    font-size: 16px;
  }

  .shell {
    width: 100vw;
    max-width: 100vw;
    overflow: hidden;
    min-height: 0;
    grid-template-columns: 1fr;
  }

  .graph-wrap {
    width: 100vw;
    max-width: 100vw;
    min-height: 0;
    height: auto;
  }

  .graph-quick-controls {
    display: flex;
  }

  .stage-label {
    top: 10px;
    right: 10px;
    max-width: calc(100vw - 24px);
    padding: 5px 8px;
    font-size: 12px;
  }

  .graph-quick-controls button {
    min-height: 42px;
    min-width: 42px;
    padding: 8px 11px;
  }

  .panel {
    position: fixed;
    left: 10px;
    right: 10px;
    bottom: calc(38px + env(safe-area-inset-bottom, 0px));
    max-height: min(38dvh, 340px);
    border-left: 1px solid var(--border);
    border-top: 1px solid var(--border);
    border-radius: 12px 12px 0 0;
    box-shadow: 0 -14px 34px var(--shadow);
    z-index: 4;
    padding: 20px 12px calc(14px + env(safe-area-inset-bottom, 0px));
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
    will-change: max-height, transform, opacity;
    transition:
      max-height 260ms cubic-bezier(0.2, 0.8, 0.2, 1),
      transform 240ms cubic-bezier(0.2, 0.8, 0.2, 1),
      opacity 180ms ease;
  }

  .panel[data-drawer-dragging="true"] {
    max-height: var(--drawer-drag-height, min(38dvh, 340px));
    transform: none;
    transition: none;
  }

  .panel[data-drawer-state="expanded"] {
    max-height: min(76dvh, 680px);
  }

  .panel[data-selection-type="match_center"] {
    max-height: min(58dvh, 520px);
  }

  .panel[data-selection-type="match_center"][data-drawer-state="expanded"] {
    max-height: min(82dvh, 720px);
  }

  .panel[data-drawer-state="closed"] {
    transform: translateY(calc(100% + 16px));
    opacity: 0;
    pointer-events: none;
  }

  .panel::before {
    content: "";
    position: sticky;
    top: -12px;
    display: block;
    width: 42px;
    height: 4px;
    margin: -8px auto 10px;
    border-radius: 999px;
    background: color-mix(in srgb, var(--muted) 54%, transparent);
    z-index: 5;
  }

  .panel-header {
    position: sticky;
    top: -20px;
    z-index: 3;
    margin: -20px -12px 0;
    padding: 26px 12px 18px;
    cursor: grab;
    touch-action: none;
    user-select: none;
    background:
      linear-gradient(180deg, color-mix(in srgb, var(--surface) 96%, #38bdf8 4%), var(--surface));
    box-shadow:
      0 18px 24px color-mix(in srgb, var(--surface) 98%, transparent),
      0 1px 0 color-mix(in srgb, var(--border) 72%, transparent);
  }

  .panel[data-drawer-dragging="true"] .panel-header {
    cursor: grabbing;
  }

  .panel-tools {
    display: inline-flex;
    flex: 0 0 auto;
    gap: 6px;
  }

  .panel-tools button {
    min-height: 26px;
    padding: 3px 7px;
    font-size: 11px;
  }

  .panel h2 {
    font-size: 18px;
  }

  .detail-body {
    padding-top: 10px;
    gap: 9px;
  }

  .summary-grid,
  .group-preview-grid {
    gap: 7px;
  }

  .panel[data-selection-type="match_center"] .summary-grid {
    grid-template-columns: repeat(4, minmax(72px, 1fr));
    overflow-x: auto;
    padding-bottom: 2px;
    scroll-snap-type: x proximity;
  }

  .panel[data-selection-type="match_center"] .summary-card {
    min-width: 72px;
    scroll-snap-align: start;
  }

  .panel[data-selection-type="match_center"] .match-filter-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 7px;
  }

  .panel[data-selection-type="match_center"] .match-filter {
    padding: 7px;
  }

  .panel[data-selection-type="match_center"] .match-filter select {
    min-height: 36px;
    font-size: 13px;
  }

  .summary-card {
    padding: 9px 9px 9px 13px;
  }

  .summary-card strong {
    font-size: 18px;
  }

  .group-preview-card {
    gap: 7px;
    padding: 8px;
  }

  .group-preview-flags img,
  .group-preview-flags span {
    width: 20px;
    height: 20px;
  }

  .team-profile {
    padding: 10px;
  }

  .team-profile-main {
    grid-template-columns: 42px minmax(0, 1fr);
    gap: 10px;
  }

  .team-profile-flag {
    width: 42px;
    height: 42px;
  }

  .fixture-row,
  .top-row,
  .team-summary-row,
  .round-preview-row {
    padding: 8px;
  }

  .match-center-list {
    gap: 8px;
  }

  .match-center-list .fixture-row {
    align-items: stretch;
    gap: 9px;
  }

  .fixture-teams {
    grid-template-columns: minmax(0, 1fr) 34px minmax(0, 1fr);
    gap: 6px;
  }

  .fixture-meta {
    grid-template-columns: auto minmax(0, 1fr);
  }

  .fixture-meta em {
    grid-column: 1 / -1;
    justify-self: start;
  }

  .graph-hint {
    bottom: 10px;
    max-width: calc(100% - 24px);
    font-size: 11px;
  }

  .tooltip {
    max-width: min(300px, calc(100% - 24px));
  }
}
