/* Álbum Mundial 2026 — tracker */
:root {
  --page: #f9f9f7;
  --surface: #fcfcfb;
  --ink: #0b0b0b;
  --ink-2: #52514e;
  --muted: #898781;
  --hairline: #e1e0d9;
  --border: rgba(11, 11, 11, 0.10);
  --accent: #2a78d6;
  --accent-track: #cde2fb;
  --accent-ink: #ffffff;
  --good: #0ca30c;
  --shadow: 0 1px 3px rgba(11, 11, 11, 0.06);
}
:root[data-theme="dark"] {
  --page: #0d0d0d;
  --surface: #1a1a19;
  --ink: #ffffff;
  --ink-2: #c3c2b7;
  --muted: #898781;
  --hairline: #2c2c2a;
  --border: rgba(255, 255, 255, 0.10);
  --accent: #3987e5;
  --accent-track: #0d366b;
  --accent-ink: #ffffff;
  --good: #0ca30c;
  --shadow: none;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --page: #0d0d0d;
    --surface: #1a1a19;
    --ink: #ffffff;
    --ink-2: #c3c2b7;
    --muted: #898781;
    --hairline: #2c2c2a;
    --border: rgba(255, 255, 255, 0.10);
    --accent: #3987e5;
    --accent-track: #0d366b;
    --accent-ink: #ffffff;
    --shadow: none;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--page);
  color: var(--ink);
  font-family: system-ui, -apple-system, "Segoe UI", sans-serif;
  line-height: 1.45;
}
main { max-width: 980px; margin: 0 auto; padding: 16px 12px 80px; }

/* ---------- Cabecera / héroe ---------- */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 12px;
}
.topbar h1 { font-size: 1.15rem; margin: 0; font-weight: 700; }
.topbar h1 .sub { color: var(--muted); font-weight: 500; font-size: 0.85rem; display: block; }
.iconbtn {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 8px 10px;
  font-size: 1rem;
  cursor: pointer;
  color: var(--ink);
}

.hero {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 20px;
  box-shadow: var(--shadow);
  margin-bottom: 12px;
}
.hero-number {
  font-size: 52px;
  font-weight: 650;
  line-height: 1.1;
}
.hero-label { color: var(--ink-2); font-size: 0.9rem; margin-bottom: 12px; }
.meter {
  height: 10px;
  border-radius: 5px;
  background: var(--accent-track);
  overflow: hidden;
  margin: 12px 0 16px;
}
.meter > div {
  height: 100%;
  background: var(--accent);
  border-radius: 5px 4px 4px 5px;
  transition: width 0.25s ease;
}
.tiles { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.tile {
  border: 1px solid var(--hairline);
  border-radius: 12px;
  padding: 10px 12px;
}
.tile .t-label { color: var(--muted); font-size: 0.78rem; }
.tile .t-value { font-size: 1.35rem; font-weight: 650; }

/* ---------- Controles ---------- */
.controls {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  margin-bottom: 16px;
}
.controls input[type="search"] {
  flex: 1 1 160px;
  min-width: 0;
  padding: 9px 12px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--ink);
  font-size: 0.95rem;
}
.chips { display: flex; gap: 6px; }
.chip {
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--ink-2);
  border-radius: 999px;
  padding: 8px 14px;
  font-size: 0.85rem;
  cursor: pointer;
}
.chip[aria-pressed="true"] {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-ink);
  font-weight: 600;
}

.hint { color: var(--muted); font-size: 0.8rem; margin: 0 0 16px; }

/* ---------- Secciones de equipo ---------- */
.team {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 14px;
  margin-bottom: 10px;
  box-shadow: var(--shadow);
}
.team-head {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
}
.team-flag { font-size: 1.5rem; line-height: 1; }
.team-flag img { display: block; width: 32px; height: 24px; border-radius: 3px; object-fit: cover; }
.team-name { font-weight: 650; }
.team-meta { color: var(--muted); font-size: 0.78rem; }
.team-count {
  margin-left: auto;
  color: var(--ink-2);
  font-size: 0.85rem;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.team-count.done { color: var(--good); font-weight: 650; }
.team-meter {
  height: 5px;
  border-radius: 3px;
  background: var(--accent-track);
  overflow: hidden;
  margin-bottom: 12px;
}
.team-meter > div { height: 100%; background: var(--accent); transition: width 0.25s ease; }

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(52px, 1fr));
  gap: 6px;
}
.cell {
  position: relative;
  border: 1px solid var(--hairline);
  background: transparent;
  color: var(--muted);
  border-radius: 10px;
  min-height: 44px;
  font: inherit;
  font-size: 0.82rem;
  font-variant-numeric: tabular-nums;
  cursor: pointer;
  user-select: none;
  -webkit-user-select: none;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
  display: flex;
  align-items: center;
  justify-content: center;
}
.cell.owned {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-ink);
  font-weight: 600;
}
.cell .badge {
  position: absolute;
  top: -6px;
  right: -4px;
  background: var(--ink);
  color: var(--page);
  border: 2px solid var(--surface);
  border-radius: 999px;
  font-size: 0.68rem;
  font-weight: 700;
  padding: 1px 5px;
  line-height: 1.3;
}
.cell.dimmed { opacity: 0.25; pointer-events: none; }

/* ---------- Exportar / respaldo ---------- */
.io {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 14px;
  margin-top: 20px;
}
.io h2 { font-size: 1rem; margin: 0 0 10px; }
.io .row { display: flex; flex-wrap: wrap; gap: 8px; }
.btn {
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--ink);
  border-radius: 10px;
  padding: 9px 14px;
  font-size: 0.88rem;
  cursor: pointer;
}
.btn:hover { border-color: var(--accent); }
.io textarea {
  width: 100%;
  min-height: 110px;
  margin-top: 10px;
  border-radius: 10px;
  border: 1px solid var(--hairline);
  background: var(--page);
  color: var(--ink-2);
  padding: 10px;
  font-family: ui-monospace, Consolas, monospace;
  font-size: 0.78rem;
}
.io .note { color: var(--muted); font-size: 0.78rem; margin-top: 8px; }

/* ---------- Sincronización y modo visita ---------- */
.sync-status {
  color: var(--muted);
  font-size: 0.78rem;
  white-space: nowrap;
}
.banner {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 10px 14px;
  margin-bottom: 12px;
  color: var(--ink-2);
  font-size: 0.88rem;
}
#sync-panel {
  border-top: 1px solid var(--hairline);
  margin-top: 14px;
  padding-top: 12px;
}
#sync-panel h2 { font-size: 0.95rem; margin: 0 0 6px; }
#sync-panel input {
  flex: 1 1 220px;
  min-width: 0;
  padding: 9px 12px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--page);
  color: var(--ink);
  font-size: 0.88rem;
}
body.readonly .owner-only { display: none; }
body.readonly .hint { display: none; }
body.readonly .cell { cursor: default; }

.toast {
  position: fixed;
  bottom: 18px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--ink);
  color: var(--page);
  border-radius: 999px;
  padding: 9px 18px;
  font-size: 0.85rem;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease;
}
.toast.show { opacity: 1; }

@media (max-width: 480px) {
  .hero-number { font-size: 44px; }
  .tiles { gap: 6px; }
  .tile { padding: 8px 10px; }
  .tile .t-value { font-size: 1.15rem; }
}
