/* ===== Mundial 2026 PWA — diseno moderno (mobile-first) ===== */
:root{
  /* superficies */
  --bg:#0a0e1a; --bg-grad-1:#101a36; --bg-grad-2:#0a0e1a;
  --surface:#141c33; --surface-2:#1a2440; --surface-3:#202c4d;
  --hairline:rgba(255,255,255,.07); --hairline-2:rgba(255,255,255,.12);
  /* texto */
  --txt:#f3f6ff; --muted:#9aa7c7; --muted-2:#6b779b;
  /* marca */
  --accent:#34d399; --accent-ink:#053527;
  --indigo:#818cf8; --gold:#fbbf24; --live:#fb5563;
  /* sistema */
  --r-sm:10px; --r:14px; --r-lg:20px; --r-xl:26px;
  --shadow:0 8px 30px -12px rgba(0,0,0,.6);
  --safe-b:env(safe-area-inset-bottom,0px); --safe-t:env(safe-area-inset-top,0px);
  --ease:cubic-bezier(.22,.61,.36,1);
  --bar:linear-gradient(180deg,rgba(10,14,26,.92),rgba(10,14,26,.62));
  --tabbar:linear-gradient(0deg,rgba(16,22,42,.98),rgba(16,22,42,.86));
}

/* ===== Tema claro ===== */
:root[data-theme="light"]{
  --bg:#eef1f8; --bg-grad-1:#ffffff; --bg-grad-2:#e9edf6;
  --surface:#ffffff; --surface-2:#f5f7fc; --surface-3:#e9edf6;
  --hairline:rgba(16,26,51,.10); --hairline-2:rgba(16,26,51,.16);
  --txt:#141b2d; --muted:#586079; --muted-2:#8b93a9;
  --accent:#0ea271; --accent-ink:#ffffff;
  --indigo:#5b63d8; --gold:#c8890a; --live:#e23a4b;
  --shadow:0 10px 26px -14px rgba(16,26,51,.30);
  --bar:linear-gradient(180deg,rgba(255,255,255,.94),rgba(255,255,255,.66));
  --tabbar:linear-gradient(0deg,rgba(255,255,255,.98),rgba(255,255,255,.88));
}
:root[data-theme="light"] .team img,
:root[data-theme="light"] .detail-teams img,
:root[data-theme="light"] .team-card img{filter:none}

*{box-sizing:border-box;-webkit-tap-highlight-color:transparent}
html{-webkit-text-size-adjust:100%}
html,body{margin:0;padding:0}
body{
  background:
    radial-gradient(120% 80% at 50% -10%, var(--bg-grad-1) 0%, var(--bg-grad-2) 55%) fixed,
    var(--bg);
  color:var(--txt); overscroll-behavior-y:none;
  font-family:"Inter",system-ui,-apple-system,"Segoe UI",Roboto,sans-serif;
  font-size:15px; line-height:1.45; letter-spacing:.1px;
  -webkit-font-smoothing:antialiased;
}

/* iconos */
.ic{width:1.25em;height:1.25em;display:inline-block;vertical-align:-.18em;flex:none;
  stroke:currentColor;fill:none;stroke-width:2;stroke-linecap:round;stroke-linejoin:round}
.ic-lg{width:1.6em;height:1.6em}

/* ---- Bloqueo escritorio ---- */
#desktop-gate{display:none}
@media (min-width:821px){
  #app{display:none}
  #desktop-gate{
    display:flex;align-items:center;justify-content:center;position:fixed;inset:0;
    background:radial-gradient(circle at 50% 25%,#16224a,#0a0e1a);padding:24px;text-align:center;
  }
  .gate-card{max-width:430px;background:var(--surface);border:1px solid var(--hairline-2);
    border-radius:var(--r-xl);padding:44px 34px;box-shadow:var(--shadow)}
  .gate-logo{color:var(--accent);margin-bottom:14px}
  .gate-logo .ic{width:64px;height:64px;stroke-width:1.6}
  .gate-card h1{margin:.1em 0;font-size:25px;letter-spacing:-.5px}
  .gate-card p{color:var(--muted);margin:.7em 0}
  .gate-hint{font-size:13px;color:var(--accent)}
}

/* ---- Layout ---- */
#app{min-height:100dvh;display:flex;flex-direction:column;max-width:600px;margin:0 auto}
.app-bar{
  position:sticky;top:0;z-index:30;display:flex;align-items:center;justify-content:space-between;
  padding:calc(14px + var(--safe-t)) 18px 14px;
  background:var(--bar);
  backdrop-filter:saturate(160%) blur(14px);-webkit-backdrop-filter:saturate(160%) blur(14px);
  border-bottom:1px solid var(--hairline);
}
.bar-actions{display:flex;align-items:center;gap:8px}
.icon-btn{display:grid;place-items:center;width:34px;height:34px;border-radius:11px;cursor:pointer;
  background:var(--surface-2);border:1px solid var(--hairline);color:var(--txt);transition:.2s var(--ease)}
.icon-btn .ic{width:18px;height:18px}
.icon-btn:active{transform:scale(.92)}
.brand{display:flex;align-items:center;gap:9px;font-size:18px;font-weight:700;letter-spacing:-.3px}
.brand .logo{display:grid;place-items:center;width:32px;height:32px;border-radius:10px;
  background:linear-gradient(145deg,var(--accent),#10b981);color:var(--accent-ink);box-shadow:0 4px 14px -4px var(--accent)}
.brand .logo .ic{width:20px;height:20px;stroke-width:2.2}
.brand b{color:var(--gold);font-weight:800}
.pill{display:inline-flex;align-items:center;gap:6px;font-size:12px;font-weight:600;
  padding:5px 11px;border-radius:999px;background:rgba(251,85,99,.16);color:var(--live)}
.pill .ic{width:14px;height:14px}
.pill-demo{background:rgba(251,191,36,.18);color:var(--gold);font-weight:800;letter-spacing:.06em}

.view{flex:1;padding:8px 14px calc(92px + var(--safe-b));overflow-y:auto;animation:fade .25s var(--ease);touch-action:pan-y}
@keyframes fade{from{opacity:0;transform:translateY(6px)}to{opacity:1;transform:none}}
.view.swipe-l{animation:slideL .26s var(--ease)}
.view.swipe-r{animation:slideR .26s var(--ease)}
@keyframes slideL{from{opacity:.35;transform:translateX(30px)}to{opacity:1;transform:none}}
@keyframes slideR{from{opacity:.35;transform:translateX(-30px)}to{opacity:1;transform:none}}

/* ---- Tabbar ---- */
.tabbar{
  position:fixed;bottom:0;left:50%;transform:translateX(-50%);width:100%;max-width:600px;z-index:40;
  display:flex;gap:2px;padding:8px 10px calc(8px + var(--safe-b));
  background:var(--tabbar);
  backdrop-filter:blur(16px);-webkit-backdrop-filter:blur(16px);border-top:1px solid var(--hairline);
}
.tab{
  position:relative;flex:1;background:none;border:0;color:var(--muted-2);cursor:pointer;
  display:flex;flex-direction:column;align-items:center;gap:4px;padding:8px 0 6px;
  font-size:11px;font-weight:600;border-radius:14px;transition:color .2s,background .2s;
}
.tab .ic{width:23px;height:23px;stroke-width:2;transition:transform .25s var(--ease)}
.tab.is-active{color:var(--txt)}
.tab.is-active .ic{color:var(--accent);transform:translateY(-1px)}
.tab.is-active::before{content:"";position:absolute;top:0;width:22px;height:3px;border-radius:0 0 4px 4px;
  background:var(--accent);box-shadow:0 0 12px var(--accent)}
.tab:active{background:var(--surface-2)}

/* ---- Secciones ---- */
.section-title{display:flex;align-items:center;gap:8px;font-size:15px;font-weight:700;
  text-transform:uppercase;letter-spacing:.06em;color:var(--muted);margin:20px 4px 10px}
.section-title .ic{width:15px;height:15px;color:var(--accent)}
.section-title .count{margin-left:auto;color:var(--muted-2);font-weight:600;letter-spacing:0}

/* ---- Tarjeta de partido ---- */
.match{
  position:relative;width:100%;text-align:left;color:inherit;cursor:pointer;display:block;
  background:linear-gradient(180deg,var(--surface-2),var(--surface));
  border:1px solid var(--hairline);border-radius:var(--r-lg);padding:14px 16px;margin-bottom:11px;
  box-shadow:var(--shadow);transition:transform .12s var(--ease),border-color .2s;
}
.match::after{content:"";position:absolute;inset:0;border-radius:inherit;
  background:linear-gradient(180deg,rgba(255,255,255,.05),transparent 40%);pointer-events:none}
.match:active{transform:scale(.985);border-color:var(--hairline-2)}
.match-top{display:flex;justify-content:space-between;align-items:center;margin-bottom:10px}
.match-league{display:flex;align-items:center;gap:7px;font-size:11.5px;color:var(--muted);min-width:0}
.match-league img{width:16px;height:16px;border-radius:3px;object-fit:cover}
.match-league span{white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.match-status{font-size:11px;font-weight:700;padding:4px 9px;border-radius:999px;
  background:var(--surface-3);color:var(--muted);letter-spacing:.02em}
.match-status.live{background:rgba(251,85,99,.16);color:var(--live);display:inline-flex;align-items:center;gap:6px}
.match-status.live::before{content:"";width:6px;height:6px;border-radius:50%;background:var(--live);
  box-shadow:0 0 0 0 rgba(251,85,99,.6);animation:ping 1.4s var(--ease) infinite}
@keyframes ping{0%{box-shadow:0 0 0 0 rgba(251,85,99,.55)}70%{box-shadow:0 0 0 7px rgba(251,85,99,0)}100%{box-shadow:0 0 0 0 rgba(251,85,99,0)}}
.team{display:flex;align-items:center;gap:11px;min-width:0}
.team img{width:28px;height:28px;object-fit:contain;flex:none;filter:drop-shadow(0 2px 4px rgba(0,0,0,.4))}
.team .name{white-space:nowrap;overflow:hidden;text-overflow:ellipsis;font-weight:500}
.row{display:flex;align-items:center;justify-content:space-between;gap:12px;padding:5px 0}
.score{font-variant-numeric:tabular-nums;font-weight:800;font-size:19px;min-width:28px;text-align:center;color:var(--muted)}
.score.win{color:var(--txt)}

/* ---- Detalle ---- */
.back-btn{display:inline-flex;align-items:center;gap:4px;background:none;border:0;color:var(--accent);
  font-size:14px;font-weight:600;padding:10px 0 6px;margin-bottom:4px;cursor:pointer}
.back-btn .ic{width:18px;height:18px}
.detail-head{position:relative;overflow:hidden;
  background:radial-gradient(120% 130% at 50% -30%,var(--surface-3),var(--surface));
  border:1px solid var(--hairline-2);border-radius:var(--r-lg);padding:20px 16px;margin-bottom:14px}
.detail-teams{display:flex;align-items:center;justify-content:space-around;text-align:center;gap:10px}
.detail-teams .team-col{display:flex;flex-direction:column;align-items:center;gap:8px;flex:1;min-width:0}
.detail-teams img{width:52px;height:52px;object-fit:contain;filter:drop-shadow(0 4px 8px rgba(0,0,0,.5))}
.detail-teams .name{font-size:13px;font-weight:600}
.detail-score{font-size:34px;font-weight:800;font-variant-numeric:tabular-nums;letter-spacing:-1px}
.detail-meta{display:flex;align-items:center;justify-content:center;gap:6px;flex-wrap:wrap;
  text-align:center;color:var(--muted);font-size:12px;margin-top:12px}
.detail-meta .ic{width:14px;height:14px}

.subtabs{display:flex;justify-content:center;gap:7px;margin:4px 0 16px;overflow-x:auto;scrollbar-width:none;-webkit-overflow-scrolling:touch}
.subtabs::-webkit-scrollbar{display:none}
.subtab{flex:none;border:1px solid var(--hairline);background:var(--surface);color:var(--muted);
  padding:8px 15px;border-radius:999px;font-size:13px;font-weight:600;cursor:pointer;transition:.2s var(--ease)}
.subtab.is-active{background:var(--accent);color:var(--accent-ink);border-color:transparent;box-shadow:0 6px 16px -8px var(--accent)}

/* ---- Lista clave/valor ---- */
.kv{display:flex;align-items:center;gap:10px;padding:12px 0;border-bottom:1px solid var(--hairline)}
.kv .ic{width:17px;height:17px;color:var(--indigo)}
.kv .k{color:var(--muted)}
.kv .v{margin-left:auto;font-weight:600;text-align:right}

/* ---- Estadisticas ---- */
.stat{margin-bottom:14px}
.stat-top{display:flex;justify-content:space-between;align-items:center;font-size:13px;margin-bottom:6px}
.stat-top .label{color:var(--muted);font-size:12px}
.stat-top .hv{color:var(--accent);font-weight:700}
.stat-top .av{color:var(--gold);font-weight:700}
.stat-bar{display:flex;height:8px;border-radius:6px;overflow:hidden;background:var(--surface-3)}
.stat-bar .h{background:linear-gradient(90deg,#10b981,var(--accent))}
.stat-bar .a{background:linear-gradient(90deg,var(--gold),#f59e0b)}

/* ---- Eventos (timeline) ---- */
.event{display:flex;gap:12px;align-items:flex-start;padding:11px 2px;border-bottom:1px solid var(--hairline);font-size:14px}
.event .min{color:var(--muted);min-width:34px;font-variant-numeric:tabular-nums;font-weight:700;font-size:13px}
.event .ev-ic{width:30px;height:30px;border-radius:9px;display:grid;place-items:center;flex:none;
  background:var(--surface-2);border:1px solid var(--hairline)}
.event .ev-ic .ic{width:17px;height:17px}
.event .who{font-weight:600}
.event .sub{color:var(--muted);font-size:12px}
.event.away{flex-direction:row-reverse;text-align:right}
.ic-goal{color:var(--accent)} .ic-sub{color:var(--indigo)}
.card-ic{width:14px;height:18px;border-radius:3px;display:inline-block}
.card-ic.y{background:var(--gold)} .card-ic.r{background:var(--live)}

/* ---- Tabla de posiciones ---- */
.group-name{display:flex;align-items:center;gap:8px;margin:20px 4px 8px;font-size:13px;color:var(--gold);font-weight:700}
.group-name img{width:18px;height:18px;object-fit:contain}
.standtable{width:100%;border-collapse:collapse;font-size:13px;
  background:var(--surface);border:1px solid var(--hairline);border-radius:var(--r);overflow:hidden}
.standtable th{color:var(--muted-2);font-weight:600;font-size:10.5px;text-transform:uppercase;letter-spacing:.05em;
  text-align:center;padding:9px 4px;background:var(--surface-2)}
.standtable td{padding:10px 4px;border-top:1px solid var(--hairline);text-align:center;font-variant-numeric:tabular-nums}
.standtable td.tname{text-align:left;display:flex;align-items:center;gap:9px;font-weight:500}
.standtable td.rank{font-weight:700;color:var(--muted)}
.standtable img{width:22px;height:22px;object-fit:contain}
.standtable .pts{font-weight:800;color:var(--accent)}

/* ---- Equipos ---- */
.teams-grid{display:grid;grid-template-columns:repeat(3,1fr);gap:11px}
.team-card{background:linear-gradient(180deg,var(--surface-2),var(--surface));
  border:1px solid var(--hairline);border-radius:var(--r);padding:16px 8px;text-align:center;font-size:12px;font-weight:500}
.team-card img{width:46px;height:46px;object-fit:contain;margin-bottom:10px;filter:drop-shadow(0 3px 6px rgba(0,0,0,.4))}

/* ---- Estados ---- */
.empty,.loading,.errbox{display:flex;flex-direction:column;align-items:center;gap:12px;
  text-align:center;color:var(--muted);padding:54px 20px}
.empty .ic,.errbox .ic{width:42px;height:42px;stroke-width:1.5;color:var(--muted-2)}
.errbox{color:var(--live)} .errbox .ic{color:var(--live)}
.empty .sub{font-size:13px;color:var(--muted-2)}
.btn{background:var(--accent);color:var(--accent-ink);border:0;border-radius:999px;
  padding:11px 22px;font-size:14px;font-weight:700;cursor:pointer}
.skeleton{background:linear-gradient(100deg,var(--surface) 30%,var(--surface-3) 50%,var(--surface) 70%);
  background-size:200% 100%;animation:sk 1.3s infinite;border-radius:var(--r-lg);height:96px;margin-bottom:11px}
@keyframes sk{to{background-position:-200% 0}}
.spin{width:34px;height:34px;border:3px solid var(--hairline-2);border-top-color:var(--accent);
  border-radius:50%;animation:rot .7s linear infinite}
@keyframes rot{to{transform:rotate(360deg)}}
.stale-note{display:flex;align-items:center;justify-content:center;gap:6px;
  font-size:11.5px;color:var(--gold);text-align:center;margin:8px 0;
  background:rgba(251,191,36,.1);border-radius:999px;padding:6px 12px}
.stale-note .ic{width:14px;height:14px}

/* ---- Alineaciones: campo ---- */
.lineup-team{margin-bottom:22px}
.formation-tag{margin-left:auto;background:var(--surface-3);color:var(--accent);
  font-size:11px;font-weight:800;letter-spacing:.06em;padding:3px 10px;border-radius:999px}
.pitch{position:relative;overflow:hidden;border:1px solid var(--hairline-2);border-radius:var(--r-lg);
  padding:18px 8px;display:flex;flex-direction:column;justify-content:space-between;min-height:330px;
  background:linear-gradient(180deg,#15824f 0%,#0f6b40 100%);background-color:#117a49}
.pitch::before{content:"";position:absolute;inset:0;
  background-image:repeating-linear-gradient(180deg,rgba(255,255,255,.05) 0 36px,transparent 36px 72px)}
.pitch::after{content:"";position:absolute;left:50%;top:14%;width:78px;height:78px;
  transform:translateX(-50%);border:2px solid rgba(255,255,255,.18);border-radius:50%}
.pitch-row{position:relative;z-index:1;display:flex;justify-content:space-evenly;align-items:center;gap:4px;padding:2px 0}
.chip{display:flex;flex-direction:column;align-items:center;gap:5px;width:66px;flex:none}
.chip .avatar{position:relative;width:46px;height:46px;border-radius:50%;overflow:hidden;
  background:linear-gradient(180deg,#e9eef5,#cdd6e4);border:2px solid var(--accent);
  box-shadow:0 3px 10px rgba(0,0,0,.45);display:grid;place-items:center}
.chip .avatar img{position:absolute;inset:0;width:100%;height:100%;object-fit:cover;z-index:1}
.chip .avatar i{font-style:normal;font-weight:800;font-size:15px;color:#0a0e1a;
  font-variant-numeric:tabular-nums;display:none}
.chip .avatar.noimg i{display:block}
.chip .avatar .badge{position:absolute;z-index:2;right:-3px;bottom:-3px;min-width:17px;height:17px;
  padding:0 4px;border-radius:9px;background:var(--accent);color:var(--accent-ink);
  font-size:10px;font-weight:800;display:grid;place-items:center;box-shadow:0 2px 5px rgba(0,0,0,.4)}
.chip .avatar.noimg .badge{display:none}
.chip.gk .avatar{border-color:var(--gold)}
.chip.gk .avatar .badge{background:var(--gold);color:#3a2b00}
.chip .nm{font-size:10.5px;font-weight:600;color:#eafff4;text-align:center;line-height:1.15;
  max-width:66px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;text-shadow:0 1px 3px rgba(0,0,0,.5)}
.lineup-coach{display:flex;align-items:center;gap:7px;color:var(--txt);font-size:12.5px;margin:10px 4px 0}
.lineup-coach .ic{width:15px;height:15px;color:var(--indigo)}
.lineup-coach .k{font-weight:800;color:var(--muted);letter-spacing:.04em}

@media (prefers-reduced-motion:reduce){*{animation-duration:.001s!important;transition-duration:.001s!important}}
