/* ═══════════════════════════════════════
   SQ3 TORNEO - ESTILOS
   ═══════════════════════════════════════ */

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html, body, #root { height: 100%; width: 100%; overflow: hidden; }
body { font-family: 'DM Sans', -apple-system, BlinkMacSystemFont, sans-serif; background: #f5f5f5; }
*::-webkit-scrollbar { display: none; }
* { -ms-overflow-style: none; scrollbar-width: none; -webkit-tap-highlight-color: transparent; }

/* ─── ANIMACIONES ─── */
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes splashFadeOut { 0%{opacity:1} 100%{opacity:0;visibility:hidden} }
@keyframes logoAppear { 0%{opacity:0;transform:scale(0.7)} 100%{opacity:1;transform:scale(1)} }
@keyframes starPulse { 0%,100%{transform:scale(1);opacity:0.9} 50%{transform:scale(1.15);opacity:1} }
@keyframes arcGrow1 { 0%{transform:translate(-50%,-50%) scale(0);opacity:0} 100%{transform:translate(-50%,-50%) scale(1);opacity:1} }
@keyframes arcGrow2 { 0%{transform:translate(-50%,-50%) scale(0);opacity:0} 100%{transform:translate(-50%,-50%) scale(1);opacity:1} }
@keyframes arcGrow3 { 0%{transform:translate(-50%,-50%) scale(0);opacity:0} 100%{transform:translate(-50%,-50%) scale(1);opacity:1} }
@keyframes shimmer { 0%{background-position:-200% 0} 100%{background-position:200% 0} }
@keyframes appSlideUp { 0%{opacity:0;transform:translateY(30px)} 100%{opacity:1;transform:translateY(0)} }

/* ─── SPLASH SCREEN ─── */
.splash-screen { position:fixed;top:0;left:0;width:100%;height:100%;z-index:9999;display:flex;align-items:center;justify-content:center;background:#3a1f08;overflow:hidden; }
.splash-screen.fade-out { animation:splashFadeOut 0.6s ease-out forwards; }
.splash-arc { position:absolute;border-radius:50%;left:50%;top:50%;transform:translate(-50%,-50%) scale(0); }
.splash-arc-1 { width:180vmax;height:180vmax;background:radial-gradient(circle at 30% 40%,#8b4513 0%,#5a2d0a 60%,#3a1f08 100%);animation:arcGrow1 .8s cubic-bezier(.22,1,.36,1) .1s forwards; }
.splash-arc-2 { width:130vmax;height:130vmax;background:radial-gradient(circle at 40% 45%,#c06a20 0%,#9b5115 50%,#6b3610 100%);animation:arcGrow2 .7s cubic-bezier(.22,1,.36,1) .3s forwards; }
.splash-arc-3 { width:85vmax;height:85vmax;background:radial-gradient(circle at 45% 48%,#e8871f 0%,#d0751a 40%,#b05e14 100%);animation:arcGrow3 .6s cubic-bezier(.22,1,.36,1) .5s forwards; }
.splash-logo { position:relative;z-index:10;display:flex;flex-direction:column;align-items:center;opacity:0;animation:logoAppear .8s cubic-bezier(.22,1,.36,1) .9s forwards; }

/* ─── APP SHELL ─── */
.app-shell { display:flex;flex-direction:column;height:100vh;width:100%;max-width:430px;margin:0 auto;background:#fff;overflow:hidden;box-shadow:0 0 40px rgba(0,0,0,0.08); }
.app-shell.entering { animation:appSlideUp .5s ease-out forwards; }

/* ─── HEADER ─── */
.header-orange { background:linear-gradient(135deg,#e8751a 0%,#d06a12 100%);padding:20px 0 16px;display:flex;flex-direction:column;align-items:center; }

/* ─── SUBHEADER ─── */
.subheader { padding:12px 16px 8px;background:#fff; }
.subheader h1 { color:#d06a12;font-weight:700;font-size:17px;line-height:1.2;margin:0; }
.subheader p { color:#c49a5c;font-size:13px;font-weight:400;margin:0 0 10px; }
.cat-row { display:flex;gap:8px;overflow-x:auto;padding-bottom:4px; }
.cat-btn { padding:5px 14px;border-radius:20px;font-size:12px;font-weight:700;border:1.5px solid #ccc;background:#fff;color:#555;cursor:pointer;flex-shrink:0;font-family:inherit; }
.cat-btn.active { border-color:#e8751a;background:#e8751a;color:#fff; }

/* ─── CONTENT ─── */
.content-area { flex:1;overflow-y:auto;background:#fff; }

/* ─── PARTIDOS ─── */
.fecha-header { text-align:center;padding:14px 0 8px;border-bottom:1px solid #eee; }
.fecha-header span { font-size:15px;font-weight:800;color:#e8751a;letter-spacing:1.5px; }
.match-row { border-bottom:1px solid #f0f0f0;padding:0 16px; }
.match-zone { text-align:center;padding-top:10px;font-size:10px;font-weight:700;color:#e8751a;letter-spacing:1px; }
.match-content { display:flex;align-items:center;justify-content:space-between;padding:10px 0; }
.match-team { display:flex;align-items:center;gap:6px;flex:1;min-width:0; }
.match-team.home { justify-content:flex-end; }
.match-team-name { font-size:11px;font-weight:700;color:#222;overflow:hidden;text-overflow:ellipsis;white-space:nowrap; }
.match-team.home .match-team-name { text-align:right; }
.match-score { display:flex;align-items:center;gap:3px;padding:0 10px;min-width:60px;justify-content:center; }
.match-score span { font-size:17px;font-weight:800;color:#222; }
.match-score .sep { font-size:13px;color:#bbb;font-weight:500; }
.match-vs { padding:0 10px;font-size:12px;font-weight:600;color:#999; }
.match-info { text-align:center;padding-bottom:10px;font-size:10px;color:#aaa;letter-spacing:0.3px; }

/* ─── ESCUDOS ─── */
.team-shield { border-radius:50%;display:flex;align-items:center;justify-content:center;flex-shrink:0;overflow:hidden;background:#f0f0f0;border:1px solid #e0e0e0; }
.team-shield img { width:100%;height:100%;object-fit:contain; }

/* ─── TABLA POSICIONES ─── */
.zone-title { text-align:center;padding:14px 0 10px; }
.zone-title span { font-size:15px;font-weight:800;color:#e8751a;letter-spacing:2px; }
.table-header { display:flex;align-items:center;padding:8px 12px;border-bottom:2px solid #e8751a; }
.table-header span { font-size:10px;font-weight:700;color:#bbb;text-align:center; }
.table-header span.pts-col { color:#e8751a; }
.table-row { display:flex;align-items:center;padding:7px 12px;border-bottom:1px solid #f0f0f0; }
.table-row:nth-child(even) { background:#fafafa; }
.table-row .pos { width:18px;font-size:11px;font-weight:700;color:#999;text-align:center; }
.table-row .team-cell { flex:1;display:flex;align-items:center;gap:5px;padding-left:2px;min-width:0; }
.table-row .team-cell span { font-size:10.5px;font-weight:600;color:#222;overflow:hidden;text-overflow:ellipsis;white-space:nowrap; }
.table-row .stat { font-size:11px;text-align:center;font-weight:500;color:#555; }
.table-row .stat.pts { font-weight:800;color:#e8751a; }
.table-row .stat.dim { color:#aaa; }
.table-row .stat.pos-dg { color:#2a8c2a; }
.table-row .stat.neg-dg { color:#cc3333; }
.table-row .stat.zero-dg { color:#888; }
/* ─── HIGHLIGHTS ORO / PLATA ─── */
.table-row.row-oro {
  border-left: 3px solid #d4a017;
}
.table-row.row-plata {
  border-left: 3px solid #aaa;
}
.table-row.row-oro .pos { color: #d4a017; }
.table-row.row-plata .pos { color: #aaa; }

.cup-legend {
  display: flex;
  justify-content: center;
  gap: 20px;
  padding: 0 16px 16px;
}
.legend-item {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  color: #666;
  font-weight: 600;
}
.legend-color {
  width: 12px;
  height: 12px;
  border-radius: 3px;
}
.legend-oro { background: #d4a017; }
.legend-plata { background: #aaa; }

/* ─── GOLEADORES ─── */
.scorer-header,.scorer-row { display:flex;align-items:center;padding:8px 16px; }
.scorer-header { padding:10px 16px;border-bottom:2px solid #e8751a; }
.scorer-header span { font-size:10px;font-weight:700;color:#999; }
.scorer-header .goals-h { color:#e8751a;text-align:right; }
.scorer-row { border-bottom:1px solid #f0f0f0; }
.scorer-row:nth-child(even) { background:#fafafa; }
.scorer-pos { width:28px;display:flex;align-items:center;gap:3px; }
.scorer-pos span { font-size:11px;font-weight:700;color:#555; }
.scorer-name { flex:1;font-size:11px;font-weight:700;color:#222;padding-left:4px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap; }
.scorer-team { width:130px;font-size:10px;color:#888;overflow:hidden;text-overflow:ellipsis;white-space:nowrap; }
.scorer-goals { width:45px;font-size:13px;font-weight:800;color:#222;text-align:right; }

/* ─── SANCIONADOS ─── */
.sanc-header,.sanc-row { display:flex;align-items:center;padding:9px 16px; }
.sanc-header { padding:10px 16px;border-bottom:2px solid #e8751a; }
.sanc-header span { font-size:10px;font-weight:700;color:#999; }
.sanc-header .sanc-h { color:#e8751a;text-align:center; }
.sanc-row { border-bottom:1px solid #f0f0f0; }
.sanc-row:nth-child(even) { background:#fafafa; }
.sanc-player { flex:1;display:flex;align-items:center;gap:5px;min-width:0; }
.sanc-player span { font-size:11px;font-weight:700;color:#222;overflow:hidden;text-overflow:ellipsis;white-space:nowrap; }
.sanc-team-col { width:115px;font-size:10px;color:#888;overflow:hidden;text-overflow:ellipsis;white-space:nowrap; }
.sanc-val { width:85px;font-size:12px;font-weight:700;color:#e8751a;text-align:center; }
.sanc-art { width:48px;font-size:10px;color:#aaa;text-align:center; }

/* ─── BOTONES Y UTILIDADES ─── */
.btn-orange { background:#e8751a;color:#fff;border:none;border-radius:25px;padding:10px 28px;font-size:12px;font-weight:700;cursor:pointer;font-family:inherit;letter-spacing:0.5px; }
.btn-center { display:flex;justify-content:center;padding:20px 0; }
.loading { display:flex;flex-direction:column;align-items:center;padding:60px 0;gap:12px; }
.load-spinner { width:36px;height:36px;border:3px solid #f0f0f0;border-top-color:#e8751a;border-radius:50%;animation:spin .7s linear infinite; }
.loading span { font-size:12px;color:#aaa; }
.error-msg { text-align:center;padding:40px 20px;color:#cc3333;font-size:13px; }

/* ─── BOTTOM NAV ─── */
.bottom-nav { display:flex;align-items:center;justify-content:space-around;padding:8px 0 12px;background:#fff;border-top:1px solid #eee; }
.nav-btn { display:flex;flex-direction:column;align-items:center;gap:2px;background:none;border:none;cursor:pointer;padding:2px 4px;font-family:inherit; }
.nav-btn span { font-size:9px;font-weight:600;color:#aaa; }
.nav-btn.active span { color:#e8751a; }
.nav-btn svg { stroke:#aaa; }
.nav-btn.active svg { stroke:#e8751a; }

/* ─── BRACKET / PLAYOFFS ─── */
.bracket-section { padding:16px; }
.bracket-title { text-align:center; padding:10px 0; margin-bottom:8px; }
.bracket-title span { font-size:15px; font-weight:800; letter-spacing:1.5px; }
.bracket-title .gold { color:#d4a017; }
.bracket-title .silver { color:#888; }
.bracket-container { display:flex; align-items:center; justify-content:center; gap:0; overflow-x:auto; padding:8px 0; }
.bracket-round { display:flex; flex-direction:column; justify-content:center; gap:20px; min-width:140px; }
.bracket-match {
  background:#fff; border:1px solid #eee; border-radius:10px; padding:8px 10px;
  display:flex; flex-direction:column; gap:4px; min-width:130px;
  box-shadow:0 1px 4px rgba(0,0,0,0.05);
}
.bracket-match.gold-border { border-left:3px solid #d4a017; }
.bracket-match.silver-border { border-left:3px solid #aaa; }
.bracket-team-row { display:flex; align-items:center; justify-content:space-between; gap:4px; padding:2px 0; }
.bracket-team-row .bt-name { font-size:10px; font-weight:700; color:#222; flex:1; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.bracket-team-row .bt-score { font-size:12px; font-weight:800; color:#222; min-width:18px; text-align:center; }
.bracket-team-row.winner .bt-name { color:#d4a017; }
.bracket-team-row.winner .bt-score { color:#d4a017; }
.bracket-connector { width:24px; display:flex; flex-direction:column; justify-content:center; align-items:center; }
.bracket-connector .line-top, .bracket-connector .line-bot { width:100%; height:50%; border-right:2px solid #ddd; }
.bracket-connector .line-top { border-bottom:2px solid #ddd; }
.bracket-connector .line-bot { border-top:none; }
.bracket-label { font-size:9px; font-weight:600; color:#aaa; text-align:center; padding-bottom:6px; letter-spacing:1px; }
.bracket-champion {
  text-align:center; padding:12px; margin-top:8px;
  background:linear-gradient(135deg,#fef3c7,#fde68a); border-radius:12px; border:1px solid #f59e0b;
}
.bracket-champion .champ-label { font-size:10px; color:#92400e; font-weight:600; letter-spacing:1px; }
.bracket-champion .champ-name { font-size:16px; font-weight:800; color:#92400e; margin-top:4px; }
.playoffs-toggle { display:flex; gap:8px; justify-content:center; margin-bottom:12px; }
.playoffs-toggle button {
  padding:6px 16px; border-radius:20px; font-size:11px; font-weight:700;
  border:1.5px solid #ddd; background:#fff; color:#888; cursor:pointer; font-family:inherit;
}
.playoffs-toggle button.gold-active { border-color:#d4a017; background:#d4a017; color:#fff; }
.playoffs-toggle button.silver-active { border-color:#888; background:#888; color:#fff; }

/* ═══════════════════════════════════════
   DESKTOP (768px+)
   ═══════════════════════════════════════ */
@media (min-width: 768px) {
  body { background:#f0ebe4; }
  .app-shell {
    max-width:1100px; flex-direction:row; height:100vh;
    border-radius:16px; overflow:hidden; margin:20px auto;
    height:calc(100vh - 40px); box-shadow:0 8px 40px rgba(0,0,0,0.12);
  }
  .sidebar-desktop {
    display:flex; flex-direction:column; width:220px; flex-shrink:0;
    background:linear-gradient(180deg,#e8751a 0%,#c45a0a 100%);
  }
  .sidebar-desktop .header-orange { background:transparent; padding:28px 20px 16px; }
  .sidebar-desktop .header-orange img { height:85px; }
  .sidebar-desktop .desktop-nav { display:flex; flex-direction:column; gap:2px; padding:12px 12px; flex:1; }
  .sidebar-desktop .desktop-nav button {
    display:flex; align-items:center; gap:10px; padding:10px 16px; border:none;
    border-radius:10px; background:transparent; cursor:pointer; font-family:inherit; transition:background 0.2s;
  }
  .sidebar-desktop .desktop-nav button:hover { background:rgba(255,255,255,0.12); }
  .sidebar-desktop .desktop-nav button.active { background:rgba(255,255,255,0.2); }
  .sidebar-desktop .desktop-nav button svg { stroke:rgba(255,255,255,0.7); }
  .sidebar-desktop .desktop-nav button.active svg { stroke:#fff; }
  .sidebar-desktop .desktop-nav button span { font-size:13px; font-weight:600; color:rgba(255,255,255,0.7); }
  .sidebar-desktop .desktop-nav button.active span { color:#fff; }
  .sidebar-desktop .sidebar-footer { padding:16px 20px; border-top:1px solid rgba(255,255,255,0.12); font-size:10px; color:rgba(255,255,255,0.4); text-align:center; }
  .main-desktop { display:flex; flex-direction:column; flex:1; min-width:0; background:#fff; }
  .bottom-nav { display:none !important; }
  .mobile-only { display:none !important; }
  .subheader { padding:20px 32px 12px; }
  .subheader h1 { font-size:22px; }
  .subheader p { font-size:14px; }
  .cat-btn { padding:6px 18px; font-size:13px; }
  .match-row { padding:0 32px; }
  .match-team-name { font-size:13px; }
  .match-score span { font-size:20px; }
  .fecha-header span { font-size:17px; }
  .table-header { padding:10px 24px; }
  .table-row { padding:9px 24px; }
  .table-row .team-cell span { font-size:12px; }
  .table-row .stat { font-size:12px; }
  .table-row .pos { font-size:12px; }
  .scorer-header, .scorer-row { padding:10px 32px; }
  .scorer-name { font-size:13px; }
  .scorer-team { width:200px; font-size:12px; }
  .scorer-goals { font-size:15px; }
  .sanc-header, .sanc-row { padding:10px 32px; }
  .sanc-player span { font-size:13px; }
  .sanc-team-col { width:180px; font-size:12px; }
  .zone-title span { font-size:18px; }
  .bracket-section { padding:24px 32px; }
  .bracket-match { min-width:160px; padding:10px 14px; }
  .bracket-team-row .bt-name { font-size:12px; }
  .bracket-team-row .bt-score { font-size:14px; }
}

/* ═══════════════════════════════════════
   MOBILE SAFE AREAS
   ═══════════════════════════════════════ */
@media (max-width: 767px) {
  .app-shell { height:100dvh; max-width:100%; }
  @supports (height:100dvh) { .app-shell { height:100dvh; } }
  .header-orange { padding-top:calc(16px + env(safe-area-inset-top,0px)); flex-shrink:0; }
  .subheader { flex-shrink:0; }
  .bottom-nav { padding-bottom:calc(12px + env(safe-area-inset-bottom,0px)); flex-shrink:0; }
  .sidebar-desktop { display:none; }
  .main-desktop { display:contents; }
}
/* Margen lateral para la tabla en mobile */
.table-header,
.table-row {
  margin: 0 16px;
  border-radius: 4px;
}

/* Margen lateral para la tabla en desktop */
@media (min-width: 768px) {
  .table-header,
  .table-row {
    margin: 0 32px;
  }
}