/* ============================================================================
   PANINI 26 — Estilos
   Diseño inspirado en el álbum FIFA World Cup 2026:
   bloques de color saturados, arcos geométricos, cards blancas,
   tipografía display fuerte
   ============================================================================ */

:root {
  /* Colores base del álbum */
  --paper:        #F5F0E5;
  --paper-2:      #FFFFFF;
  --ink:          #0D1B2A;
  --ink-soft:     #4A5568;
  --line:         #1A1A1A;

  /* Paleta Panini 2026 */
  --blue:         #1F3A93;
  --blue-deep:    #0D1B2A;
  --red:          #E94B3C;
  --yellow:       #FFC107;
  --green:        #3FB950;
  --purple:       #6B2D8C;
  --orange:       #FF6B35;

  /* Estados */
  --tengo:        #2D8C5C;
  --falta:        #C72C24;
  --repe:         #B8860B;

  /* Perfiles de la familia */
  --p-vittorio:   #0F8A3D;
  --p-adriano:    #1F3A93;
  --p-nicolas:    #D62828;
  --p-isabel:     #6B2D8C;

  /* Buckets cambios */
  --bucket-family:   #2D8C5C;
  --bucket-priority: #C72C24;
  --bucket-gift:     #B8860B;
  --bucket-info:     #1F3A93;

  /* Safe areas iOS */
  --sat:          env(safe-area-inset-top, 0);
  --sab:          env(safe-area-inset-bottom, 0);
}

* { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }
*:focus-visible { outline: 2px solid var(--blue); outline-offset: 2px; }

html, body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  font-size: 16px;
  line-height: 1.4;
  color: var(--ink);
  background: var(--paper);
  -webkit-font-smoothing: antialiased;
  overscroll-behavior: none;
}

body {
  min-height: 100vh;
  min-height: 100dvh;
}

button { font: inherit; color: inherit; background: none; border: none; cursor: pointer; }
input { font: inherit; color: inherit; }

.ff-display { font-family: 'Archivo Black', sans-serif; letter-spacing: -0.01em; }
.ff-mono    { font-family: 'JetBrains Mono', monospace; }

/* ============================================================================
   APP CONTAINER
   ============================================================================ */
.app {
  max-width: 720px;
  margin: 0 auto;
  min-height: 100vh;
  min-height: 100dvh;
  background: var(--paper);
  position: relative;
  padding-bottom: calc(82px + var(--sab));
}

/* ============================================================================
   HEADER
   ============================================================================ */
.header {
  background: var(--blue-deep);
  color: var(--paper-2);
  padding: calc(var(--sat) + 14px) 16px 14px;
  position: sticky;
  top: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.header-info { flex: 1; min-width: 0; }

.header-title {
  font-family: 'Archivo Black', sans-serif;
  font-size: 18px;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  line-height: 1;
}

.header-sub {
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  opacity: 0.7;
  margin-top: 4px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.header-badge {
  display: inline-block;
  font-family: 'Archivo Black', sans-serif;
  font-size: 9px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  padding: 2px 6px;
  border-radius: 100px;
  background: rgba(255,255,255,0.15);
  color: var(--paper-2);
}

.header-badge-admin {
  background: #0F8A3D;
  color: var(--paper-2);
}

.header-badge-colector {
  background: var(--ink-soft);
  color: var(--paper-2);
}

.header-badge-asistente {
  background: var(--purple);
  color: var(--paper-2);
}

.header-actions { display: flex; gap: 8px; flex-shrink: 0; }

.header-btn {
  width: 38px;
  height: 38px;
  border: 1.5px solid rgba(255,255,255,0.3);
  background: transparent;
  color: var(--paper-2);
  border-radius: 10px;
  font-size: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.header-btn:active { background: rgba(255,255,255,0.1); }

/* ============================================================================
   SYNC DOT
   ============================================================================ */
.sync-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--green);
  display: inline-block;
  flex-shrink: 0;
}
.sync-dot[data-state="syncing"] { background: var(--yellow); animation: pulse 1s infinite; }
.sync-dot[data-state="error"]   { background: var(--red); }
.sync-dot[data-state="offline"] { background: var(--ink-soft); }
.sync-dot[data-state="preview"] { background: var(--yellow); }
@keyframes pulse { 50% { opacity: 0.4; } }

/* ============================================================================
   PROFILE SELECTOR
   ============================================================================ */
.profile-bar {
  background: var(--blue-deep);
  padding: 0 16px 14px;
  display: flex;
  gap: 8px;
  overflow-x: auto;
  scrollbar-width: none;
}
.profile-bar::-webkit-scrollbar { display: none; }

.profile-pill {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  border-radius: 100px;
  font-weight: 700;
  font-size: 14px;
  background: rgba(255,255,255,0.08);
  color: var(--paper-2);
  border: 2px solid transparent;
  min-height: 36px;
}
.profile-pill[data-active="true"] {
  background: var(--paper-2);
  color: var(--ink);
  border-color: var(--profile-color, var(--blue));
}
.profile-pill[data-readonly="true"] { opacity: 0.85; }
.profile-pill .dot {
  width: 12px; height: 12px;
  border-radius: 50%;
  background: var(--profile-color, var(--blue));
  flex-shrink: 0;
}
.profile-pill[data-active="true"] .dot {
  background: var(--profile-color, var(--blue));
}
.profile-pill .lock { font-size: 12px; opacity: 0.7; }
.profile-pct {
  font-family: 'JetBrains Mono', monospace;
  font-size: 10px;
  opacity: 0.8;
}

/* ============================================================================
   MAIN CONTENT
   ============================================================================ */
.main { padding: 16px; }

/* ============================================================================
   READ-ONLY BANNER
   ============================================================================ */
.readonly-banner {
  background: var(--paper-2);
  border: 2px dashed var(--ink-soft);
  border-radius: 14px;
  padding: 12px 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
  font-size: 14px;
  font-weight: 500;
}
.readonly-hint {
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--ink-soft);
  flex-shrink: 0;
}

/* ============================================================================
   QUICK ADD
   ============================================================================ */
.quick-add {
  background: var(--paper-2);
  border: 2px solid var(--ink);
  border-radius: 16px;
  padding: 14px;
  margin-bottom: 16px;
  position: relative;
  overflow: hidden;
}
.quick-add::before {
  content: '';
  position: absolute;
  top: -40px; right: -40px;
  width: 100px; height: 100px;
  border-radius: 50%;
  background: var(--yellow);
  opacity: 0.3;
}
.quick-add-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 10px;
  position: relative;
  z-index: 1;
}
.quick-add-label { font-family: 'Archivo Black', sans-serif; font-size: 14px; text-transform: uppercase; letter-spacing: 0.05em; }
.quick-add-counter { font-family: 'JetBrains Mono', monospace; font-size: 12px; color: var(--ink-soft); }
.quick-add-row { display: flex; gap: 8px; position: relative; z-index: 1; }
.quick-add-input {
  flex: 1;
  font-family: 'JetBrains Mono', monospace;
  font-size: 16px;
  font-weight: 700;
  padding: 12px 14px;
  border: 2px solid var(--ink);
  border-radius: 12px;
  background: var(--paper);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  min-height: 50px;
  -webkit-appearance: none;
  appearance: none;
}
.quick-add-input:focus { outline: none; border-color: var(--blue); background: var(--paper-2); }
.quick-add-btn {
  padding: 0 22px;
  background: var(--green);
  color: var(--paper-2);
  border-radius: 12px;
  font-family: 'Archivo Black', sans-serif;
  font-size: 18px;
  min-height: 50px;
  min-width: 60px;
}
.quick-add-btn:active { transform: scale(0.95); }
.quick-add-hint {
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  color: var(--ink-soft);
  margin-top: 8px;
  position: relative; z-index: 1;
}
.quick-add-preview {
  margin-top: 8px;
  padding: 8px 12px;
  background: var(--green);
  color: var(--paper-2);
  border-radius: 10px;
  font-size: 13px;
  font-weight: 600;
  display: none;
  position: relative; z-index: 1;
}
.quick-add-preview[data-visible="true"] { display: block; }

/* ============================================================================
   SECTIONS
   ============================================================================ */
.section { margin-bottom: 24px; }
.section-header {
  display: flex; align-items: baseline; gap: 12px;
  margin-bottom: 10px;
}
.section-title {
  font-family: 'Archivo Black', sans-serif;
  font-size: 20px;
  text-transform: uppercase;
}
.section-line { flex: 1; height: 2px; background: var(--ink); }
.section-meta { font-family: 'JetBrains Mono', monospace; font-size: 11px; color: var(--ink-soft); }

/* ============================================================================
   PROGRESS BIG
   ============================================================================ */
.progress-card {
  background: var(--paper-2);
  border: 2px solid var(--ink);
  border-radius: 16px;
  padding: 16px;
  margin-bottom: 16px;
  position: relative;
  overflow: hidden;
}
.progress-card::before {
  content: '';
  position: absolute; top: -60px; left: -60px;
  width: 140px; height: 140px;
  border-radius: 50%;
  background: var(--profile-color, var(--blue));
  opacity: 0.12;
}
.progress-row { display: flex; justify-content: space-between; align-items: flex-end; margin-bottom: 12px; position: relative; z-index: 1; }
.progress-label { font-family: 'Archivo Black', sans-serif; font-size: 18px; text-transform: uppercase; }
.progress-pct { font-family: 'Archivo Black', sans-serif; font-size: 36px; color: var(--profile-color, var(--blue)); line-height: 1; }
.progress-bar {
  height: 12px;
  background: var(--paper);
  border-radius: 100px;
  border: 2px solid var(--ink);
  overflow: hidden;
  position: relative; z-index: 1;
}
.progress-bar-fill {
  height: 100%;
  background: var(--profile-color, var(--blue));
  border-radius: 100px;
  transition: width 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}
.progress-meta { font-family: 'JetBrains Mono', monospace; font-size: 11px; color: var(--ink-soft); margin-top: 8px; position: relative; z-index: 1; }

/* ============================================================================
   EXTRA CARDS (FWC / COCA-COLA)
   ============================================================================ */
.extra-card {
  background: var(--paper-2);
  border: 2px solid var(--ink);
  border-radius: 14px;
  padding: 12px 14px;
  margin-bottom: 12px;
  cursor: pointer;
  transition: transform 0.1s;
}
.extra-card:active { transform: scale(0.98); }
.extra-card-coca { border-color: var(--red); }

.extra-card-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 8px;
}
.extra-name { font-family: 'Archivo Black', sans-serif; font-size: 14px; }
.extra-info { font-family: 'JetBrains Mono', monospace; font-size: 10px; color: var(--ink-soft); }

.extra-row {
  display: flex;
  align-items: center;
  gap: 10px;
}
.extra-progress { font-family: 'JetBrains Mono', monospace; font-size: 13px; font-weight: 700; flex-shrink: 0; }
.extra-bar {
  flex: 1;
  height: 8px;
  background: var(--paper);
  border-radius: 100px;
  overflow: hidden;
}
.extra-bar-fill {
  height: 100%;
  border-radius: 100px;
  transition: width 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}
.extra-pct {
  font-family: 'JetBrains Mono', monospace;
  font-size: 12px;
  font-weight: 700;
  text-align: right;
  flex-shrink: 0;
  min-width: 44px;
}

/* ============================================================================
   GROUP / TEAMS GRID
   ============================================================================ */
.group-card {
  margin-bottom: 16px;
  border-radius: 18px;
  overflow: hidden;
  border: 2px solid var(--ink);
  position: relative;
}
.group-header {
  background: var(--group-color, var(--blue));
  color: white;
  padding: 12px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.group-name { font-family: 'Archivo Black', sans-serif; font-size: 18px; }
.group-pages { font-family: 'JetBrains Mono', monospace; font-size: 11px; opacity: 0.85; }
.group-teams {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1px;
  background: var(--ink);
}

.team-card {
  background: var(--paper-2);
  padding: 12px;
  text-align: left;
  display: flex;
  flex-direction: column;
  gap: 6px;
  position: relative;
  overflow: hidden;
  min-height: 88px;
}
.team-card[data-complete="true"] { background: #E5F5EA; }
.team-card:active { background: var(--paper); }
.team-card-row { display: flex; align-items: center; justify-content: space-between; }
.team-flag { font-size: 22px; line-height: 1; }
.team-code { font-family: 'Archivo Black', sans-serif; font-size: 18px; }
.team-name { font-size: 12px; color: var(--ink-soft); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.team-progress {
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  font-weight: 700;
}
.team-bar { height: 4px; background: var(--paper); border-radius: 100px; overflow: hidden; }
.team-bar-fill { height: 100%; background: var(--ink); border-radius: 100px; }
.team-card[data-complete="true"] .team-bar-fill { background: var(--tengo); }
.team-page {
  font-family: 'JetBrains Mono', monospace;
  font-size: 10px;
  color: var(--ink-soft);
  background: var(--paper);
  padding: 2px 6px;
  border-radius: 6px;
  display: inline-block;
}

/* ============================================================================
   TEAM DETAIL VIEW
   ============================================================================ */
.team-detail-header {
  background: var(--group-color, var(--blue));
  color: white;
  margin: -16px -16px 16px;
  padding: 16px;
  position: relative;
  overflow: hidden;
}
.team-detail-header::before {
  content: '';
  position: absolute; top: -50%; right: -20%;
  width: 200px; height: 200px;
  border-radius: 50%;
  background: rgba(255,255,255,0.1);
}
.back-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  font-weight: 700;
  padding: 8px 14px;
  margin-bottom: 12px;
  position: relative;
  z-index: 1;
  color: white;
  background: rgba(255, 255, 255, 0.18);
  border: 1.5px solid rgba(255, 255, 255, 0.4);
  border-radius: 100px;
  transition: background 0.15s, transform 0.1s;
}
.back-btn:hover { background: rgba(255, 255, 255, 0.28); }
.back-btn:active { transform: scale(0.96); }
.team-detail-row { display: flex; justify-content: space-between; align-items: flex-end; position: relative; z-index: 1; }
.team-detail-conf { font-family: 'JetBrains Mono', monospace; font-size: 11px; opacity: 0.85; }
.team-detail-code { font-family: 'Archivo Black', sans-serif; font-size: 36px; line-height: 1; }
.team-detail-name { font-size: 14px; opacity: 0.9; margin-top: 2px; }
.team-detail-stats { text-align: right; }
.team-detail-pct { font-family: 'Archivo Black', sans-serif; font-size: 28px; }
.team-detail-page { font-family: 'JetBrains Mono', monospace; font-size: 12px; opacity: 0.85; margin-top: 2px; }

/* ============================================================================
   STICKER TILES
   ============================================================================ */
.stickers-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
}
.sticker-tile {
  background: var(--paper-2);
  border: 2px solid var(--ink);
  border-radius: 12px;
  padding: 10px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  position: relative;
  min-height: 110px;
}
.sticker-tile[data-state="have"] { background: #E5F5EA; }
.sticker-tile[data-state="repe"] { background: #FFF4D6; border-color: var(--repe); }
.sticker-row { display: flex; justify-content: space-between; align-items: center; }
.sticker-num { font-family: 'Archivo Black', sans-serif; font-size: 26px; line-height: 1; }
.sticker-code { font-family: 'JetBrains Mono', monospace; font-size: 10px; color: var(--ink-soft); text-transform: uppercase; }
.sticker-player { font-size: 12px; font-weight: 600; line-height: 1.2; min-height: 2.4em; }
.sticker-controls { display: flex; align-items: center; justify-content: space-between; gap: 4px; margin-top: auto; }
.sticker-controls-readonly {
  justify-content: center;
  background: var(--paper);
  padding: 6px;
  border-radius: 8px;
}
.sticker-btn {
  width: 36px; height: 36px;
  border: 2px solid var(--ink);
  border-radius: 8px;
  font-family: 'Archivo Black', sans-serif;
  font-size: 18px;
  background: var(--paper-2);
  display: flex; align-items: center; justify-content: center;
}
.sticker-btn[data-action="add"] { background: var(--ink); color: var(--paper-2); }
.sticker-btn:disabled { opacity: 0.3; }
.sticker-btn:active:not(:disabled) { transform: scale(0.92); }
.sticker-count { font-family: 'JetBrains Mono', monospace; font-size: 13px; font-weight: 700; min-width: 30px; text-align: center; }
.sticker-repe-tag {
  position: absolute;
  top: 6px; right: 6px;
  background: var(--repe);
  color: var(--paper-2);
  font-family: 'JetBrains Mono', monospace;
  font-size: 10px;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 6px;
}

/* ============================================================================
   FALTANTES — VISTA COMPACTA
   ============================================================================ */
.view-toggle {
  display: flex;
  flex-direction: row;
  gap: 6px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}
.toggle-btn {
  padding: 6px 14px;
  border: 2px solid var(--ink);
  border-radius: 100px;
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  background: transparent;
}
.toggle-btn[data-active="true"] { background: var(--ink); color: var(--paper-2); }
.toggle-btn.copy-btn {
  background: var(--tengo);
  color: var(--paper-2);
  border-color: var(--tengo);
  margin-left: auto;
}
.toggle-btn.copy-btn:active { opacity: 0.8; }

.faltantes-compact {
  background: var(--paper-2);
  border: 2px solid var(--ink);
  border-radius: 14px;
  padding: 8px;
}
.faltantes-row {
  padding: 10px 8px;
  border-bottom: 1px solid var(--paper);
}
.faltantes-row:last-child { border-bottom: none; }
.faltantes-team {
  display: flex;
  align-items: baseline;
  gap: 8px;
  margin-bottom: 6px;
}
.faltantes-flag { font-size: 18px; }
.faltantes-code { font-family: 'Archivo Black', sans-serif; font-size: 16px; }
.faltantes-count { font-family: 'JetBrains Mono', monospace; font-size: 11px; color: var(--ink-soft); }
.faltantes-nums {
  font-family: 'JetBrains Mono', monospace;
  font-size: 14px;
  font-weight: 700;
  color: var(--falta);
  letter-spacing: 0.02em;
  word-spacing: 2px;
}

/* ============================================================================
   FALTANTES — VISTA DETALLADA
   ============================================================================ */
.list-team-card {
  background: var(--paper-2);
  border: 2px solid var(--ink);
  border-radius: 14px;
  padding: 12px;
  margin-bottom: 10px;
}
.list-team-row {
  display: flex; justify-content: space-between; align-items: baseline;
  margin-bottom: 8px;
}
.list-team-name { font-family: 'Archivo Black', sans-serif; font-size: 18px; }
.list-team-page { font-family: 'JetBrains Mono', monospace; font-size: 11px; color: var(--ink-soft); }

/* ============================================================================
   CHIPS
   ============================================================================ */
.chip-row { display: flex; flex-wrap: wrap; gap: 6px; }
.chip {
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  padding: 4px 8px;
  border-radius: 8px;
  border: 1px solid var(--ink);
  font-weight: 700;
}
.chip[data-type="falta"] { background: #FCE6E4; color: var(--falta); border-color: var(--falta); }
.chip[data-type="repe"]  { background: #FFF4D6; color: var(--repe); border-color: var(--repe); }
.chip[data-type="have"]  { background: #E5F5EA; color: var(--tengo); border-color: var(--tengo); }
.chip-needers { opacity: 0.7; font-weight: 500; }

/* ============================================================================
   TRADE BUCKETS
   ============================================================================ */
.bucket {
  background: var(--paper-2);
  border: 2px solid var(--ink);
  border-radius: 16px;
  padding: 14px;
  margin-bottom: 14px;
}
.bucket-family   { border-color: var(--bucket-family); }
.bucket-priority { border-color: var(--bucket-priority); }
.bucket-gift     { border-color: var(--bucket-gift); }
.bucket-info     { border-color: var(--bucket-info); }
.bucket-incoming { border-color: var(--blue); }

.bucket-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 4px;
}
.bucket-title {
  font-family: 'Archivo Black', sans-serif;
  font-size: 14px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.bucket-count {
  font-family: 'JetBrains Mono', monospace;
  font-size: 13px;
  font-weight: 700;
  background: var(--ink);
  color: var(--paper-2);
  padding: 2px 8px;
  border-radius: 100px;
}
.bucket-hint {
  font-size: 12px;
  color: var(--ink-soft);
  margin-bottom: 10px;
  line-height: 1.4;
}

.copy-gift-btn {
  display: block;
  width: 100%;
  margin-top: 10px;
  padding: 8px 16px;
  background: var(--bucket-gift);
  color: var(--paper-2);
  border-radius: 100px;
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  text-align: center;
}
.copy-gift-btn:active { opacity: 0.85; }

.incoming-from {
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px solid var(--paper);
}
.incoming-from:first-of-type { border-top: none; padding-top: 0; margin-top: 0; }
.incoming-name {
  display: block;
  font-family: 'Archivo Black', sans-serif;
  font-size: 13px;
  text-transform: uppercase;
  margin-bottom: 6px;
}

/* ============================================================================
   MATCH CARD (vista Isabel)
   ============================================================================ */
.match-card {
  background: var(--paper);
  border: 1px solid var(--ink);
  border-radius: 12px;
  padding: 10px 12px;
  margin-top: 10px;
}
.match-card-info { background: #F0F4FA; }

.match-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 8px;
}
.match-title { font-family: 'Archivo Black', sans-serif; font-size: 13px; }
.match-counts { font-family: 'JetBrains Mono', monospace; font-size: 11px; color: var(--ink-soft); }

.match-row {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
}
.match-side {}
.match-side-title {
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  font-weight: 700;
  color: var(--ink-soft);
  text-transform: uppercase;
  margin-bottom: 4px;
}
.match-empty { font-family: 'JetBrains Mono', monospace; font-size: 11px; color: var(--ink-soft); }
.match-info-tag {
  margin-top: 8px;
  padding: 6px 10px;
  background: var(--bucket-info);
  color: var(--paper-2);
  border-radius: 6px;
  font-size: 11px;
  font-weight: 600;
}

/* ============================================================================
   STATS
   ============================================================================ */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-bottom: 14px;
}
.stat-box {
  background: var(--paper-2);
  border: 2px solid var(--ink);
  border-radius: 12px;
  padding: 12px 8px;
  text-align: center;
}
.stat-value { font-family: 'Archivo Black', sans-serif; font-size: 28px; line-height: 1; }
.stat-label { font-family: 'JetBrains Mono', monospace; font-size: 10px; text-transform: uppercase; color: var(--ink-soft); margin-top: 4px; }

.ranking-row {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid var(--paper);
}
.ranking-row:last-child { border-bottom: none; }
.ranking-pos { font-family: 'Archivo Black', sans-serif; font-size: 24px; width: 28px; flex-shrink: 0; }
.ranking-pos[data-pos="1"] { color: var(--yellow); }
.ranking-pos[data-pos="2"] { color: var(--ink-soft); }
.ranking-pos[data-pos="3"] { color: var(--orange); }
.ranking-info { flex: 1; min-width: 0; }
.ranking-name { font-weight: 700; font-size: 14px; display: flex; align-items: center; gap: 6px; }
.ranking-name .dot { width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0; }
.ranking-bar { height: 6px; background: var(--paper); border-radius: 100px; overflow: hidden; margin-top: 4px; }
.ranking-bar-fill { height: 100%; border-radius: 100px; }
.ranking-pct { font-family: 'Archivo Black', sans-serif; font-size: 14px; flex-shrink: 0; }

/* ============================================================================
   NAV
   ============================================================================ */
.nav {
  position: fixed;
  bottom: 0;
  left: 0; right: 0;
  background: var(--blue-deep);
  border-top: 3px solid var(--ink);
  display: flex;
  z-index: 30;
  padding-bottom: var(--sab);
  max-width: 720px;
  margin: 0 auto;
}
.nav-btn {
  flex: 1;
  padding: 10px 4px;
  display: flex; flex-direction: column; align-items: center; gap: 4px;
  color: var(--paper-2);
  opacity: 0.6;
  min-height: 60px;
}
.nav-btn[data-active="true"] { opacity: 1; background: var(--profile-color, var(--blue)); }
.nav-icon { font-size: 22px; line-height: 1; }
.nav-label { font-family: 'Archivo Black', sans-serif; font-size: 10px; letter-spacing: 0.05em; text-transform: uppercase; }

/* ============================================================================
   TOAST
   ============================================================================ */
.toast {
  position: fixed;
  bottom: calc(80px + var(--sab) + 16px);
  left: 50%;
  transform: translateX(-50%);
  background: var(--ink);
  color: var(--paper-2);
  padding: 10px 16px;
  border-radius: 100px;
  font-size: 14px;
  font-weight: 600;
  z-index: 50;
  box-shadow: 0 6px 20px rgba(0,0,0,0.25);
  max-width: calc(100vw - 32px);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  animation: toastIn 0.2s ease-out;
}
.toast[data-kind="ok"]   { background: var(--tengo); }
.toast[data-kind="err"]  { background: var(--falta); }
.toast[data-kind="info"] { background: var(--blue); }
@keyframes toastIn {
  from { opacity: 0; transform: translate(-50%, 20px); }
  to   { opacity: 1; transform: translate(-50%, 0); }
}

/* ============================================================================
   ONBOARDING
   ============================================================================ */
.onboarding {
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: calc(var(--sat) + 20px) 20px calc(var(--sab) + 20px);
  background: var(--blue-deep);
  color: var(--paper-2);
}
.onboarding-card {
  width: 100%;
  max-width: 420px;
  background: var(--paper-2);
  color: var(--ink);
  border-radius: 24px;
  padding: 28px 22px;
  border: 3px solid var(--ink);
  position: relative;
  overflow: hidden;
}
.onboarding-card::before {
  content: '';
  position: absolute;
  top: -80px; right: -80px;
  width: 200px; height: 200px;
  border-radius: 50%;
  background: var(--yellow);
  opacity: 0.4;
}
.onboarding-card::after {
  content: '';
  position: absolute;
  bottom: -60px; left: -60px;
  width: 150px; height: 150px;
  border-radius: 50%;
  background: var(--red);
  opacity: 0.3;
}
.onboarding-content { position: relative; z-index: 1; }
.onboarding-title {
  font-family: 'Archivo Black', sans-serif;
  font-size: 36px;
  text-align: center;
  margin-bottom: 4px;
  line-height: 1;
}
.onboarding-title-sm {
  font-family: 'Archivo Black', sans-serif;
  font-size: 22px;
  text-align: center;
  margin-bottom: 4px;
  line-height: 1.15;
}
.onboarding-subtitle {
  font-size: 13px;
  text-align: center;
  margin-bottom: 22px;
  color: var(--ink-soft);
}

.field { margin-bottom: 14px; }
.field-label {
  font-family: 'Archivo Black', sans-serif;
  font-size: 13px;
  text-transform: uppercase;
  margin-bottom: 4px;
  display: block;
}
.field-hint {
  font-size: 11px;
  color: var(--ink-soft);
  margin-bottom: 6px;
}
.field-input {
  width: 100%;
  padding: 12px 14px;
  border: 2px solid var(--ink);
  border-radius: 12px;
  font-size: 16px;
  font-weight: 600;
  background: var(--paper);
  -webkit-appearance: none;
}
.field-input:focus { outline: none; border-color: var(--blue); }
.field-input.uppercase { text-transform: uppercase; letter-spacing: 0.05em; font-family: 'JetBrains Mono', monospace; }

.profile-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: 14px;
}
.profile-choice {
  border: 2px solid var(--ink);
  border-radius: 12px;
  padding: 12px;
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  background: var(--paper-2);
  text-align: left;
}
.profile-choice[data-selected="true"] {
  background: var(--profile-bg);
  color: var(--paper-2);
}
.profile-choice .dot { width: 14px; height: 14px; border-radius: 50%; flex-shrink: 0; }
.profile-choice .micro-tag { font-size: 10px; opacity: 0.6; font-weight: 400; }

.micro-tag {
  font-size: 10px;
  opacity: 0.7;
  font-weight: 400;
  margin-left: 4px;
}

/* ============================================================================
   BUTTONS
   ============================================================================ */
.btn-primary {
  width: 100%;
  padding: 14px;
  background: var(--ink);
  color: var(--paper-2);
  border-radius: 14px;
  font-family: 'Archivo Black', sans-serif;
  font-size: 18px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.btn-primary:disabled { opacity: 0.4; }
.btn-primary:active:not(:disabled) { transform: scale(0.98); }
.btn-secondary {
  width: 100%;
  padding: 11px;
  background: transparent;
  color: var(--ink-soft);
  border: 2px solid var(--ink-soft);
  border-radius: 14px;
  font-family: 'Archivo Black', sans-serif;
  font-size: 14px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-top: 8px;
}
.btn-secondary:active { opacity: 0.7; }
.btn-tertiary {
  background: transparent;
  color: var(--ink-soft);
  border-color: var(--ink-soft);
  border-width: 1px;
  font-size: 13px;
  font-weight: 500;
  opacity: 0.85;
}
.btn-tertiary:hover { opacity: 1; }

/* ============================================================================
   STICKER NAME EDITOR (solo Vittorio)
   ============================================================================ */
.sticker-player.editable {
  cursor: pointer;
  border-bottom: 1px dashed var(--ink-soft);
  padding-bottom: 1px;
}
.sticker-player.editable:hover {
  background: rgba(255, 193, 7, 0.2);
  border-bottom-color: var(--ink);
}
.sticker-player.editable::after {
  content: ' ✎';
  font-size: 10px;
  opacity: 0.5;
  margin-left: 2px;
}

/* ============================================================================
   EMPTY STATES
   ============================================================================ */
.empty {
  background: var(--paper-2);
  border: 2px dashed var(--ink-soft);
  border-radius: 16px;
  padding: 32px 20px;
  text-align: center;
}
.empty-title { font-family: 'Archivo Black', sans-serif; font-size: 18px; margin-bottom: 6px; }
.empty-text { font-size: 13px; color: var(--ink-soft); }

/* ============================================================================
   RESPONSIVE — 600px
   ============================================================================ */
@media (min-width: 600px) {
  .group-teams { grid-template-columns: repeat(2, 1fr); }
  .match-row { grid-template-columns: 1fr 1fr; gap: 12px; }
}

/* ============================================================================
   PIN ENTRY REDISEÑADO
   ============================================================================ */
.btn-pin-enter { margin-top: 8px; margin-bottom: 4px; }

.field-input-pin {
  font-family: 'JetBrains Mono', monospace;
  font-size: 28px;
  text-align: center;
  letter-spacing: 12px;
  font-weight: 700;
  padding: 16px 14px;
}

.pin-divider {
  display: flex; align-items: center; gap: 10px;
  margin: 16px 0;
  color: var(--ink-soft); font-size: 12px;
  text-transform: uppercase; letter-spacing: 0.1em;
}
.pin-divider::before, .pin-divider::after {
  content: ''; flex: 1; height: 1px;
  background: var(--ink-soft); opacity: 0.3;
}

.btn-link {
  width: 100%; background: transparent; border: none;
  color: var(--ink-soft); font-size: 13px; font-weight: 500;
  padding: 8px 0; margin-top: 4px;
  text-decoration: underline; text-underline-offset: 2px;
  text-decoration-color: var(--ink-soft); cursor: pointer;
}
.btn-link:hover { color: var(--ink); }

.forget-device-link {
  display: block;
  margin: 24px auto 0;
  background: transparent;
  border: none;
  color: rgba(255, 255, 255, 0.45);
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 2px;
  padding: 8px 16px;
  text-align: center;
}
.forget-device-link:hover {
  color: rgba(255, 255, 255, 0.75);
}

.member-edit {
  background: var(--paper); border-radius: 12px;
  padding: 12px; margin-bottom: 10px;
  border: 1px solid var(--ink-soft);
}

/* ============================================================================
   PROFILE CHOICE — con descripción de rol
   ============================================================================ */

.profile-choice {
  align-items: flex-start;
  padding: 14px 12px;
}

.profile-choice-info {
  flex: 1;
  text-align: left;
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.profile-choice-name {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 700;
  font-size: 15px;
}

.role-badge {
  font-family: 'JetBrains Mono', monospace;
  font-size: 9px;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 4px;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.role-badge-admin     { background: #0F8A3D; color: white; }
.role-badge-colector  { background: var(--ink-soft); color: white; }
.role-badge-asistente { background: #6B2D8C; color: white; }

.profile-choice-desc {
  font-size: 11px;
  color: var(--ink-soft);
  line-height: 1.3;
  font-weight: 400;
  margin-top: 2px;
}

.profile-choice-warn {
  font-size: 10px;
  color: var(--falta);
  font-weight: 600;
  margin-top: 4px;
  font-family: 'JetBrains Mono', monospace;
}

.profile-choice[data-selected="true"] .profile-choice-desc,
.profile-choice[data-selected="true"] .profile-choice-warn {
  color: rgba(255, 255, 255, 0.85);
}

/* ============================================================================
   RESPONSIVE — 1024px (desktop)
   ============================================================================ */
@media (min-width: 1024px) {
  .app { max-width: 1100px; }
  .nav { max-width: 1100px; }
  .group-teams { grid-template-columns: repeat(4, 1fr); }
  .stickers-grid { grid-template-columns: repeat(4, 1fr); }
  .stat-grid { grid-template-columns: repeat(3, 1fr); }
  .match-row { grid-template-columns: 1fr 1fr; gap: 16px; }
  .header-title { font-size: 22px; }
  .progress-pct { font-size: 40px; }
  .main { padding: 24px; }
}
