:root{
  --bg:#0a0a0a;
  --card:#16171a;
  --ink:#ffffff;
  --muted:#cfcfcf;
  --gold:#ffcc00;
  --gold-dark:#b28900;
  --line:#ffffff22;
  --whitebox:#f4f4f4;
  --shadow:0 10px 24px rgba(0,0,0,.38);
}

*{ box-sizing:border-box; }
html,body{ min-height:100%; }
body{
  margin:0;
  background:var(--bg);
  color:var(--ink);
  font-family:Inter,system-ui,Segoe UI,Roboto,Helvetica,Arial,sans-serif;
}

.container{
  width:100%;
  max-width:none;
  margin:0;
  padding:18px 12px 28px;
}
header{
  display:grid;
  grid-template-columns:auto 1fr auto;
  align-items:center;
  gap:14px;
  border-bottom:1px solid var(--line);
  padding-bottom:10px;
}
header img{ height:60px; width:auto; display:block; }
.header-center{ display:flex; justify-content:center; align-items:center; }
.title{
  font-weight:900;
  letter-spacing:.06em;
  color:var(--gold);
  font-size:clamp(22px,4vw,34px);
  text-align:center;
}
.subtitle{
  display:block;
  font-size:.52em;
  color:#fff;
  opacity:.92;
  letter-spacing:.16em;
  margin-top:3px;
}
.actions{ margin-left:auto; display:flex; }
.btn{
  border:1px solid var(--gold-dark);
  background:transparent;
  color:var(--gold);
  font-weight:800;
  padding:8px 12px;
  border-radius:10px;
  text-decoration:none;
  display:inline-flex;
  align-items:center;
  justify-content:center;
  cursor:pointer;
}
.category-bar{
  display:flex;
  align-items:center;
  gap:10px;
  margin:16px 0 14px;
}
.cat-btn{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  padding:10px 16px;
  border:1px solid var(--gold-dark);
  border-radius:12px;
  background:linear-gradient(180deg,#ffd966 0%, #ffcc00 60%, #e5b300 100%);
  color:#1b1600;
  font-weight:900;
  letter-spacing:.05em;
  text-transform:uppercase;
  box-shadow:inset 0 -2px 0 var(--gold-dark), 0 2px 8px rgba(0,0,0,.4);
  cursor:pointer;
  opacity:.65;
}
.cat-btn.active{ opacity:1; }
.bracket-scroll{
  overflow-x:auto;
  overflow-y:hidden;
  padding-bottom:14px;
}
.bracket{
  margin-top:10px;
  display:grid;
  gap:28px;
  align-items:start;
  width:max-content;
  min-width:max-content;
}
.bracket-tercera{
  grid-template-columns:700px 700px 700px 700px 700px;
}
.bracket-segunda{
  grid-template-columns:700px 700px 700px;
}
.bracket-col{ display:flex; flex-direction:column; gap:22px; min-width:0; }
.qf-left,.qf-right{ padding-top:8px; }
.sf-left,.sf-right{ padding-top:160px; }
.center-col{ padding-top:64px; gap:34px; }

.tie-card{
  position:relative;
  width:100%;
  max-width:700px;
  padding:14px 12px 12px;
  overflow:visible;
  background:var(--card);
  border:1px solid var(--line);
  border-radius:20px;
  box-shadow:var(--shadow);
}
.tie-card::before{
  content:"";
  position:absolute;
  inset:0 0 auto 0;
  height:3px;
  background:linear-gradient(90deg, transparent, var(--gold), transparent);
  opacity:.85;
}
.tie-header{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:10px;
  margin-bottom:10px;
}
.tie-title{
  margin:0;
  font-size:clamp(18px,2vw,24px);
  font-weight:900;
  letter-spacing:.04em;
  text-transform:uppercase;
}
.tie-subtitle{
  font-size:11px;
  font-weight:800;
  color:var(--gold);
  letter-spacing:.16em;
  text-transform:uppercase;
}
.tie-helper{
  margin:4px 0 0;
  font-size:11px;
  opacity:.72;
  line-height:1.35;
}
.round-group{ display:flex; flex-direction:column; gap:12px; }
.match-block{
  border:1px solid var(--line);
  border-radius:16px;
  padding:10px 10px 8px;
  background:#101114;
  overflow:visible;
}
.match-top{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:10px;
  margin-bottom:8px;
}
.match-label{
  font-size:12px;
  font-weight:900;
  letter-spacing:.16em;
  color:var(--gold);
  text-transform:uppercase;
}
.fecha-input{
  appearance:none;
  border:1px solid #444;
  border-radius:10px;
  background:#000;
  color:#fff;
  padding:6px 8px;
  font-weight:700;
  width:140px;
}
.fecha-input::-webkit-calendar-picker-indicator{ filter:invert(1); }

.team-row{
  display:grid;
  grid-template-columns:34px 44px minmax(220px,1fr) minmax(220px,1fr) 44px 34px;
  gap:10px;
  align-items:center;
}
.team-row > *{ min-width:0; }

.select-team,
.score-badge{
  appearance:none;
  border-radius:10px;
  font-weight:900;
}
.select-team{
  width:100%;
  min-width:0;
  display:block;
  background:#000;
  color:#fff;
  border:1px solid #444;
  padding:6px 8px;
  font-size:15px;
  white-space:nowrap;
  overflow:hidden;
  text-overflow:ellipsis;
}
.score-badge{
  width:34px;
  height:32px;
  padding:4px 0;
  text-align:center;
  border:1px solid var(--gold-dark);
  color:#1b1600;
  background:var(--gold);
  box-shadow:0 5px 0 var(--gold-dark);
}
.score-badge-white{
  width:44px;
  height:32px;
  padding:4px 0;
  text-align:center;
  border:1px solid #cfcfcf;
  color:#111;
  background:var(--whitebox);
  box-shadow:0 5px 0 #cfcfcf;
}
.save-wrap{
  text-align:center;
  padding:18px 0 4px;
}
.save-btn{
  padding:10px 18px;
  border:1px solid var(--gold-dark);
  border-radius:12px;
  background:linear-gradient(180deg,#ffd966 0%, #ffcc00 60%, #e5b300 100%);
  color:#1b1600;
  font-weight:900;
  letter-spacing:.06em;
  text-transform:uppercase;
  box-shadow:inset 0 -2px 0 var(--gold-dark), 0 2px 8px rgba(0,0,0,.4);
  cursor:pointer;
}
.save-btn:hover,.btn:hover,.cat-btn:hover{ opacity:.88; }

.toast{
  position:fixed;
  left:24px;
  bottom:24px;
  background:#1e1e1e;
  color:#fff;
  padding:.75rem 1.25rem;
  border-radius:999px;
  border:1px solid #3a3a3a;
  box-shadow:0 6px 24px rgba(0,0,0,.35);
  font-weight:600;
  opacity:0;
  pointer-events:none;
  transform:translateY(8px);
  transition:opacity .25s ease, transform .25s ease;
  z-index:9999;
}
.toast.show{ opacity:1; transform:translateY(0); }

@media (max-width: 840px){
  header{ grid-template-columns:1fr; }
  .actions{ margin-left:0; }
  .header-center{ justify-content:flex-start; }
}


/* Ajustes finales solicitados */

[data-round-card="q1"] .tie-subtitle,
[data-round-card="q2"] .tie-subtitle,
[data-round-card="q3"] .tie-subtitle,
[data-round-card="q4"] .tie-subtitle,
[data-round-card="s1"] .tie-subtitle,
[data-round-card="s2"] .tie-subtitle{
  display:none;
}

[data-round-card="third"] .tie-title{
  font-size:20px;
  opacity:.88;
  line-height:1.05;
}

[data-round-card="final"] .tie-title{
  font-size:30px;
}


/* bajar jerarquía cuartos y semis */
[data-round-card="q1"] .tie-title,
[data-round-card="q2"] .tie-title,
[data-round-card="q3"] .tie-title,
[data-round-card="q4"] .tie-title,
[data-round-card="s1"] .tie-title,
[data-round-card="s2"] .tie-title{
  font-size:20px;
}


.match-actions{
  display:flex;
  align-items:center;
  gap:8px;
}

.btn-delete-desempate{
  border:1px solid #7a1d1d;
  background:#220b0b;
  color:#ffdddd;
  font-weight:900;
  letter-spacing:.06em;
  border-radius:10px;
  padding:6px 10px;
  cursor:pointer;
  text-transform:uppercase;
}

.btn-delete-desempate:hover{
  background:#3a1010;
}


/* Desempate: solo muestra puntos, sin triángulos/puntosExtra */
.match-block-extra .team-row-extra{
  grid-template-columns:34px minmax(220px,1fr) minmax(220px,1fr) 34px;
}
.match-block-extra .score-badge{
  width:34px;
}
