/* ==========================================================================
   YOSOYESPAÑOL — "el bar digital de La Roja"
   Paleta: madera de bar nocturna + rojo selección + gualda
   Tipografía: Anton (cartel deportivo) + Archivo (cuerpo, números tabulares)
   Firma visual: EL PULSO — la tira de emoción en directo
   ========================================================================== */

:root {
  --noche:   #16110e;   /* fondo: madera oscura de bar */
  --carbon:  #211a15;   /* tarjetas */
  --carbon2: #2b211a;   /* tarjetas elevadas */
  --crema:   #f4eadb;   /* texto principal */
  --ceniza:  #a2917f;   /* texto secundario */
  --rojo:    #d6232b;
  --rojo-osc:#a3161d;
  --gualda:  #f2b824;
  --linea:   rgba(244, 234, 219, 0.09);
  --radius: 10px;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  background: var(--noche);
  color: var(--crema);
  font-family: "Archivo", system-ui, sans-serif;
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, .score, .wordmark, .team-name {
  font-family: "Anton", "Archivo", sans-serif;
  font-weight: 400;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

button { font-family: inherit; cursor: pointer; }
input { font-family: inherit; }

/* ---------- la banda rojo-gualda-rojo (motivo de marca, solo filete) ----- */
.sash {
  height: 4px;
  background: linear-gradient(to bottom, var(--rojo) 0 25%, var(--gualda) 25% 75%, var(--rojo) 75% 100%);
}

/* ---------- cabecera ----------------------------------------------------- */
.topbar { position: sticky; top: 0; z-index: 50; background: rgba(22,17,14,0.92); backdrop-filter: blur(10px); border-bottom: 1px solid var(--linea); }
.topbar-inner {
  max-width: 1080px; margin: 0 auto; padding: 10px 16px;
  display: flex; align-items: center; gap: 16px; flex-wrap: wrap;
}
.wordmark { font-size: 1.5rem; color: var(--crema); text-decoration: none; letter-spacing: 0.04em; display: flex; align-items: center; gap: 10px; }
.wordmark span { color: var(--gualda); }
.logo { width: 34px; height: 34px; border-radius: 8px; flex: none; }

/* banderas como imagen (flagcdn) — los emojis no se ven en Windows */
.flag-img { width: 1.2em; height: auto; border-radius: 0.12em; vertical-align: middle; box-shadow: 0 1px 4px rgba(0,0,0,0.5); }

.tabs { display: flex; gap: 4px; flex: 1; overflow-x: auto; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tab {
  background: none; border: none; color: var(--ceniza);
  padding: 8px 12px; border-radius: 6px; font-weight: 600; font-size: 0.92rem;
  white-space: nowrap; transition: color 0.15s, background 0.15s;
}
.tab:hover { color: var(--crema); }
.tab.active { color: var(--noche); background: var(--gualda); }

.auth-zone { display: flex; align-items: center; gap: 8px; }
.user-chip { display: flex; align-items: center; gap: 8px; font-weight: 600; font-size: 0.9rem; }
.user-chip .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--gualda); }

/* ---------- botones ------------------------------------------------------ */
.btn {
  border: none; border-radius: var(--radius); padding: 10px 18px;
  font-weight: 700; font-size: 0.95rem; transition: transform 0.1s, filter 0.15s;
}
.btn:active { transform: scale(0.97); }
.btn-rojo   { background: var(--rojo); color: #fff; }
.btn-rojo:hover { filter: brightness(1.1); }
.btn-gualda { background: var(--gualda); color: var(--noche); }
.btn-gualda:hover { filter: brightness(1.05); }
.btn-ghost  { background: transparent; color: var(--crema); border: 1px solid var(--linea); }
.btn-ghost:hover { border-color: var(--ceniza); }

/* ---------- hero: el marcador -------------------------------------------- */
.hero {
  max-width: 1080px; margin: 0 auto; padding: 40px 16px 28px;
  text-align: center;
}
.hero-eyebrow {
  color: var(--gualda); font-weight: 700; letter-spacing: 0.22em;
  font-size: 0.8rem; text-transform: uppercase; margin-bottom: 18px;
}
.scoreboard {
  display: grid; grid-template-columns: 1fr auto 1fr; align-items: center;
  gap: 12px; max-width: 760px; margin: 0 auto;
}
.team { display: flex; flex-direction: column; align-items: center; gap: 6px; min-width: 0; }
.flag { font-size: clamp(2.4rem, 7vw, 4rem); line-height: 1; }
.team-name {
  font-size: clamp(1.1rem, 3.4vw, 1.9rem); color: var(--crema);
  max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.score {
  font-size: clamp(3.2rem, 11vw, 6.5rem); line-height: 1; color: var(--crema);
  font-variant-numeric: tabular-nums; padding: 0 8px;
}
.score .live-goal { color: var(--gualda); }
.match-state { color: var(--ceniza); font-size: 0.9rem; font-weight: 600; margin-top: 6px; }
.match-state.live { color: var(--rojo); }
.match-state.live::before { content: "●"; margin-right: 6px; animation: blink 1.4s infinite; }
@keyframes blink { 50% { opacity: 0.25; } }

/* ---------- EL PULSO — la firma ------------------------------------------ */
.pulso { max-width: 760px; margin: 28px auto 0; }
.pulso-label {
  text-align: left; font-weight: 800; letter-spacing: 0.14em;
  font-size: 0.78rem; color: var(--gualda); margin-bottom: 8px;
}
.pulso-label span { color: var(--ceniza); font-weight: 500; letter-spacing: 0.02em; text-transform: none; }
.pulso-strip {
  height: 56px; display: flex; align-items: flex-end; gap: 3px;
  background: var(--carbon); border: 1px solid var(--linea);
  border-radius: var(--radius); padding: 6px 8px; overflow: hidden;
}
.pulso-bar {
  flex: 1; min-width: 3px; border-radius: 2px 2px 0 0;
  background: linear-gradient(to top, var(--rojo), var(--gualda));
  transition: height 0.6s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.pulso-buttons { display: flex; gap: 8px; margin-top: 12px; flex-wrap: wrap; justify-content: center; }
.pulso-btn {
  background: var(--carbon2); color: var(--crema); border: 1px solid var(--linea);
  border-radius: 999px; padding: 10px 16px; font-weight: 700; font-size: 0.95rem;
  transition: transform 0.1s, border-color 0.15s, background 0.15s;
}
.pulso-btn:hover { border-color: var(--gualda); }
.pulso-btn:active { transform: scale(1.12); background: var(--rojo); border-color: var(--rojo); }

/* ---------- paneles / pestañas ------------------------------------------- */
.panel { display: none; max-width: 1080px; margin: 0 auto; padding: 24px 16px 56px; }
.panel.active { display: block; }
.panel-head { margin-bottom: 18px; }
.panel-head h2 { font-size: 1.7rem; }
.panel-sub { color: var(--ceniza); font-size: 0.92rem; margin-top: 4px; }
.panel-sub strong { color: var(--gualda); }
.block-title { font-size: 1.05rem; color: var(--gualda); margin-bottom: 12px; }

.filter { display: flex; gap: 8px; margin-top: 12px; }
.chip {
  background: var(--carbon); color: var(--ceniza); border: 1px solid var(--linea);
  border-radius: 999px; padding: 6px 14px; font-weight: 600; font-size: 0.85rem;
}
.chip.active { background: var(--rojo); border-color: var(--rojo); color: #fff; }

/* ---------- lista de partidos --------------------------------------------- */
.match-list { display: flex; flex-direction: column; gap: 10px; }
.match-card {
  display: grid; grid-template-columns: auto 1fr auto 1fr auto; align-items: center;
  gap: 10px; background: var(--carbon); border: 1px solid var(--linea);
  border-radius: var(--radius); padding: 14px 16px;
}
.match-card.spain { border-color: rgba(242, 184, 36, 0.45); background: var(--carbon2); }
.match-card .mc-flag { font-size: 1.5rem; }
.match-card .mc-team { font-weight: 700; font-size: 0.95rem; }
.match-card .mc-team.left { text-align: right; }
.match-card .mc-score {
  font-family: "Anton", sans-serif; font-size: 1.5rem;
  font-variant-numeric: tabular-nums; padding: 0 6px; white-space: nowrap;
}
.match-card .mc-meta {
  grid-column: 1 / -1; display: flex; justify-content: space-between;
  color: var(--ceniza); font-size: 0.78rem; margin-top: 4px;
}
.match-card .mc-meta .live { color: var(--rojo); font-weight: 700; }

/* ---------- la porra ------------------------------------------------------ */
.porra-grid { display: grid; grid-template-columns: 1.4fr 1fr; gap: 28px; }
.porra-card {
  background: var(--carbon); border: 1px solid var(--linea); border-radius: var(--radius);
  padding: 14px 16px; margin-bottom: 10px;
}
.porra-card .pc-teams { font-weight: 700; margin-bottom: 4px; }
.porra-card .pc-date { color: var(--ceniza); font-size: 0.8rem; margin-bottom: 10px; }
.porra-inputs { display: flex; align-items: center; gap: 8px; }
.porra-inputs input {
  width: 58px; text-align: center; background: var(--noche); color: var(--crema);
  border: 1px solid var(--linea); border-radius: 8px; padding: 9px 4px;
  font-size: 1.1rem; font-weight: 700; font-variant-numeric: tabular-nums;
}
.porra-inputs input:focus { outline: 2px solid var(--gualda); border-color: transparent; }
.porra-saved { color: var(--gualda); font-size: 0.8rem; font-weight: 700; margin-left: 6px; }

.ranking { list-style: none; counter-reset: rank; }
.ranking li {
  counter-increment: rank; display: flex; justify-content: space-between; align-items: center;
  background: var(--carbon); border: 1px solid var(--linea); border-radius: 8px;
  padding: 10px 14px; margin-bottom: 6px; font-weight: 600;
}
.ranking li::before {
  content: counter(rank); font-family: "Anton", sans-serif; color: var(--ceniza);
  margin-right: 12px; min-width: 1.4em;
}
.ranking li:first-child { border-color: var(--gualda); }
.ranking li:first-child::before { content: "🏆"; }
.ranking .pts { color: var(--gualda); font-variant-numeric: tabular-nums; }

/* ---------- el muro -------------------------------------------------------- */
.muro {
  display: flex; flex-direction: column-reverse; gap: 8px;
  max-height: 460px; overflow-y: auto; padding: 4px;
}
.grito {
  background: var(--carbon); border: 1px solid var(--linea); border-radius: var(--radius);
  padding: 10px 14px; max-width: 640px;
}
.grito .g-author { color: var(--gualda); font-weight: 700; font-size: 0.82rem; margin-right: 8px; }
.grito .g-time { color: var(--ceniza); font-size: 0.72rem; }
.grito .g-text { display: block; margin-top: 2px; word-wrap: break-word; }
.muro-form { display: flex; gap: 8px; margin-top: 14px; }
.muro-form input {
  flex: 1; background: var(--carbon); color: var(--crema);
  border: 1px solid var(--linea); border-radius: var(--radius); padding: 12px 14px; font-size: 1rem;
}
.muro-form input:focus { outline: 2px solid var(--rojo); border-color: transparent; }

/* ---------- la afición ----------------------------------------------------- */
.mapa {
  height: 420px; border-radius: var(--radius); border: 1px solid var(--linea);
  filter: saturate(0.7) brightness(0.9);
}
.fan-form { display: flex; gap: 8px; margin-top: 14px; flex-wrap: wrap; }
.fan-form input {
  flex: 1; min-width: 180px; background: var(--carbon); color: var(--crema);
  border: 1px solid var(--linea); border-radius: var(--radius); padding: 12px 14px; font-size: 1rem;
}
.fan-form input:focus { outline: 2px solid var(--gualda); border-color: transparent; }

/* ---------- modal ----------------------------------------------------------- */
.modal {
  border: 1px solid var(--linea); border-radius: 14px; background: var(--carbon2);
  color: var(--crema); padding: 28px; width: min(420px, 92vw);
}
.modal::backdrop { background: rgba(10, 7, 5, 0.75); backdrop-filter: blur(3px); }
.modal-close {
  position: absolute; top: 12px; right: 14px; background: none; border: none;
  color: var(--ceniza); font-size: 1.1rem;
}
.modal-title { font-size: 1.5rem; margin-bottom: 6px; }
.modal-sub { color: var(--ceniza); font-size: 0.9rem; margin-bottom: 18px; }
.btn-google {
  width: 100%; background: #fff; color: #1a1a1a; display: flex; align-items: center;
  justify-content: center; gap: 10px; font-weight: 700;
}
.modal-divider {
  display: flex; align-items: center; gap: 12px; color: var(--ceniza);
  font-size: 0.8rem; margin: 18px 0;
}
.modal-divider::before, .modal-divider::after { content: ""; flex: 1; height: 1px; background: var(--linea); }
#authForm { display: flex; flex-direction: column; gap: 10px; }
#authForm input {
  background: var(--noche); color: var(--crema); border: 1px solid var(--linea);
  border-radius: var(--radius); padding: 12px 14px; font-size: 0.95rem;
}
#authForm input:focus { outline: 2px solid var(--gualda); border-color: transparent; }
.modal-actions { display: flex; gap: 8px; margin-top: 4px; }
.modal-actions .btn { flex: 1; }
.auth-error { color: var(--rojo); font-size: 0.85rem; min-height: 1.2em; }

/* ---------- varios ----------------------------------------------------------- */
.empty { color: var(--ceniza); font-size: 0.92rem; padding: 14px 0; }
.toast {
  position: fixed; bottom: 22px; left: 50%; transform: translateX(-50%) translateY(80px);
  background: var(--gualda); color: var(--noche); font-weight: 700;
  padding: 12px 22px; border-radius: 999px; opacity: 0; transition: all 0.3s; z-index: 100;
  pointer-events: none;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

.footer { margin-top: 40px; }
.footer p { text-align: center; color: var(--ceniza); font-size: 0.85rem; padding: 20px 16px 28px; }

:focus-visible { outline: 2px solid var(--gualda); outline-offset: 2px; }

@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
}

@media (max-width: 720px) {
  .porra-grid { grid-template-columns: 1fr; }
  .topbar-inner { gap: 10px; }
  .tabs { order: 3; width: 100%; }
}

/* ==========================================================================
   v2: navegación móvil inferior, selector en directo, idioma, hero responsive
   ========================================================================== */

.top-actions { display: flex; align-items: center; gap: 8px; margin-left: auto; }
.btn-lang { padding: 8px 12px; font-size: 0.85rem; letter-spacing: 0.06em; }
.tab-ico { display: none; }
.wordmark-text { white-space: nowrap; }

/* el nombre del equipo ya no se corta: hasta 2 líneas */
.team-name {
  white-space: normal; overflow: visible; text-overflow: clip;
  line-height: 1.1; max-width: 100%;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}

/* selector de partidos en directo */
.live-strip {
  display: flex; align-items: center; gap: 8px; justify-content: center;
  flex-wrap: wrap; margin-bottom: 18px;
}
.live-strip-label {
  color: var(--rojo); font-weight: 800; font-size: 0.75rem; letter-spacing: 0.14em;
  animation: blink 1.4s infinite;
}
.live-chip {
  display: inline-flex; align-items: center; gap: 6px;
  background: var(--carbon); color: var(--crema); border: 1px solid var(--linea);
  border-radius: 999px; padding: 7px 13px; font-weight: 700; font-size: 0.92rem;
  font-variant-numeric: tabular-nums; transition: border-color 0.15s, background 0.15s;
}
.live-chip:hover { border-color: var(--gualda); }
.live-chip.active { background: var(--rojo); border-color: var(--rojo); color: #fff; }
.live-chip .flag-img { width: 1.15em; }

/* ---------- móvil: pestañas como barra de navegación inferior ---------- */
@media (max-width: 720px) {
  .topbar-inner { flex-wrap: nowrap; gap: 8px; padding: 10px 12px; }
  .wordmark { font-size: 1.15rem; gap: 7px; min-width: 0; }
  .wordmark-text { overflow: hidden; text-overflow: ellipsis; }
  .logo { width: 30px; height: 30px; }
  .user-chip { display: none; }            /* el nombre no cabe: queda el botón Salir */
  .btn-ghost { padding: 8px 12px; font-size: 0.85rem; }

  .tabs {
    position: fixed; bottom: 0; left: 0; right: 0; z-index: 60;
    order: 0; width: 100%;
    display: grid; grid-template-columns: repeat(4, 1fr); gap: 0;
    background: rgba(22, 17, 14, 0.97); backdrop-filter: blur(12px);
    border-top: 2px solid var(--gualda);
    padding: 6px 4px calc(8px + env(safe-area-inset-bottom));
    overflow: visible;
  }
  .tab {
    display: flex; flex-direction: column; align-items: center; gap: 2px;
    padding: 6px 2px; font-size: 0.7rem; font-weight: 700; border-radius: 8px;
  }
  .tab-ico { display: block; font-size: 1.25rem; line-height: 1; }
  .tab.active { background: none; color: var(--gualda); }

  body { padding-bottom: 86px; }           /* hueco para la barra inferior */
  .footer p { padding-bottom: 8px; }

  .hero { padding-top: 24px; }
  .scoreboard { gap: 6px; }
  .team-name { font-size: 0.95rem; }
  .mapa { height: 340px; }
}
