/* =============================================
   PALPITEIRO COPA 2026 — CSS Principal
   Mobile-first, compatível com todos os browsers
   ============================================= */

:root {
  --green-700: #15803d;
  --green-600: #16a34a;
  --green-500: #22c55e;
  --green-100: #dcfce7;
  --green-50:  #f0fdf4;
  --yellow-400: #facc15;
  --yellow-100: #fef9c3;
  --red-600:   #dc2626;
  --red-100:   #fee2e2;
  --blue-600:  #2563eb;
  --gray-900:  #111827;
  --gray-800:  #1f2937;
  --gray-700:  #374151;
  --gray-600:  #4b5563;
  --gray-400:  #9ca3af;
  --gray-200:  #e5e7eb;
  --gray-100:  #f3f4f6;
  --gray-50:   #f9fafb;
  --white:     #ffffff;
  --shadow-sm: 0 1px 3px rgba(0,0,0,.08);
  --shadow-md: 0 4px 12px rgba(0,0,0,.10);
  --shadow-lg: 0 8px 24px rgba(0,0,0,.12);
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  background: var(--gray-50);
  color: var(--gray-800);
  line-height: 1.5;
  min-height: 100vh;
  -webkit-tap-highlight-color: transparent;
}

/* ── Typography ─────────────────────────────── */
h1 { font-size: 1.6rem; font-weight: 700; }
h2 { font-size: 1.35rem; font-weight: 700; }
h3 { font-size: 1.05rem; font-weight: 600; }
a  { color: var(--green-700); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ── Layout ─────────────────────────────────── */
.container  { max-width: 800px; margin: 0 auto; padding: 0 16px; }
.page-wrap  { padding: 20px 0 80px; }

/* ── Navbar ─────────────────────────────────── */
.navbar {
  background: var(--green-700);
  color: #fff;
  padding: 0 16px;
  height: 52px;
  display: -webkit-flex;
  display: flex;
  -webkit-align-items: center;
  align-items: center;
  -webkit-justify-content: space-between;
  justify-content: space-between;
  position: -webkit-sticky;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 2px 8px rgba(0,0,0,.15);
}
.navbar-brand {
  font-size: 1.05rem;
  font-weight: 700;
  color: #fff;
  display: -webkit-flex;
  display: flex;
  -webkit-align-items: center;
  align-items: center;
  gap: 6px;
  cursor: pointer;
}
.navbar-menu {
  display: -webkit-flex;
  display: flex;
  gap: 2px;
  -webkit-align-items: center;
  align-items: center;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  max-width: 70vw;
}
.navbar-menu a {
  color: rgba(255,255,255,.85);
  padding: 6px 10px;
  border-radius: var(--radius-sm);
  font-size: .82rem;
  white-space: nowrap;
  -webkit-transition: background .15s;
  transition: background .15s;
}
.navbar-menu a:hover,
.navbar-menu a.active { background: rgba(255,255,255,.2); color: #fff; text-decoration: none; }

/* ── Cards ──────────────────────────────────── */
.card {
  background: var(--white);
  border-radius: var(--radius-md);
  border: 1px solid var(--gray-200);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}
.card-header {
  padding: 14px 16px;
  border-bottom: 1px solid var(--gray-100);
  display: -webkit-flex;
  display: flex;
  -webkit-align-items: center;
  align-items: center;
  -webkit-justify-content: space-between;
  justify-content: space-between;
}
.card-body { padding: 16px; }

/* ── Buttons ─────────────────────────────────── */
.btn {
  display: -webkit-inline-flex;
  display: inline-flex;
  -webkit-align-items: center;
  align-items: center;
  -webkit-justify-content: center;
  justify-content: center;
  gap: 6px;
  padding: 11px 20px;
  border-radius: var(--radius-sm);
  font-size: .9rem;
  font-weight: 500;
  cursor: pointer;
  border: none;
  -webkit-transition: all .15s;
  transition: all .15s;
  text-decoration: none;
  line-height: 1;
  min-height: 44px; /* touch target mínimo iOS */
  -webkit-appearance: none;
  touch-action: manipulation;
  white-space: nowrap;
}
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-primary  { background: var(--green-700); color: #fff; }
.btn-primary:hover:not(:disabled),
.btn-primary:active:not(:disabled) { background: var(--green-600); color: #fff; text-decoration: none; }
.btn-secondary { background: var(--gray-100); color: var(--gray-700); border: 1px solid var(--gray-200); }
.btn-secondary:hover:not(:disabled) { background: var(--gray-200); text-decoration: none; }
.btn-danger   { background: var(--red-600); color: #fff; }
.btn-danger:hover:not(:disabled) { background: #b91c1c; color: #fff; text-decoration: none; }
.btn-whatsapp { background: #25d366; color: #fff; }
.btn-whatsapp:hover:not(:disabled),
.btn-whatsapp:active:not(:disabled) { background: #1ebe5d; color: #fff; text-decoration: none; }
.btn-sm  { padding: 8px 14px; font-size: .82rem; min-height: 36px; }
.btn-lg  { padding: 14px 28px; font-size: 1rem; min-height: 52px; }
.btn-block { width: 100%; }

/* ── Forms ──────────────────────────────────── */
.form-group { margin-bottom: 16px; }
.form-label { display: block; font-size: .875rem; font-weight: 500; color: var(--gray-700); margin-bottom: 4px; }
.form-control {
  width: 100%;
  padding: 12px 14px;
  border: 1px solid var(--gray-200);
  border-radius: var(--radius-sm);
  font-size: 1rem; /* evita zoom no iOS (mínimo 16px) */
  color: var(--gray-800);
  background: var(--white);
  -webkit-transition: border-color .15s;
  transition: border-color .15s;
  outline: none;
  -webkit-appearance: none;
  appearance: none;
  min-height: 44px;
}
.form-control:focus { border-color: var(--green-600); box-shadow: 0 0 0 3px rgba(22,163,74,.15); }
select.form-control { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%239ca3af' stroke-width='1.5' fill='none' stroke-linecap='round'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 12px center; padding-right: 36px; }
.form-hint { font-size: .8rem; color: var(--gray-400); margin-top: 4px; }

/* ── Score input ─────────────────────────────── */
.score-input-group {
  display: -webkit-flex;
  display: flex;
  -webkit-align-items: center;
  align-items: center;
  gap: 12px;
  -webkit-justify-content: center;
  justify-content: center;
  padding: 16px 0;
}
.score-input {
  width: 72px;
  height: 72px;
  text-align: center;
  font-size: 2rem;
  font-weight: 700;
  border: 2px solid var(--gray-200);
  border-radius: var(--radius-md);
  outline: none;
  color: var(--gray-900);
  -webkit-appearance: none;
  appearance: none;
  padding: 0;
  min-height: 0;
}
.score-input:focus { border-color: var(--green-600); box-shadow: 0 0 0 3px rgba(22,163,74,.15); }
/* Remove spinner nos inputs number */
.score-input::-webkit-inner-spin-button,
.score-input::-webkit-outer-spin-button { -webkit-appearance: none; margin: 0; }
.score-input[type=number] { -moz-appearance: textfield; }
.score-vs { font-size: 1.2rem; font-weight: 600; color: var(--gray-400); }

/* ── Match card ─────────────────────────────── */
.match-card {
  background: var(--white);
  border: 1px solid var(--gray-200);
  border-radius: var(--radius-md);
  padding: 14px;
  margin-bottom: 10px;
  -webkit-transition: box-shadow .15s;
  transition: box-shadow .15s;
  cursor: pointer;
  -webkit-user-select: none;
  user-select: none;
}
.match-card:active { box-shadow: var(--shadow-md); }
.match-card.has-prediction { border-left: 3px solid var(--green-500); }
.match-card.no-prediction  { border-left: 3px solid var(--gray-200); }
.match-card.finished       { border-left: 3px solid var(--gray-400); }
.match-teams {
  display: -webkit-flex;
  display: flex;
  -webkit-align-items: center;
  align-items: center;
  -webkit-justify-content: space-between;
  justify-content: space-between;
  gap: 6px;
}
.team-name { font-weight: 600; font-size: .88rem; -webkit-flex: 1; flex: 1; }
.team-name.home { text-align: right; }
.team-name.away { text-align: left; }
.match-score-display {
  display: -webkit-flex;
  display: flex;
  -webkit-align-items: center;
  align-items: center;
  gap: 5px;
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--gray-900);
  min-width: 76px;
  -webkit-justify-content: center;
  justify-content: center;
}
.match-score-display .sep { color: var(--gray-400); }
.match-meta {
  font-size: .76rem;
  color: var(--gray-400);
  margin-top: 6px;
  text-align: center;
  display: -webkit-flex;
  display: flex;
  -webkit-align-items: center;
  align-items: center;
  -webkit-justify-content: center;
  justify-content: center;
  gap: 6px;
  -webkit-flex-wrap: wrap;
  flex-wrap: wrap;
}
.prediction-badge {
  font-size: .72rem;
  padding: 2px 8px;
  border-radius: 99px;
  font-weight: 600;
}
.badge-exact    { background: var(--green-100); color: var(--green-700); }
.badge-correct  { background: var(--yellow-100); color: #854d0e; }
.badge-wrong    { background: var(--red-100); color: var(--red-600); }
.badge-pending  { background: var(--gray-100); color: var(--gray-600); }
.badge-open     { background: var(--green-50); color: var(--green-700); border: 1px solid var(--green-500); }

/* ── Leaderboard ─────────────────────────────── */
.leaderboard-row {
  display: -webkit-flex;
  display: flex;
  -webkit-align-items: center;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  border-bottom: 1px solid var(--gray-100);
  -webkit-transition: background .1s;
  transition: background .1s;
}
.leaderboard-row:last-child { border-bottom: none; }
.leaderboard-row:active { background: var(--gray-50); }
.leaderboard-row.is-me { background: var(--green-50); }
.rank-badge {
  width: 32px;
  height: 32px;
  min-width: 32px;
  border-radius: 50%;
  display: -webkit-flex;
  display: flex;
  -webkit-align-items: center;
  align-items: center;
  -webkit-justify-content: center;
  justify-content: center;
  font-weight: 700;
  font-size: .82rem;
  flex-shrink: 0;
}
.rank-1 { background: #fef08a; color: #713f12; }
.rank-2 { background: var(--gray-200); color: var(--gray-700); }
.rank-3 { background: #fed7aa; color: #7c2d12; }
.rank-other { background: var(--gray-100); color: var(--gray-600); }
.avatar {
  width: 36px;
  height: 36px;
  min-width: 36px;
  border-radius: 50%;
  background: var(--green-100);
  display: -webkit-flex;
  display: flex;
  -webkit-align-items: center;
  align-items: center;
  -webkit-justify-content: center;
  justify-content: center;
  font-weight: 700;
  color: var(--green-700);
  font-size: .82rem;
  flex-shrink: 0;
  overflow: hidden;
}
.avatar img { width: 100%; height: 100%; object-fit: cover; border-radius: 50%; }
.leaderboard-name { -webkit-flex: 1; flex: 1; font-weight: 500; font-size: .88rem; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.leaderboard-pts { font-weight: 700; font-size: .95rem; color: var(--green-700); min-width: 44px; text-align: right; }
.leaderboard-detail { font-size: .72rem; color: var(--gray-400); }

/* ── Group card ──────────────────────────────── */
.group-card {
  background: var(--white);
  border: 1px solid var(--gray-200);
  border-radius: var(--radius-lg);
  padding: 16px;
  margin-bottom: 12px;
  cursor: pointer;
  -webkit-transition: all .15s;
  transition: all .15s;
  text-decoration: none;
  color: inherit;
  display: block;
  -webkit-tap-highlight-color: transparent;
}
.group-card:active { box-shadow: var(--shadow-md); border-color: var(--green-500); }
.group-card-header {
  display: -webkit-flex;
  display: flex;
  -webkit-align-items: center;
  align-items: center;
  gap: 12px;
  margin-bottom: 10px;
}
.group-avatar {
  width: 44px;
  height: 44px;
  min-width: 44px;
  border-radius: var(--radius-sm);
  background: var(--green-100);
  display: -webkit-flex;
  display: flex;
  -webkit-align-items: center;
  align-items: center;
  -webkit-justify-content: center;
  justify-content: center;
  font-size: 1.3rem;
  flex-shrink: 0;
}
.group-name { font-weight: 700; font-size: .95rem; }
.group-meta { font-size: .78rem; color: var(--gray-400); margin-top: 2px; }
.my-rank-pill {
  margin-left: auto;
  background: var(--green-100);
  color: var(--green-700);
  font-weight: 700;
  font-size: .82rem;
  padding: 4px 12px;
  border-radius: 99px;
  white-space: nowrap;
}
.prize-pill {
  background: var(--yellow-100);
  color: #854d0e;
  font-size: .72rem;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 99px;
  display: -webkit-inline-flex;
  display: inline-flex;
  -webkit-align-items: center;
  align-items: center;
  gap: 4px;
}

/* ── Status badges ───────────────────────────── */
.status-badge {
  font-size: .7rem;
  font-weight: 600;
  padding: 2px 7px;
  border-radius: 99px;
  text-transform: uppercase;
  letter-spacing: .03em;
  white-space: nowrap;
}
.status-scheduled { background: var(--green-50); color: var(--green-700); border: 1px solid var(--green-500); }
.status-live { background: #fee2e2; color: var(--red-600); -webkit-animation: pulse 1.5s infinite; animation: pulse 1.5s infinite; }
.status-finished { background: var(--gray-100); color: var(--gray-600); }
.status-cancelled { background: #f3e8ff; color: #7c3aed; }

@-webkit-keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: .6; } }
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: .6; } }

/* ── Alerts ─────────────────────────────────── */
.alert {
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  font-size: .875rem;
  margin-bottom: 16px;
  display: -webkit-flex;
  display: flex;
  -webkit-align-items: flex-start;
  align-items: flex-start;
  gap: 8px;
  line-height: 1.5;
}
.alert-success { background: var(--green-50); color: var(--green-700); border: 1px solid var(--green-500); }
.alert-danger  { background: var(--red-100); color: var(--red-600); border: 1px solid #fca5a5; }
.alert-info    { background: #eff6ff; color: var(--blue-600); border: 1px solid #bfdbfe; }
.alert-warning { background: var(--yellow-100); color: #854d0e; border: 1px solid #fde68a; }

/* ── Modal ──────────────────────────────────── */
.modal-backdrop {
  position: fixed; inset: 0;
  background: rgba(0,0,0,.55);
  display: -webkit-flex;
  display: flex;
  -webkit-align-items: flex-end; /* mobile: modal sobe da base */
  align-items: flex-end;
  -webkit-justify-content: center;
  justify-content: center;
  z-index: 200;
  padding: 0;
  -webkit-overflow-scrolling: touch;
}
.modal-backdrop.hidden { display: none; }
.modal {
  background: var(--white);
  border-radius: var(--radius-lg) var(--radius-lg) 0 0; /* arredonda só em cima no mobile */
  width: 100%;
  max-width: 520px;
  max-height: 92vh;
  overflow-y: auto;
  box-shadow: var(--shadow-lg);
  -webkit-overflow-scrolling: touch;
}
.modal-header {
  padding: 16px 16px 0;
  display: -webkit-flex;
  display: flex;
  -webkit-align-items: center;
  align-items: center;
  -webkit-justify-content: space-between;
  justify-content: space-between;
  /* Handle visual para arrastar */
  padding-top: 20px;
}
.modal-header::before {
  content: "";
  position: absolute;
  top: 8px;
  left: 50%;
  transform: translateX(-50%);
  width: 36px;
  height: 4px;
  background: var(--gray-200);
  border-radius: 99px;
}
.modal { position: relative; } /* para o ::before funcionar */
.modal-body  { padding: 16px; }
.modal-footer { padding: 0 16px 24px; display: -webkit-flex; display: flex; gap: 8px; -webkit-justify-content: flex-end; justify-content: flex-end; }
.btn-close {
  background: none;
  border: none;
  font-size: 1.6rem;
  cursor: pointer;
  color: var(--gray-400);
  padding: 4px 8px;
  line-height: 1;
  min-height: auto;
  -webkit-tap-highlight-color: transparent;
}

/* ── Stage section ───────────────────────────── */
.stage-label {
  font-size: .72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--gray-400);
  padding: 14px 0 6px;
}

/* ── Empty state ────────────────────────────── */
.empty-state { text-align: center; padding: 48px 16px; color: var(--gray-400); }
.empty-state .emoji { font-size: 2.8rem; margin-bottom: 10px; }
.empty-state p { font-size: .9rem; }

/* ── Loading spinner ─────────────────────────── */
.spinner {
  width: 32px;
  height: 32px;
  border: 3px solid var(--gray-200);
  border-top-color: var(--green-600);
  border-radius: 50%;
  -webkit-animation: spin .7s linear infinite;
  animation: spin .7s linear infinite;
  margin: 32px auto;
}
@-webkit-keyframes spin { to { -webkit-transform: rotate(360deg); transform: rotate(360deg); } }
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Tabs ────────────────────────────────────── */
.tabs {
  display: -webkit-flex;
  display: flex;
  border-bottom: 2px solid var(--gray-200);
  margin-bottom: 16px;
  gap: 2px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}
.tabs::-webkit-scrollbar { display: none; }
.tab-btn {
  padding: 10px 14px;
  border: none;
  background: none;
  font-size: .85rem;
  color: var(--gray-500);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  font-weight: 500;
  -webkit-transition: all .15s;
  transition: all .15s;
  white-space: nowrap;
  min-height: 44px;
  -webkit-tap-highlight-color: transparent;
}
.tab-btn.active { color: var(--green-700); border-bottom-color: var(--green-700); }
.tab-content.hidden { display: none; }

/* ── Bottom nav ──────────────────────────────── */
.bottom-nav {
  position: fixed;
  bottom: 0; left: 0; right: 0;
  background: var(--white);
  border-top: 1px solid var(--gray-200);
  display: -webkit-flex;
  display: flex;
  z-index: 100;
  box-shadow: 0 -2px 8px rgba(0,0,0,.06);
  padding-bottom: env(safe-area-inset-bottom, 0); /* iPhone notch */
}
.bottom-nav a {
  -webkit-flex: 1;
  flex: 1;
  display: -webkit-flex;
  display: flex;
  -webkit-flex-direction: column;
  flex-direction: column;
  -webkit-align-items: center;
  align-items: center;
  -webkit-justify-content: center;
  justify-content: center;
  padding: 8px 4px;
  color: var(--gray-400);
  font-size: .65rem;
  gap: 3px;
  -webkit-transition: color .15s;
  transition: color .15s;
  text-decoration: none;
  min-height: 52px;
  -webkit-tap-highlight-color: transparent;
}
.bottom-nav a.active { color: var(--green-700); }
.bottom-nav a svg { width: 22px; height: 22px; }

/* ── Responsive ──────────────────────────────── */
@media (min-width: 600px) {
  .modal-backdrop { -webkit-align-items: center; align-items: center; padding: 16px; }
  .modal { border-radius: var(--radius-lg); max-height: 90vh; }
  .modal-header::before { display: none; }
  .match-card:hover { box-shadow: var(--shadow-md); }
  .group-card:hover { box-shadow: var(--shadow-md); border-color: var(--green-500); }
}

@media (max-width: 380px) {
  .team-name { font-size: .8rem; }
  .match-score-display { font-size: 1rem; min-width: 64px; }
  .navbar-menu a { padding: 6px 7px; font-size: .78rem; }
  .leaderboard-detail { display: none; }
  h2 { font-size: 1.2rem; }
}

/* ── Utilitários ─────────────────────────────── */
.hidden { display: none !important; }
.text-center { text-align: center; }
code { font-family: monospace; background: var(--gray-100); padding: 2px 6px; border-radius: 4px; font-size: .85em; word-break: break-all; }
