:root {
  --bg: transparent;
  --card: #ffffff;
  --ink: #0f1b3d;
  --muted: #5b6b8c;
  --faint: #8d97ad;
  --line: #e9e2d3;
  --line-soft: #efeae0;
  --pill: #efebe2;
  --accent: #ff696c;
  --font: 'Roboto Mono', ui-monospace, SFMono-Regular, Menlo, monospace;
  --red: #e5484d;
  --green: #3fcf74;
  --green-bg: #effcf3;
  --green-ink: #1f9d55;
  --amber: #d98a06;
  --row-q: #f4f6fa;
  --radius: 16px;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 400 14px/1.45 var(--font);
  -webkit-font-smoothing: antialiased;
  text-transform: uppercase;
}
button, select { text-transform: inherit; }
h1, h2, h3 { font-family: var(--font); margin: 0; }

.rs-topbar { height: 8px; background: var(--accent); }
.rs { max-width: 1280px; margin: 0 auto; padding: 20px 16px 64px; }

/* ---- Navegación entre vistas */
.rs-nav { display: flex; gap: 24px; border-bottom: 1px solid var(--line); margin-bottom: 28px; overflow-x: auto; }
.rs-nav a {
  padding: 10px 0; margin-bottom: -1px; white-space: nowrap;
  color: var(--muted); font-weight: 600; text-decoration: none; border-bottom: 2px solid transparent;
}
.rs-nav a:hover { color: var(--ink); }
.rs-event { padding: 10px 16px 10px 0; margin-right: 0; border-right: 1px solid var(--line); color: var(--accent); font-weight: 700; white-space: nowrap; align-self: center; }
.rs-nav .rs-event:last-child { border-right: 0; }
.rs-nav a.is-active { color: var(--ink); border-bottom-color: var(--accent); }

/* ---- Cabecera + indicador en vivo */
.rs-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; margin-bottom: 24px; }
.rs-head h1 { font-size: clamp(26px, 4vw, 36px); font-weight: 700; letter-spacing: -.03em; }
.rs-live { text-align: right; flex-shrink: 0; }
.rs-live-label { display: inline-flex; align-items: center; gap: 8px; font-weight: 500; font-size: 17px; }
.rs-live small { display: block; color: var(--muted); font-size: 13px; margin-top: 2px; }
.rs-dot { width: 11px; height: 11px; border-radius: 50%; background: var(--green); box-shadow: 0 0 0 0 rgba(63, 207, 116, .5); animation: rs-pulse 2s infinite; }
.rs-live.is-stale .rs-dot { background: var(--amber); animation: none; }
.rs-live.is-error .rs-dot { background: var(--red); animation: none; }
@keyframes rs-pulse { 70% { box-shadow: 0 0 0 7px rgba(63, 207, 116, 0); } 100% { box-shadow: 0 0 0 0 rgba(63, 207, 116, 0); } }

/* ---- Pills (grupos) y filtros */
.rs-toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; margin-bottom: 28px; }
.rs-pills { display: inline-flex; flex-wrap: wrap; gap: 4px; padding: 6px; background: var(--pill); border-radius: 14px; }
.rs-pills button {
  border: 0; background: transparent; cursor: pointer; padding: 8px 16px; border-radius: 10px;
  font: 500 15px var(--font); color: var(--muted);
}
.rs-pills button:hover { color: var(--ink); }
.rs-pills button.is-active { background: var(--card); color: var(--ink); box-shadow: 0 1px 3px rgba(15, 27, 61, .12); }
.rs-select {
  font: 500 15px var(--font); color: var(--ink); background: var(--card);
  border: 1px solid var(--line); border-radius: 12px; padding: 10px 14px; min-width: 240px; max-width: 100%;
}
.rs-empty { color: var(--muted); padding: 32px 0; }
.rs-legend { color: var(--muted); font-size: 13px; margin-top: 20px; }

/* ---- Tarjetas de grupo */
.rs-groups { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 24px; }
.rs-groups.is-single { grid-template-columns: minmax(0, 1fr); max-width: 760px; }
.rs-group { background: var(--card); border: 2px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.rs-group.is-complete { border-color: var(--green); }
.rs-group-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 18px 26px; border-bottom: 1px solid var(--line-soft); }
.rs-group.is-complete .rs-group-head { background: var(--green-bg); }
.rs-group-head h2 { font-size: 22px; font-weight: 600; display: flex; align-items: center; gap: 10px; }
.rs-check { width: 22px; height: 22px; color: var(--green-ink); }
.rs-chip { font-size: 13px; font-weight: 600; color: var(--muted); background: var(--bg); border: 1px solid var(--line); padding: 4px 12px; border-radius: 10px; white-space: nowrap; }

.rs-table { width: 100%; border-collapse: collapse; font-size: 15px; }
.rs-table th {
  font-size: 13px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--muted);
  padding: 14px 8px; text-align: center; border-bottom: 1px solid var(--line-soft);
}
.rs-table td { padding: 14px 8px; text-align: center; border-bottom: 1px solid var(--line-soft); font-variant-numeric: tabular-nums; }
.rs-table th:first-child, .rs-table td:first-child { padding-left: 26px; width: 56px; text-align: left; }
.rs-table th:last-child, .rs-table td:last-child { padding-right: 26px; }
.rs-table .rs-team-col { text-align: left; font-weight: 500; max-width: 0; width: 100%; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rs-table tr.is-q td { background: var(--row-q); }
.rs-table tbody tr:last-child td { border-bottom: 0; }
.rs-pos { display: inline-grid; place-items: center; width: 26px; height: 26px; border-radius: 50%; font-size: 12px; font-weight: 700; background: var(--pill); color: var(--muted); }
.is-q .rs-pos { background: var(--accent); color: #fff; }
.c-muted { color: var(--muted); }
.c-accent { color: var(--accent); }
.c-red { color: var(--faint); }
.c-pts { color: var(--accent); font-weight: 700; }

/* Partidos dentro del grupo */
.rs-gm-list { list-style: none; margin: 0; padding: 6px 0; border-top: 1px solid var(--line); background: #fcfbf8; }
.rs-gm { display: grid; grid-template-columns: 92px minmax(0, 1fr) auto minmax(0, 1fr); align-items: center; gap: 12px; padding: 8px 26px; font-size: 14px; }
.rs-gm-meta { color: var(--faint); font-size: 12px; font-weight: 500; font-variant-numeric: tabular-nums; }
.rs-gm-a, .rs-gm-b { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--muted); }
.rs-gm-a { text-align: right; }
.rs-gm .won { color: var(--ink); font-weight: 600; }
.rs-gm-score { font-variant-numeric: tabular-nums; font-weight: 600; color: var(--ink); text-align: center; min-width: 64px; }
.rs-gm-score.is-pending { color: var(--faint); font-weight: 400; }

/* ---- Tarjeta de partido (orden de juego y cuadro) */
.rs-match { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 20px 14px; }
.rs-match.is-live { border-color: var(--green); box-shadow: 0 0 0 3px var(--green-bg); }
.rs-match-top { display: flex; justify-content: space-between; gap: 8px; font-size: 12px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; color: var(--faint); margin-bottom: 4px; }
.rs-team { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 10px 0; font-size: 15px; color: var(--muted); }
.rs-team + .rs-team { border-top: 1px dashed var(--line); }
.rs-team-name { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rs-team.is-known { color: var(--ink); }
.rs-team.won { color: var(--ink); font-weight: 700; }
.rs-match.is-final .rs-team.is-known:not(.won) { color: var(--muted); }
.rs-sets { display: flex; gap: 10px; font-variant-numeric: tabular-nums; flex-shrink: 0; }
.rs-sets span { min-width: 14px; text-align: center; }
.rs-sets .is-win { color: var(--ink); font-weight: 700; }
.rs-sets .is-lose { color: var(--faint); font-weight: 400; }
.rs-match-foot { display: flex; flex-direction: column; align-items: center; gap: 6px; text-align: center; border-top: 1px solid var(--line); margin-top: 4px; padding-top: 12px; font-size: 13px; color: var(--muted); }
.rs-court { display: inline-flex; align-items: center; gap: 8px; }
.rs-court b { background: var(--bg); border: 1px solid var(--line); border-radius: 8px; padding: 3px 12px; font-weight: 600; color: var(--ink); white-space: nowrap; }
.rs-status { font-weight: 600; white-space: nowrap; }
.rs-status.is-live { color: var(--green-ink); display: inline-flex; align-items: center; gap: 6px; }
.rs-status.is-live .rs-dot { width: 8px; height: 8px; }
.rs-status.is-final { color: var(--faint); }
.rs-note { color: var(--amber); font-weight: 600; }

/* ---- Orden de juego */
.rs-slot { margin-bottom: 32px; }
.rs-slot-head { display: flex; align-items: baseline; flex-wrap: wrap; gap: 6px 14px; margin-bottom: 14px; }
.rs-slot-head h3 { font-size: 20px; font-weight: 600; font-variant-numeric: tabular-nums; }
.rs-slot-head span { color: var(--muted); font-size: 14px; font-weight: 500; }
.rs-slot-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 16px; }
.rs-slot-grid.is-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
@media (max-width: 1100px) { .rs-slot-grid.is-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 560px) { .rs-slot-grid.is-4 { grid-template-columns: minmax(0, 1fr); } }
.rs-hl { background: #fff4c2; border-radius: 4px; padding: 0 3px; margin: 0 -3px; }

/* ---- Cuadro final */
.rs-bracket-scroll { overflow-x: auto; padding-bottom: 8px; }
.rs-bracket { display: grid; grid-template-columns: repeat(var(--cols), minmax(250px, 1fr)); gap: 40px; min-width: calc(var(--cols) * 270px); }
.rs-round { display: flex; flex-direction: column; }
.rs-round-title { font-family: var(--font); text-align: center; font-size: 17px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); margin-bottom: 28px; }
.rs-round-body { flex: 1; display: flex; flex-direction: column; justify-content: space-around; gap: 24px; }
.rs-champion { text-align: center; margin-top: 16px; font-family: var(--font); font-weight: 600; color: var(--accent); }

@media (max-width: 960px) {
  .rs-groups { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 560px) {
  .rs-head { flex-direction: column; }
  .rs-live { text-align: left; }
  .rs-pills button { padding: 7px 11px; font-size: 14px; }
  .rs-group-head { padding: 14px 16px; }
  .rs-table { font-size: 15px; }
  .rs-table th, .rs-table td { padding: 12px 4px; }
  .rs-table th:first-child, .rs-table td:first-child { padding-left: 14px; width: 42px; }
  .rs-table th:last-child, .rs-table td:last-child { padding-right: 14px; }
  .rs-table .hide-sm { display: none; }
  .rs-gm { grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr); padding: 8px 14px; row-gap: 2px; }
  .rs-gm-meta { grid-column: 1 / -1; }
  .rs-select { min-width: 0; width: 100%; }
}
