/* =============================================================
   FAP — Futbol Aruba Predición
   Sistema visual "matchday": oscuro, denso, tipo retransmisión.
   ============================================================= */

/* =============================================================
   1. Tokens
   ============================================================= */
:root {
  color-scheme: dark;

  /* Superficies: verde pitch llevado casi a negro */
  --bg: #071411;
  --bg-2: #0a1c18;
  --surface: #0e2420;
  --surface-2: #143029;
  --surface-3: #1a3b33;

  --line: #1b3a33;
  --line-strong: #27544a;

  --text: #f0f7f4;
  --text-muted: #8fa89f;
  --text-dim: #5f7f76;

  --accent: #17d39f;
  --accent-strong: #0fb98a;
  --accent-ink: #04231c;

  --gold: #f2c14e;
  --silver: #c3ced6;
  --bronze: #cd8250;
  --danger: #ef4d55;
  --warn: #f0a63d;

  --sans: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
  --num: "Barlow Condensed", "Inter", system-ui, sans-serif;

  --radius-sm: 8px;
  --radius: 12px;
  --radius-lg: 16px;

  --shadow-lg: 0 18px 48px rgba(0, 0, 0, 0.6);

  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);

  --header-h: 56px;
  --row-h: 54px;
}

/* =============================================================
   2. Reset y base
   ============================================================= */
*, *::before, *::after { box-sizing: border-box; margin: 0; }
html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--header-h) + 12px);
}
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }

body {
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.55;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: clip;
  overscroll-behavior-y: none;
}

/* Resplandor verde en la parte alta, como la luz de un estadio */
body::before {
  content: "";
  position: fixed;
  inset: 0 0 auto 0;
  height: 420px;
  background: radial-gradient(90% 100% at 50% 0%, rgba(23, 211, 159, 0.10), transparent 70%);
  pointer-events: none;
  z-index: 0;
}

img, svg, video { display: block; max-width: 100%; }
img { height: auto; }
/* Necesario: varios elementos que ocultamos con [hidden] llevan display flex/grid */
[hidden] { display: none !important; }
button { font: inherit; color: inherit; cursor: pointer; border: 0; background: none; }
a { color: inherit; text-decoration: none; }
p { text-wrap: pretty; }
table { border-collapse: collapse; }

h1, h2, h3, h4 {
  font-weight: 800;
  line-height: 1.1;
  letter-spacing: -0.022em;
  text-wrap: balance;
}

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: 4px;
}

/* =============================================================
   3. Utilidades
   ============================================================= */
.container { width: 100%; max-width: 940px; margin-inline: auto; padding-inline: 1rem; }
@media (min-width: 640px) { .container { padding-inline: 1.5rem; } }

.visually-hidden {
  position: absolute !important; width: 1px; height: 1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap;
}

.skip-link {
  position: fixed; top: -100px; left: 1rem; z-index: 9999;
  padding: .6rem 1rem; background: var(--accent); color: var(--accent-ink);
  border-radius: 8px; font-weight: 700;
  transition: top .2s var(--ease-out);
}
.skip-link:focus { top: 1rem; }

.icon { width: 1.1em; height: 1.1em; flex: none; }

/* Micro-titulares en versalitas condensadas: el tono "cuadro de datos" */
.overline {
  font-family: var(--num);
  font-size: .82rem;
  font-weight: 600;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--text-dim);
}

main { position: relative; z-index: 1; }

/* =============================================================
   4. Tipografía
   ============================================================= */
h1 { font-size: clamp(1.65rem, 5.2vw, 2.4rem); }
h2 { font-size: clamp(1.3rem, 3.4vw, 1.75rem); }
h3 { font-size: 1.05rem; }

.section-head { margin-bottom: 1rem; }
.section-head h2 { margin-top: .25rem; }
.section-sub { color: var(--text-muted); max-width: 62ch; font-size: .95rem; margin-top: .45rem; }

/* =============================================================
   5. Botones
   ============================================================= */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .5rem;
  padding: .8rem 1.25rem;
  border-radius: 10px;
  font-weight: 700;
  font-size: .95rem;
  letter-spacing: -.01em;
  transition: background .16s var(--ease-out), border-color .16s var(--ease-out),
              color .16s var(--ease-out), transform .12s var(--ease-out);
}
.btn:active { transform: translateY(1px); }

.btn-primary { background: var(--accent); color: var(--accent-ink); }
.btn-primary:hover { background: var(--accent-strong); }

.btn-secondary {
  background: var(--surface-2);
  color: var(--text);
  border: 1px solid var(--line-strong);
}
.btn-secondary:hover { background: var(--surface-3); border-color: var(--accent); }

.btn-ghost {
  background: transparent; color: var(--text-muted);
  border: 1px solid var(--line);
  padding: .45rem .8rem; font-size: .82rem; border-radius: 8px;
}
.btn-ghost:hover { color: var(--text); border-color: var(--line-strong); }

/* =============================================================
   6. Cabecera
   ============================================================= */
.site-header {
  position: sticky; top: 0; z-index: 40;
  background: rgba(7, 20, 17, 0.82);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
}
.header-inner {
  display: flex; align-items: center; gap: .75rem;
  min-height: var(--header-h);
}

.logo { display: flex; align-items: center; gap: .5rem; flex: none; }
.logo-crest { width: 1.6rem; height: 1.6rem; flex: none; }
.logo-lockup { display: inline-flex; align-items: center; gap: .45rem; }
.logo-mark {
  font-family: var(--num);
  font-weight: 700; font-size: 1.5rem; line-height: 1;
  letter-spacing: .02em;
  color: var(--accent);
}
.logo-sub {
  font-size: .72rem; color: var(--text-dim);
  display: none;
}
@media (min-width: 560px) { .logo-sub { display: inline; } }

/* Chip de temporada: sustituye al pill con emoji del hero */
.season-chip {
  font-family: var(--num);
  font-size: .8rem; font-weight: 600; letter-spacing: .1em; text-transform: uppercase;
  color: var(--text-muted);
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  padding: .15rem .6rem;
  white-space: nowrap;
  margin-left: auto;
}

.site-nav {
  display: none;
  gap: 1.4rem;
  font-size: .88rem; font-weight: 600;
  margin-left: 1.25rem;
}
@media (min-width: 720px) { .site-nav { display: flex; } }
.site-nav a { color: var(--text-muted); white-space: nowrap; transition: color .15s var(--ease-out); }
.site-nav a:hover { color: var(--accent); }

/* =============================================================
   7. Hero — corto: la herramienta manda
   ============================================================= */
.hero { padding-block: 1.4rem .5rem; }
.hero h1 { margin-top: .3rem; }
.hero h1 em { font-style: normal; color: var(--accent); }
.hero-sub {
  margin-top: .5rem;
  color: var(--text-muted);
  max-width: 54ch;
  font-size: .98rem;
}

/* =============================================================
   8. Tablero de predicción
   ============================================================= */
.tool { padding-bottom: 1.5rem; }

.tool-card {
  margin-top: 1.1rem;
  background: var(--bg-2);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  overflow: hidden;
}

.tool-card-top {
  display: flex; align-items: center; justify-content: space-between; gap: .75rem;
  padding: .7rem .9rem;
  border-bottom: 1px solid var(--line);
  background: var(--surface);
}
.tool-card-title { display: flex; flex-direction: column; gap: .1rem; min-width: 0; }
.tool-card-title .overline { font-size: .78rem; }
.tool-hint {
  font-size: .78rem; color: var(--text-dim);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

/* --- Las filas --- */
.ranking-board {
  list-style: none;
  touch-action: none;
  background: var(--bg-2);
}

.rank-item {
  position: relative;
  display: grid;
  grid-template-columns: 2rem 2rem minmax(0, 1fr) auto;
  align-items: center;
  gap: .65rem;
  min-height: var(--row-h);
  padding: .3rem .6rem .3rem .75rem;
  border-bottom: 1px solid var(--line);
  cursor: grab;
  user-select: none;
  background: var(--bg-2);
  transition: background .15s var(--ease-out);
}
.rank-item:last-child { border-bottom: 0; }
.rank-item:hover { background: var(--surface); }
.rank-item:active { cursor: grabbing; }

/* Franja de zona a la izquierda: podio arriba, últimos puestos abajo */
.rank-item::before {
  content: "";
  position: absolute; left: 0; top: 0; bottom: 0;
  width: 3px;
  background: transparent;
}
.rank-item:nth-child(1)::before { background: var(--gold); }
.rank-item:nth-child(2)::before { background: var(--silver); }
.rank-item:nth-child(3)::before { background: var(--bronze); }
.rank-item:nth-child(n+9)::before { background: var(--danger); opacity: .55; }

.rank-item.is-dragging {
  background: var(--surface-2);
  box-shadow: var(--shadow-lg);
  border-radius: 10px;
  border-bottom-color: transparent;
  z-index: 5;
  cursor: grabbing;
}

.rank-pos {
  font-family: var(--num);
  font-size: 1.45rem; font-weight: 700; line-height: 1;
  font-variant-numeric: tabular-nums;
  text-align: center;
  color: var(--text-dim);
}
.rank-item:nth-child(1) .rank-pos { color: var(--gold); }
.rank-item:nth-child(2) .rank-pos { color: var(--silver); }
.rank-item:nth-child(3) .rank-pos { color: var(--bronze); }

.rank-crest {
  width: 2rem; height: 2rem;
  object-fit: contain;
  filter: drop-shadow(0 1px 3px rgba(0, 0, 0, .5));
}

.rank-name {
  font-weight: 650;
  font-size: .98rem;
  letter-spacing: -.01em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.rank-actions { display: flex; align-items: center; gap: .2rem; flex: none; }

.rank-grip {
  display: none;
  color: var(--text-dim);
  padding-inline: .35rem;
  opacity: .7;
}
@media (min-width: 480px) { .rank-grip { display: block; } }

.rank-btn {
  width: 1.9rem; height: 1.9rem;
  border-radius: 7px;
  display: flex; align-items: center; justify-content: center;
  color: var(--text-muted);
  background: var(--surface-2);
  transition: background .14s var(--ease-out), color .14s var(--ease-out);
}
.rank-btn:hover:not(:disabled) { background: var(--accent); color: var(--accent-ink); }
.rank-btn:disabled { opacity: .25; cursor: not-allowed; }
.rank-btn .icon { width: 1rem; height: 1rem; }

/* Leyenda de zonas */
.zone-legend {
  display: flex; flex-wrap: wrap; gap: 1rem;
  padding: .6rem .9rem;
  border-top: 1px solid var(--line);
  background: var(--surface);
  font-size: .75rem; color: var(--text-dim);
}
.zone-legend span { display: inline-flex; align-items: center; gap: .4rem; }
.zone-legend i { width: 10px; height: 3px; border-radius: 2px; flex: none; }
.zone-legend .z-podium { background: var(--gold); }
.zone-legend .z-bottom { background: var(--danger); opacity: .55; }

.notice {
  margin: .9rem; padding: .9rem;
  background: var(--surface-2); border-radius: var(--radius);
  font-size: .9rem; color: var(--text-muted);
}

/* --- Individuales --- */
.awards-inputs { padding: 1rem .9rem; border-top: 1px solid var(--line); }
.awards-inputs-title { font-size: .85rem; color: var(--text-muted); margin-bottom: .75rem; }
.awards-fields { display: grid; gap: .8rem; grid-template-columns: 1fr; }
@media (min-width: 560px) { .awards-fields { grid-template-columns: 1fr 1fr; } }

.award-field label {
  display: block;
  font-family: var(--num);
  font-size: .82rem; font-weight: 600; letter-spacing: .1em; text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: .35rem;
}
.award-field input[type="text"] {
  width: 100%; padding: .65rem .8rem;
  border: 1px solid var(--line-strong); border-radius: 9px;
  background: var(--surface); color: var(--text);
  font: inherit; font-size: .94rem;
  transition: border-color .15s var(--ease-out), background .15s var(--ease-out);
}
.award-field input[type="text"]:focus {
  outline: none; border-color: var(--accent); background: var(--surface-2);
}
.award-field input[type="text"]::placeholder { color: var(--text-dim); }
.award-field .hint { display: block; margin-top: .3rem; font-size: .74rem; color: var(--text-dim); }

/* --- Acciones --- */
.tool-card-actions {
  padding: 1rem .9rem;
  border-top: 1px solid var(--line);
  background: var(--surface);
  display: flex; flex-wrap: wrap; gap: .65rem;
}
.tool-card-actions .btn { flex: 1 1 auto; }
@media (min-width: 560px) { .tool-card-actions .btn { flex: 0 0 auto; } }

.submit-status { flex-basis: 100%; font-size: .86rem; color: var(--text-muted); }
.submit-status:empty { display: none; }
.submit-status[data-tone="ok"] { color: var(--accent); }
.submit-status[data-tone="warn"] { color: var(--warn); }
.submit-status[data-tone="error"] { color: var(--danger); }

.privacy-badge { margin-top: .8rem; font-size: .8rem; color: var(--text-dim); }
/* =============================================================
   9. La General
   ============================================================= */
.la-general { padding-block: 1.5rem; }

.general-meta { display: flex; align-items: baseline; gap: .5rem; margin-top: .6rem; }
.general-count {
  font-family: var(--num);
  font-size: 2.1rem; font-weight: 700; line-height: 1;
  font-variant-numeric: tabular-nums;
  color: var(--accent);
}
.general-count-label { font-size: .85rem; color: var(--text-muted); }

.general-table-wrap {
  margin-top: 1rem;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  overflow: hidden;
  background: var(--bg-2);
}
.general-table { width: 100%; }
.general-table th, .general-table td {
  padding: .55rem .6rem;
  text-align: left;
  border-bottom: 1px solid var(--line);
  vertical-align: middle;
}
.general-table thead th {
  font-family: var(--num);
  font-size: .78rem; font-weight: 600; letter-spacing: .12em; text-transform: uppercase;
  color: var(--text-dim);
  background: var(--surface);
  padding-block: .5rem;
}
.general-table tbody tr:last-child td { border-bottom: none; }
.general-table tbody tr { transition: background .15s var(--ease-out); }
.general-table tbody tr:hover { background: var(--surface); }

.g-pos-cell { width: 2.6rem; padding-left: .9rem !important; }
.g-pos {
  font-family: var(--num);
  font-size: 1.25rem; font-weight: 700; line-height: 1;
  font-variant-numeric: tabular-nums;
  color: var(--text-dim);
}
.g-pos.medal-1 { color: var(--gold); }
.g-pos.medal-2 { color: var(--silver); }
.g-pos.medal-3 { color: var(--bronze); }

.g-team { display: flex; align-items: center; gap: .55rem; font-weight: 650; font-size: .94rem; }
.g-badge { width: 1.6rem; height: 1.6rem; object-fit: contain; flex: none; }
.g-name { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* Barra de consenso: cuánto empuja la afición a ese equipo hacia arriba */
.g-bar-cell { width: 34%; }
.g-bar {
  display: block;
  height: 6px;
  border-radius: 3px;
  background: var(--surface-2);
  overflow: hidden;
}
.g-bar i {
  display: block; height: 100%;
  border-radius: 3px;
  background: linear-gradient(90deg, var(--accent-strong), var(--accent));
}
.general-table tbody tr:nth-child(1) .g-bar i { background: linear-gradient(90deg, #c9992f, #f2c14e); }
.general-table tbody tr:nth-child(2) .g-bar i { background: linear-gradient(90deg, #8e9aa2, #c3ced6); }
.general-table tbody tr:nth-child(3) .g-bar i { background: linear-gradient(90deg, #9c5f38, #cd8250); }

.g-avg {
  font-family: var(--num);
  font-size: 1.05rem; font-weight: 600;
  font-variant-numeric: tabular-nums;
  color: var(--text-muted);
  text-align: right !important;
  width: 4.5rem;
  padding-right: .9rem !important;
}

.general-loading { text-align: center !important; color: var(--text-dim); padding: 1.6rem !important; }
.general-fallback { margin-top: .8rem; font-size: .88rem; color: var(--text-muted); }

/* La barra es un lujo: en pantallas muy estrechas manda el nombre */
@media (max-width: 430px) {
  .g-bar-cell { display: none; }
}

/* --- Individuales según la afición --- */
.awards-grid { display: grid; gap: .9rem; margin-top: 1.2rem; grid-template-columns: 1fr; }
@media (min-width: 640px) { .awards-grid { grid-template-columns: 1fr 1fr; } }

.award-card {
  background: var(--bg-2);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  overflow: hidden;
}
.award-card h3 {
  font-family: var(--num);
  font-size: .85rem; font-weight: 600; letter-spacing: .12em; text-transform: uppercase;
  color: var(--text-dim);
  padding: .6rem .85rem;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
}
.award-list { display: flex; flex-direction: column; }
.award-row {
  display: flex; align-items: center; justify-content: space-between; gap: .6rem;
  padding: .55rem .85rem;
  border-bottom: 1px solid var(--line);
  font-size: .92rem;
}
.award-row:last-child { border-bottom: none; }
.award-row .award-name { font-weight: 650; }
.award-row .award-votes {
  font-family: var(--num);
  font-size: .9rem; color: var(--text-dim); white-space: nowrap;
  font-variant-numeric: tabular-nums;
}
.award-empty { color: var(--text-dim); font-size: .88rem; padding: .85rem; }

/* =============================================================
   10. Texto largo
   ============================================================= */
.content-seo { padding-block: 1.5rem; }
.prose p { margin-block: .8rem; max-width: 70ch; color: var(--text-muted); font-size: .95rem; }
.prose h3 { margin-block: 1.6rem .4rem; color: var(--text); }
.prose ul { list-style: disc; padding-left: 1.3rem; max-width: 70ch; color: var(--text-muted); font-size: .95rem; }
.prose li { margin-block: .35rem; }
.prose strong { color: var(--text); font-weight: 650; }
.prose em { color: var(--text); }

/* =============================================================
   11. FAQ
   ============================================================= */
.faq { padding-block: 1.5rem 3rem; }
.faq-list {
  margin-top: 1rem;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  overflow: hidden;
  background: var(--bg-2);
}
.faq-item { border-bottom: 1px solid var(--line); }
.faq-item:last-child { border-bottom: none; }
.faq-item summary {
  font-weight: 650; font-size: .95rem;
  cursor: pointer; list-style: none;
  display: flex; align-items: center; justify-content: space-between; gap: 1rem;
  padding: .85rem .95rem;
  transition: background .15s var(--ease-out);
}
.faq-item summary:hover { background: var(--surface); }
.faq-item summary::-webkit-details-marker { display: none; }
.faq-item summary::after {
  content: "+";
  font-family: var(--num);
  font-size: 1.4rem; line-height: 1; color: var(--accent); flex: none;
}
.faq-item[open] summary::after { content: "−"; }
.faq-item[open] summary { background: var(--surface); }
.faq-item p { padding: 0 .95rem .95rem; color: var(--text-muted); font-size: .92rem; }

/* =============================================================
   12. Pie
   ============================================================= */
.site-footer {
  border-top: 1px solid var(--line);
  padding-block: 1.6rem 2.2rem;
  background: var(--bg-2);
}
.footer-inner { display: flex; flex-wrap: wrap; gap: 1.2rem; align-items: flex-start; justify-content: space-between; }
.footer-note { margin-top: .5rem; max-width: 48ch; font-size: .8rem; color: var(--text-dim); }
.footer-nav { display: flex; gap: 1rem; font-size: .85rem; color: var(--text-muted); }
.footer-nav a:hover { color: var(--accent); }

/* =============================================================
   13. Movimiento reducido
   ============================================================= */
@media (prefers-reduced-motion: reduce) {
  .rank-item, .btn, .general-table tbody tr { transition: none; }
}

/* =============================================================
   14. Tarjeta de exportación (fuera de pantalla → PNG)
   html2canvas la rasteriza: colores en hex literal, nada de
   variables de color, color-mix ni filtros.
   ============================================================= */
.export-card {
  position: fixed; top: 0; left: -9999px;
  width: 520px;
  background: #071411;
  color: #f0f7f4;
  padding: 32px;
  font-family: var(--sans);
}
.export-head {
  display: flex; align-items: center; justify-content: space-between;
  padding-bottom: 14px; border-bottom: 2px solid #17d39f;
}
.export-brand { display: flex; align-items: center; gap: 10px; }
.export-crest { width: 34px; height: 34px; flex: none; }
.export-logo {
  font-family: var(--num);
  font-weight: 700; font-size: 30px; line-height: 1; color: #17d39f;
}
.export-season {
  font-family: var(--num);
  font-size: 15px; letter-spacing: .12em; text-transform: uppercase; color: #8fa89f;
}
.export-title {
  font-size: 21px; font-weight: 800; letter-spacing: -.02em;
  margin-top: 18px; margin-bottom: 14px; color: #f0f7f4;
}
.export-list { list-style: none; }
.export-row {
  display: flex; align-items: center;
  padding: 9px 10px;
  border-bottom: 1px solid #1b3a33;
}
.export-row:last-child { border-bottom: none; }
.export-pos {
  font-family: var(--num);
  width: 34px; flex: none;
  font-size: 25px; font-weight: 700; line-height: 1; color: #5f7f76;
}
.export-row:nth-child(1) .export-pos { color: #f2c14e; }
.export-row:nth-child(2) .export-pos { color: #c3ced6; }
.export-row:nth-child(3) .export-pos { color: #cd8250; }
.export-badge { width: 28px; height: 28px; flex: none; margin-right: 12px; }
.export-name { font-weight: 650; font-size: 16px; color: #f0f7f4; }
.export-awards {
  margin-top: 16px; padding-top: 14px; border-top: 1px solid #1b3a33;
  font-size: 14px; color: #8fa89f;
}
.export-awards b { color: #f0f7f4; font-weight: 650; }
.export-foot {
  margin-top: 18px;
  display: flex; align-items: center; justify-content: space-between;
  font-size: 13px; color: #5f7f76;
}
.export-foot strong { color: #17d39f; font-weight: 700; }
