/* ────────────────────────────────────────────────────────────────────────────
   Bolão Copa do Mundo 2026 — design system
   "Caderno do Bolão" — editorial scoresheet com a paleta Figurex

   Note: Google Fonts are loaded via <link rel="preconnect"> + <link rel="stylesheet">
   in each HTML <head> — using @import here would serialize the font request
   behind the CSS download, blocking render by ~500ms-2s on slow networks.
   ──────────────────────────────────────────────────────────────────────────── */

:root {
  --primary: #1E4E8C;
  --primary-dark: #153966;
  --primary-tint: rgba(30, 78, 140, 0.06);
  --primary-tint-strong: rgba(30, 78, 140, 0.12);
  --primary-ring: rgba(30, 78, 140, 0.18);
  --secondary: #34B27B;
  --accent: #F59E0B;
  --accent-tint: rgba(245, 158, 11, 0.12);

  --bg: #F7F6F2;
  --paper: #FFFBF5;
  --paper-2: #FFFFFF;
  --text: #1F2937;
  --text-muted: #6B7280;
  --text-faint: #9CA3AF;

  --rule: #1E4E8C;
  --rule-faint: rgba(30, 78, 140, 0.18);
  --line: #E5E0D6;

  --danger: #EF4444;
  --warning: #F59E0B;
  --success: #34B27B;

  --radius: 12px;
  --radius-sm: 8px;
  --radius-lg: 16px;
  --radius-xl: 20px;
  --shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
  --shadow-hover: 0 6px 16px rgba(30, 78, 140, 0.12);

  --container: 960px;
  --container-tight: 640px;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  -webkit-font-smoothing: antialiased;
}

html, body { min-height: 100%; }

body {
  font-family: 'DM Sans', system-ui, sans-serif;
  font-size: 16px;
  line-height: 1.5;
  color: var(--text);
  background-color: var(--bg);
  /* Dot grid texture — paper feel without skeumorphism. */
  background-image:
    radial-gradient(circle at 1px 1px, rgba(30, 78, 140, 0.05) 1px, transparent 0);
  background-size: 28px 28px;
  background-attachment: fixed;
}

h1, h2, h3, h4, h5 {
  font-family: 'Fredoka', system-ui, sans-serif;
  font-weight: 500;
  letter-spacing: -0.005em;
  color: var(--text);
}

a {
  color: var(--primary);
  text-decoration: none;
  font-weight: 500;
}
a:hover { text-decoration: underline; }

button {
  font-family: 'DM Sans', system-ui, sans-serif;
  cursor: pointer;
}

input, textarea, select {
  font-family: 'DM Sans', system-ui, sans-serif;
  font-size: 0.95rem;
}

/* Tabular numerals everywhere we display scores/dates */
.tabular { font-variant-numeric: tabular-nums; font-feature-settings: 'tnum'; }

/* ── Brand strip (Figurex banner) ─────────────────────────────────────────── */

.brand-strip {
  background: var(--primary);
  color: white;
  font-size: 0.8rem;
  padding: 9px 16px;
  text-align: center;
  letter-spacing: 0.01em;
}
.brand-strip a {
  color: white;
  text-decoration: none;
  font-weight: 500;
}
.brand-strip a:hover { text-decoration: underline; }
.brand-strip .sep { opacity: 0.5; margin: 0 8px; }

/* ── Container ───────────────────────────────────────────────────────────── */

.container {
  max-width: var(--container);
  margin: 0 auto;
  padding: 0 20px;
}

.container.tight {
  max-width: var(--container-tight);
}

/* ── Signature motif — title sandwiched by two rules ──────────────────────── */

.signature {
  text-align: center;
  margin: 56px auto 32px;
  max-width: var(--container-tight);
  padding: 0 16px;
}
.signature::before,
.signature::after {
  content: '';
  display: block;
  height: 2px;
  background: var(--rule);
  margin: 0 auto;
}
.signature h1,
.signature h2 {
  font-family: 'Fredoka', sans-serif;
  font-size: clamp(1.3rem, 4.5vw, 2rem);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 18px 8px 8px;
  color: var(--primary);
}
.signature .year {
  font-family: 'DM Sans', sans-serif;
  font-feature-settings: 'tnum';
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.4em;
  color: var(--text-muted);
  font-size: 0.85rem;
  padding-bottom: 18px;
}
.signature .sublabel {
  font-family: 'DM Sans', sans-serif;
  font-size: 0.85rem;
  color: var(--text-muted);
  letter-spacing: 0.03em;
  padding: 0 8px 14px;
}
/* Action buttons row under the sublabel. Top padding mirrors the spacing
 * between sublabel and bottom rule (18px) so the row breathes the same as the
 * title at the top. */
.signature .signature-actions {
  display: flex;
  justify-content: center;
  gap: 10px;
  flex-wrap: wrap;
  padding: 4px 8px 18px;
}

/* Inline title block (smaller variant inside content sections). The `auto`
 * left/right margins matter when combined with `.container` — without them
 * the box-model defaults to left-aligned despite the parent's max-width. */
.section-title {
  margin: 48px auto 20px;
  border-top: 2px solid var(--rule);
  border-bottom: 2px solid var(--rule);
  padding: 12px 0;
  text-align: center;
}
.section-title h2 {
  font-family: 'Fredoka', sans-serif;
  font-size: 1.05rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--primary);
}

/* ── Top nav (in-app) ─────────────────────────────────────────────────────── */

.topnav {
  background: var(--paper);
  border-bottom: 1px solid var(--line);
  padding: 12px 0;
}
.topnav .inner {
  max-width: var(--container);
  margin: 0 auto;
  padding: 0 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}
.topnav .brand {
  display: flex;
  align-items: center;
  gap: 10px;
}
.topnav .brand .mark {
  font-family: 'Fredoka', sans-serif;
  font-weight: 600;
  color: var(--primary);
  font-size: 1rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.topnav .brand .sep {
  color: var(--text-faint);
  margin: 0 4px;
}
.topnav .brand .sub {
  color: var(--text-muted);
  font-size: 0.85rem;
}
.topnav .user {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 0.85rem;
  color: var(--text-muted);
}
.topnav .user .avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--primary-tint-strong);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-family: 'Fredoka', sans-serif;
  font-weight: 600;
  color: var(--primary);
  font-size: 0.8rem;
}
.topnav .links {
  display: flex;
  gap: 16px;
}
.topnav .links a {
  color: var(--text-muted);
  font-size: 0.9rem;
  font-weight: 500;
}
.topnav .links a.active {
  color: var(--primary);
}
.topnav .links a:hover { text-decoration: none; color: var(--primary); }

@media (max-width: 640px) {
  /* On mobile we used to hide the nav links entirely, which left users in
   * portrait stranded with no way to reach Regras/Curiosidades. Wrap the
   * inner row instead and push the links to their own line under the brand
   * and user info — visible, tappable, no hamburger needed. */
  .topnav .inner { flex-wrap: wrap; row-gap: 10px; }
  .topnav .brand { flex: 1; min-width: 0; }
  .topnav .links {
    order: 3;
    flex-basis: 100%;
    justify-content: center;
    gap: 14px;
    flex-wrap: wrap;
    padding-top: 10px;
    border-top: 1px solid var(--rule-faint);
  }
  .topnav .links a { font-size: 0.88rem; }
  .topnav .user .name { display: none; }
}

/* ── Verification banner (yellow) ─────────────────────────────────────────── */

.verify-banner {
  background: #FFF7E6;
  border-bottom: 1px solid #F2D98B;
  padding: 12px 16px;
  font-size: 0.9rem;
  color: #7A5A11;
  text-align: center;
}
.verify-banner button {
  background: transparent;
  border: 1px solid #C9A04A;
  color: #7A5A11;
  padding: 4px 12px;
  border-radius: 8px;
  font-size: 0.85rem;
  font-weight: 500;
  margin-left: 8px;
}
.verify-banner button:hover { background: #F2E6B8; }

/* ── Buttons ──────────────────────────────────────────────────────────────── */

.btn {
  min-height: 48px;
  padding: 0 18px;
  border-radius: var(--radius);
  border: 1px solid var(--primary);
  background: var(--primary);
  color: white;
  font-family: 'DM Sans', sans-serif;
  font-weight: 500;
  font-size: 0.95rem;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: all 0.15s ease;
  letter-spacing: 0.01em;
  text-decoration: none;
}
.btn:hover {
  background: var(--primary-dark);
  border-color: var(--primary-dark);
}
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

.btn.secondary {
  background: var(--paper-2);
  color: var(--primary);
}
.btn.secondary:hover {
  background: var(--primary-tint);
  color: var(--primary);
}

.btn.ghost {
  background: transparent;
  color: var(--primary);
  border-color: var(--rule-faint);
}
.btn.ghost:hover {
  background: var(--primary-tint);
  border-color: var(--primary);
}

.btn.danger {
  background: white;
  color: var(--danger);
  border-color: var(--danger);
}
.btn.danger:hover {
  background: var(--danger);
  color: white;
}

.btn.block { width: 100%; }
.btn.sm { min-height: 36px; padding: 0 12px; font-size: 0.85rem; }
.btn.lg { min-height: 56px; padding: 0 24px; font-size: 1rem; }

/* ── Inputs ───────────────────────────────────────────────────────────────── */

.input {
  width: 100%;
  height: 48px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: white;
  font-family: 'DM Sans', sans-serif;
  font-size: 0.95rem;
  color: var(--text);
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.input::placeholder { color: var(--text-faint); }
.input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-ring);
}
.input.error {
  border-color: var(--danger);
}
.input.error:focus {
  box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.18);
}

.field {
  margin-bottom: 14px;
}
.field label {
  display: block;
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-bottom: 6px;
  font-weight: 500;
  letter-spacing: 0.02em;
}

/* ── Divider with text ─────────────────────────────────────────────────────── */

.divider {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--text-muted);
  font-size: 0.8rem;
  margin: 18px 0;
  text-transform: uppercase;
  letter-spacing: 0.1em;
}
.divider::before,
.divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--rule-faint);
}

/* ── Form messages ────────────────────────────────────────────────────────── */

.form-msg {
  margin: 8px 0 4px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  border: 1px solid;
}
.form-msg.error {
  background: rgba(239, 68, 68, 0.06);
  color: var(--danger);
  border-color: rgba(239, 68, 68, 0.3);
}
.form-msg.success {
  background: rgba(52, 178, 123, 0.08);
  color: #1B6E47;
  border-color: rgba(52, 178, 123, 0.3);
}
.form-msg.info {
  background: var(--primary-tint);
  color: var(--primary-dark);
  border-color: var(--rule-faint);
}

/* ── Pool / list cards ────────────────────────────────────────────────────── */

.card {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px;
  transition: border-color 0.15s, box-shadow 0.15s, transform 0.15s;
}
.card.link {
  cursor: pointer;
}
.card.link:hover {
  border-color: var(--rule-faint);
  box-shadow: var(--shadow-hover);
  transform: translateY(-1px);
}

/* ── Labels / chips ───────────────────────────────────────────────────────── */

.chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 500;
  letter-spacing: 0.02em;
  background: var(--primary-tint);
  color: var(--primary-dark);
  border: 1px solid var(--rule-faint);
}
.chip.accent {
  background: var(--accent-tint);
  color: #92400E;
  border-color: rgba(245, 158, 11, 0.35);
}
.chip.muted {
  background: rgba(107, 114, 128, 0.08);
  color: var(--text-muted);
  border-color: rgba(107, 114, 128, 0.18);
}
.chip.success {
  background: rgba(52, 178, 123, 0.08);
  color: #1B6E47;
  border-color: rgba(52, 178, 123, 0.3);
}

/* ── Footer ───────────────────────────────────────────────────────────────── */

.foot {
  border-top: 1px solid var(--line);
  margin-top: 64px;
  padding: 32px 20px 48px;
  text-align: center;
  color: var(--text-muted);
  font-size: 0.85rem;
}
.foot a { color: var(--text-muted); margin: 0 8px; }
.foot a:hover { color: var(--primary); }

/* ── Loading spinner ──────────────────────────────────────────────────────── */

.spinner {
  width: 22px;
  height: 22px;
  border: 2px solid var(--rule-faint);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  display: inline-block;
  vertical-align: middle;
}
@keyframes spin { to { transform: rotate(360deg); } }

.boot-loader {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg);
  z-index: 1000;
}

/* ── Modal / bottom sheet ────────────────────────────────────────────────── */

.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.5);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 100;
  padding: 16px;
}
.modal-backdrop.open { display: flex; }
.modal {
  background: var(--paper);
  border-radius: var(--radius-lg);
  max-width: 460px;
  width: 100%;
  padding: 24px;
  position: relative;
  max-height: 85vh;
  overflow-y: auto;
}
.modal .close {
  position: absolute;
  top: 14px;
  right: 14px;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: transparent;
  border: none;
  font-size: 1.3rem;
  color: var(--text-muted);
  cursor: pointer;
}
.modal .close:hover { background: var(--primary-tint); color: var(--primary); }
.modal h3 {
  font-family: 'Fredoka', sans-serif;
  font-size: 1.2rem;
  font-weight: 600;
  margin-bottom: 6px;
  color: var(--primary);
}
.modal p.subtitle {
  color: var(--text-muted);
  font-size: 0.9rem;
  margin-bottom: 18px;
}

@media (max-width: 480px) {
  .modal {
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
    align-self: flex-end;
    max-height: 90vh;
  }
  .modal-backdrop { align-items: flex-end; padding: 0; }
}

/* ── In-page confirm (appConfirm) ─────────────────────────────────────────── */

.app-confirm-actions {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  margin-top: 18px;
}

@media (max-width: 480px) {
  .app-confirm-actions {
    flex-direction: column-reverse;
  }
  .app-confirm-actions .btn { width: 100%; }
}

/* ── Toasts (appToast) ────────────────────────────────────────────────────── */

.toast-stack {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 200;
  display: flex;
  flex-direction: column;
  gap: 10px;
  width: 100%;
  max-width: 480px;
  padding: 0 16px;
  pointer-events: none;
}
.toast {
  background: var(--text);
  color: white;
  padding: 12px 18px;
  border-radius: var(--radius);
  font-family: 'DM Sans', sans-serif;
  font-size: 0.92rem;
  line-height: 1.4;
  opacity: 0;
  transform: translateY(20px);
  transition: opacity 0.22s ease, transform 0.22s ease;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.18);
  pointer-events: auto;
  text-align: center;
}
.toast.show {
  opacity: 1;
  transform: translateY(0);
}
.toast-success { background: #1B6E47; }
.toast-error   { background: var(--danger); }
.toast-info    { background: var(--primary-dark); }

/* ── Utilities ────────────────────────────────────────────────────────────── */

.muted { color: var(--text-muted); }
.faint { color: var(--text-faint); }
.center { text-align: center; }
.mt-2 { margin-top: 8px; }
.mt-3 { margin-top: 12px; }
.mt-4 { margin-top: 16px; }
.mt-5 { margin-top: 20px; }
.mt-6 { margin-top: 24px; }
.mb-2 { margin-bottom: 8px; }
.mb-3 { margin-bottom: 12px; }
.mb-4 { margin-bottom: 16px; }
.mb-5 { margin-bottom: 20px; }
.mb-6 { margin-bottom: 24px; }

.hidden { display: none !important; }
.row { display: flex; align-items: center; gap: 8px; }
.row.wrap { flex-wrap: wrap; }
.row.between { justify-content: space-between; }
.row.center { justify-content: center; }
.col { display: flex; flex-direction: column; gap: 12px; }
.grow { flex: 1; }
