/* Cristal Premium — spec 2026-06-10. Mobile-first. */
:root {
  --bg0: #0f0c29; --bg1: #1e1b4b; --bg2: #4338ca;
  --glass: rgba(255, 255, 255, 0.10); --glass-soft: rgba(255, 255, 255, 0.07);
  --line: rgba(255, 255, 255, 0.22); --line-soft: rgba(255, 255, 255, 0.14);
  --gold: #fbbf24; --gold2: #f59e0b;
  --txt: #ffffff; --txt2: #c7d2fe; --txt3: #818cf8;
  --radius: 16px; --nav-h: 64px;
}
* { box-sizing: border-box; margin: 0; }
html { -webkit-text-size-adjust: 100%; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  color: var(--txt); min-height: 100vh;
  background: radial-gradient(circle at 20% 10%, var(--bg2) 0%, var(--bg1) 45%, var(--bg0) 100%) fixed;
  padding-bottom: calc(var(--nav-h) + env(safe-area-inset-bottom));
}
header {
  display: flex; justify-content: space-between; align-items: center;
  padding: 16px 16px 8px; position: sticky; top: 0; z-index: 10;
  background: linear-gradient(180deg, rgba(15,12,41,0.92), rgba(15,12,41,0.6) 80%, transparent);
  backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
}
.brand { font-weight: 800; font-size: 15px; line-height: 1.15; }
.brand .year { color: var(--gold); letter-spacing: 3px; font-size: 18px; }
.header-controls { display: flex; gap: 8px; align-items: center; }
.pill {
  font-size: 12px; color: var(--txt2); background: var(--glass);
  border: 1px solid var(--line); border-radius: 20px; padding: 5px 12px;
  cursor: pointer; backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
  -webkit-tap-highlight-color: transparent;
}
.pill.active { color: var(--bg1); background: linear-gradient(90deg, var(--gold), var(--gold2)); border-color: transparent; font-weight: 800; }
main { padding: 8px 14px 20px; max-width: 560px; margin: 0 auto; }
.card {
  background: var(--glass); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 12px; margin-bottom: 12px; backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
}
.card.soft { background: var(--glass-soft); border-color: var(--line-soft); }
.card h3 { font-size: 13px; font-weight: 800; color: var(--gold); letter-spacing: 2px; margin-bottom: 8px; }
.match {
  display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 8px;
  background: rgba(255,255,255,0.06); border: 1px solid var(--line-soft);
  border-radius: 10px; padding: 8px 10px; margin-bottom: 6px;
}
.match .team { font-size: 13px; display: flex; align-items: center; gap: 6px; min-width: 0; }
.match .team.right { justify-content: flex-end; text-align: right; }
.match .team .nm { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.match .team.winner { font-weight: 800; }
.match .team.loser { color: var(--txt2); opacity: 0.75; }
.score { display: flex; align-items: center; gap: 4px; }
.score input {
  width: 34px; height: 32px; text-align: center; font-size: 15px; font-weight: 800;
  color: var(--txt); background: rgba(0,0,0,0.25); border: 1px solid var(--line);
  border-radius: 8px; -moz-appearance: textfield; appearance: textfield;
}
.score input::-webkit-outer-spin-button, .score input::-webkit-inner-spin-button { -webkit-appearance: none; }
.score input.filled { color: var(--bg1); background: linear-gradient(90deg, var(--gold), var(--gold2)); border-color: transparent; }
.score input:disabled { opacity: 0.6; }
.match.empty .score input { border-style: dashed; }
.meta { font-size: 10px; color: var(--txt3); margin-bottom: 4px; }
.table { width: 100%; border-collapse: collapse; font-size: 12px; margin-top: 6px; }
.table th { color: var(--txt3); font-size: 10px; text-align: right; font-weight: 600; padding: 2px 4px; }
.table th:first-child { text-align: left; }
.table td { padding: 4px; text-align: right; color: var(--txt2); }
.table td:first-child { text-align: left; color: var(--txt); }
.table tr.q1 td:first-child { border-left: 3px solid var(--gold); padding-left: 6px; }
.table tr.q2 td:first-child { border-left: 3px solid var(--txt3); padding-left: 6px; }
.table tr.q3 td:first-child { border-left: 3px dashed var(--gold2); padding-left: 6px; }
.table .pts { color: var(--gold); font-weight: 800; }
.btn {
  display: inline-block; border: none; cursor: pointer; font-weight: 800; font-size: 13px;
  color: var(--bg1); background: linear-gradient(90deg, var(--gold), var(--gold2));
  border-radius: 20px; padding: 10px 18px; -webkit-tap-highlight-color: transparent;
}
.btn.ghost { color: var(--txt2); background: var(--glass); border: 1px solid var(--line); font-weight: 600; }
.btn-row { display: flex; gap: 8px; margin: 10px 0; flex-wrap: wrap; }
.day-h { font-size: 12px; font-weight: 800; color: var(--gold); letter-spacing: 1px; margin: 14px 0 6px; }
.pred { font-size: 11px; font-weight: 800; color: var(--gold); margin-top: 3px; }
.pill.rlive { background: #dc2626; color: #fff; border-color: transparent; font-weight: 800; animation: pulse 1.6s infinite; }
.pill.rfinal { background: #fff; color: var(--bg1); border-color: transparent; font-weight: 800; }
@keyframes pulse { 0%,100% { opacity: 1; } 50% { opacity: .65; } }
.real-strip {
  font-size: 11px; font-weight: 800; text-align: center; color: var(--txt);
  background: rgba(255,255,255,0.12); border-radius: 0 0 10px 10px;
  padding: 4px 8px; margin: -5px 0 8px;
}
.real-strip.live { background: rgba(220,38,38,0.45); animation: pulse 1.6s infinite; }
.match.has-real { border-radius: 10px 10px 0 0; margin-bottom: 0; }
.winner-pick { display: flex; gap: 6px; }
.winner-pick .pick {
  flex: 1; text-align: center; font-size: 12px; padding: 8px 4px; border-radius: 8px;
  background: rgba(255,255,255,0.06); border: 1px solid var(--line-soft); cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.winner-pick .pick.sel { background: linear-gradient(90deg, var(--gold), var(--gold2)); color: var(--bg1); font-weight: 800; }
nav.tabs {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 20;
  display: flex; background: rgba(15,12,41,0.95); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
  border-top: 1px solid var(--line-soft); height: calc(var(--nav-h) + env(safe-area-inset-bottom));
  padding-bottom: env(safe-area-inset-bottom);
}
nav.tabs button {
  flex: 1; background: none; border: none; color: var(--txt2); opacity: 0.6;
  font-size: 10px; font-weight: 700; cursor: pointer; padding-top: 8px;
}
nav.tabs button .ico { display: block; font-size: 20px; margin-bottom: 2px; }
nav.tabs button.active { color: var(--gold); opacity: 1; }
.toast {
  position: fixed; bottom: calc(var(--nav-h) + 16px); left: 50%; transform: translateX(-50%);
  background: var(--gold); color: var(--bg1); font-weight: 800; font-size: 13px;
  padding: 10px 20px; border-radius: 20px; z-index: 30; transition: opacity .3s; pointer-events: none;
  white-space: nowrap;
}
.banner {
  background: rgba(251,191,36,0.15); border: 1px solid var(--gold2); color: var(--gold);
  border-radius: 10px; padding: 8px 12px; font-size: 12px; margin: 8px 14px 10px;
  display: flex; justify-content: space-between; align-items: center; gap: 8px;
}
select.pill { appearance: none; -webkit-appearance: none; max-width: 140px; }
footer { text-align: center; color: var(--txt3); font-size: 11px; padding: 16px; }
/* Bracket árbol */
.tree { display: flex; gap: 14px; overflow-x: auto; padding: 4px 2px 12px; align-items: stretch; }
.tree .round { display: flex; flex-direction: column; min-width: 170px; }
.tree .round > .rh {
  font-size: 10px; font-weight: 800; color: var(--gold); letter-spacing: 1px;
  text-align: center; padding: 4px 0 8px;
}
.tree .ties { flex: 1; display: flex; flex-direction: column; justify-content: space-around; gap: 8px; }
.tree .tie { background: var(--glass-soft); border: 1px solid var(--line-soft); border-radius: 10px; padding: 6px 8px; font-size: 11px; }
.tree .tie div { display: flex; justify-content: space-between; padding: 1px 0; gap: 8px; }
.tree .tie .w { font-weight: 800; color: var(--gold); }
/* Desktop */
@media (min-width: 1024px) {
  /* la barra inferior sigue fija y flotante también en desktop */
  main { max-width: 1280px; }
  /* árbol a escala desktop: llaves más grandes y encabezado pegado a su columna */
  .tree { gap: 22px; }
  .tree .round { min-width: 235px; }
  .tree .round > .rh { font-size: 13px; letter-spacing: 2px; padding: 6px 0 10px; }
  .tree .tie { font-size: 14px; padding: 10px 12px; border-radius: 12px; }
  .tree .tie div { padding: 3px 0; }
  .card h3 { font-size: 15px; }
  .match .team { font-size: 14px; }
  .table { font-size: 13px; }
  .grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; align-items: start; }
  .grid2 .card { margin-bottom: 0; }
  .mobile-only { display: none !important; }
}
@media (max-width: 1023px) { .desktop-only { display: none !important; } }
