:root {
  --bg: #0f1216;
  --bg-2: #161b22;
  --bg-3: #1d232c;
  --line: #2a323d;
  --txt: #e6edf3;
  --txt-2: #9aa7b4;
  --acc: #35d07f;
  --acc-2: #1f9e5d;
  --warn: #f0a132;
  --err: #ef5350;
  --blue: #4c9aff;
  --radius: 10px;
  --sombra: 0 1px 3px rgba(0,0,0,.4);
}
@media (prefers-color-scheme: light) {
  :root {
    --bg: #f5f7fa; --bg-2: #ffffff; --bg-3: #eef2f7; --line: #d8e0e9;
    --txt: #16202b; --txt-2: #5c6a78; --sombra: 0 1px 3px rgba(16,32,48,.10);
  }
}
* { box-sizing: border-box; }
body {
  margin: 0; background: var(--bg); color: var(--txt);
  font: 15px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
a { color: var(--blue); text-decoration: none; }
h1, h2, h3 { margin: 0 0 .5rem; line-height: 1.25; }
h1 { font-size: 1.5rem; } h2 { font-size: 1.2rem; } h3 { font-size: 1rem; }

header.top {
  display: flex; align-items: center; gap: 1.25rem; flex-wrap: wrap;
  padding: .75rem 1.25rem; background: var(--bg-2); border-bottom: 1px solid var(--line);
  position: sticky; top: 0; z-index: 20;
}
header.top .marca { display: flex; align-items: center; }
header.top .marca img { display: block; height: 34px; width: auto; }
@media (prefers-color-scheme: light) {
  /* el logo está pensado para fondo oscuro: en claro va sobre una pastilla */
  header.top .marca img {
    background: #0b1a26; padding: .3rem .55rem; border-radius: 10px; height: 40px;
  }
}
header.top nav { display: flex; gap: .25rem; margin-left: auto; flex-wrap: wrap; }
header.top nav a {
  padding: .4rem .75rem; border-radius: 8px; color: var(--txt-2); font-weight: 500;
}
header.top nav a.activo, header.top nav a:hover { background: var(--bg-3); color: var(--txt); }

main { max-width: 1240px; margin: 0 auto; padding: 1.25rem; }

.tarjeta {
  background: var(--bg-2); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 1rem; margin-bottom: 1rem; box-shadow: var(--sombra);
}
.fila { display: flex; gap: .75rem; flex-wrap: wrap; align-items: center; }
.fila.entre { justify-content: space-between; }
.crece { flex: 1 1 auto; }
.rejilla { display: grid; gap: .75rem; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); }
.mini { font-size: .82rem; color: var(--txt-2); }
.centro { text-align: center; }

button, .boton {
  font: inherit; font-weight: 600; cursor: pointer; border: 1px solid var(--line);
  background: var(--bg-3); color: var(--txt); padding: .45rem .8rem; border-radius: 8px;
}
button:hover { border-color: var(--acc); }
button.primario { background: var(--acc); border-color: var(--acc); color: #06231a; }
button.primario:hover { background: var(--acc-2); }
button.peligro { color: var(--err); }
button.plano { background: transparent; border-color: transparent; color: var(--txt-2); }
button.plano:hover { color: var(--txt); background: var(--bg-3); }
button:disabled { opacity: .45; cursor: not-allowed; }
button.pequeno { padding: .2rem .5rem; font-size: .8rem; }

input, select, textarea {
  font: inherit; background: var(--bg); color: var(--txt);
  border: 1px solid var(--line); border-radius: 8px; padding: .45rem .6rem; width: 100%;
}
input:focus, select:focus, textarea:focus { outline: 2px solid var(--acc); outline-offset: -1px; }
label { display: block; font-size: .8rem; color: var(--txt-2); margin-bottom: .2rem; font-weight: 600; }
.campo { margin-bottom: .6rem; }

table { width: 100%; border-collapse: collapse; font-size: .9rem; }
th, td { text-align: left; padding: .45rem .5rem; border-bottom: 1px solid var(--line); }
th { color: var(--txt-2); font-size: .75rem; text-transform: uppercase; letter-spacing: .04em; }
tbody tr:hover { background: var(--bg-3); }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }

.etiqueta {
  display: inline-block; padding: .1rem .5rem; border-radius: 999px;
  font-size: .72rem; font-weight: 700; background: var(--bg-3); color: var(--txt-2);
  border: 1px solid var(--line);
}
.etiqueta.verde { color: var(--acc); border-color: var(--acc); }
.etiqueta.azul { color: var(--blue); border-color: var(--blue); }
.etiqueta.ambar { color: var(--warn); border-color: var(--warn); }

.aviso { padding: .6rem .8rem; border-radius: 8px; background: rgba(240,161,50,.12);
  border: 1px solid var(--warn); color: var(--warn); font-size: .88rem; }
.aviso.error { background: rgba(239,83,80,.12); border-color: var(--err); color: var(--err); }
.aviso.ok { background: rgba(53,208,127,.12); border-color: var(--acc); color: var(--acc); }

.pestanas { display: flex; gap: .25rem; border-bottom: 1px solid var(--line); margin-bottom: 1rem; flex-wrap: wrap; }
.pestanas button {
  background: transparent; border: none; border-bottom: 2px solid transparent;
  border-radius: 0; color: var(--txt-2); padding: .5rem .85rem;
}
.pestanas button.activo { color: var(--txt); border-bottom-color: var(--acc); }

/* ---------- Cuadro de eliminatoria ---------- */
.cuadro-scroll { overflow-x: auto; padding-bottom: 1rem; }
.cuadro { display: flex; gap: 1.5rem; align-items: stretch; min-width: min-content; }
.ronda { display: flex; flex-direction: column; min-width: 220px; }
.ronda > h4 {
  margin: 0 0 .5rem; font-size: .72rem; text-transform: uppercase; letter-spacing: .05em;
  color: var(--txt-2); text-align: center; white-space: nowrap;
}
.ronda > .lista {
  flex: 1; display: flex; flex-direction: column; justify-content: space-around; gap: .5rem;
}
.partido {
  background: var(--bg-2); border: 1px solid var(--line); border-radius: 8px;
  overflow: hidden; font-size: .82rem; cursor: pointer; position: relative;
}
.partido:hover { border-color: var(--acc); }
.partido .lado {
  display: flex; justify-content: space-between; gap: .4rem; padding: .3rem .5rem;
  border-bottom: 1px solid var(--line);
}
.partido .lado:last-child { border-bottom: none; }
.partido .lado.gana { background: rgba(53,208,127,.1); font-weight: 700; }
.partido .lado.vacio { color: var(--txt-2); font-style: italic; }
.partido .lado .marcador { font-variant-numeric: tabular-nums; color: var(--txt-2); white-space: nowrap; }
.partido .cs { color: var(--warn); font-weight: 700; font-size: .7rem; margin-right: .25rem; }
.partido .cinta {
  position: absolute; top: 0; right: 0; font-size: .6rem; padding: 0 .25rem;
  background: var(--bg-3); color: var(--txt-2); border-bottom-left-radius: 6px;
}

.grupo-tarjeta { background: var(--bg-2); border: 1px solid var(--line); border-radius: var(--radius); padding: .75rem; }
.grupo-tarjeta table { font-size: .82rem; }
.pos1 td { color: var(--acc); font-weight: 700; }
.pos2 td { color: var(--blue); font-weight: 600; }

dialog {
  border: 1px solid var(--line); border-radius: var(--radius); background: var(--bg-2);
  color: var(--txt); padding: 1.1rem; max-width: 560px; width: calc(100% - 2rem);
}
dialog::backdrop { background: rgba(0,0,0,.55); }

.vacio-estado { text-align: center; color: var(--txt-2); padding: 2.5rem 1rem; }
.sets { display: flex; gap: .4rem; }
.sets input { width: 3.2rem; text-align: center; }
.barra-nivel { display: inline-block; height: 6px; width: 60px; background: var(--bg-3); border-radius: 3px; overflow: hidden; vertical-align: middle; }
.barra-nivel > i { display: block; height: 100%; background: var(--acc); }
