/* Tokens, reset y componentes genéricos (botones, chips, modal, avisos). */
:root {
  --bg: #0b0e2a;
  --bg-2: #141a45;
  --panel: #1b2260;
  --panel-2: #252e7a;
  --line: rgba(255, 255, 255, 0.14);
  --text: #f4f6ff;
  --muted: #a7b0e0;

  --yellow: #ffd23f;
  --pink: #ff3d8b;
  --cyan: #22e3ff;
  --green: #3dff7a;
  --red: #ff3b47;
  --orange: #ff9a1f;
  --purple: #a35cff;
  /* Colores de cada equipo en el partido (crónica, minicampo y estadísticas) */
  --home: var(--cyan);
  --away: var(--pink);

  --hud-h: clamp(48px, 12vh, 68px);
  --radius: 16px;
  --card-h: 120px; /* tamaño por defecto de las cartas; cada contenedor lo redefine */

  --font-display: 'Lilita One', 'Arial Rounded MT Bold', system-ui, sans-serif;
  --font-body: 'Rubik', system-ui, -apple-system, 'Segoe UI', sans-serif;
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }

html, body {
  height: 100%;
  margin: 0;
  overflow: hidden;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 15px;
  -webkit-tap-highlight-color: transparent;
  -webkit-font-smoothing: antialiased;
  overscroll-behavior: none;
}

h1, h2, h3 { font-family: var(--font-display); font-weight: 400; letter-spacing: 0.3px; margin: 0 0 0.4em; }
p { margin: 0 0 0.6em; }
a { color: inherit; }
button { font: inherit; color: inherit; }
.muted { color: var(--muted); }
.pos { color: var(--green); }
.neg { color: #ff7b84; }
[hidden] { display: none !important; }

/* ---------- Botones arcade ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4em;
  font-family: var(--font-display);
  font-size: 1rem;
  letter-spacing: 0.4px;
  text-decoration: none;
  border: 0;
  border-radius: 14px;
  padding: 0.65em 1.2em;
  color: #241a00;
  background: linear-gradient(180deg, #ffe27a, var(--yellow));
  box-shadow: 0 5px 0 #b8890b, 0 8px 18px rgba(0, 0, 0, 0.3);
  cursor: pointer;
  transition: transform 0.08s, box-shadow 0.08s, filter 0.2s;
}
.btn:hover { filter: brightness(1.08); }
.btn:active:not(:disabled) { transform: translateY(4px); box-shadow: 0 1px 0 #b8890b; }
.btn:disabled { filter: grayscale(1) brightness(0.6); cursor: not-allowed; }
.btn--danger { color: #fff; background: linear-gradient(180deg, #ff6b74, var(--red)); box-shadow: 0 5px 0 #8a0a18; }
.btn--ghost { color: var(--text); background: transparent; box-shadow: inset 0 0 0 2px var(--line); }
.btn--ghost:active:not(:disabled) { box-shadow: inset 0 0 0 2px var(--line); }

/* ---------- Chips y etiquetas ---------- */
.chip {
  display: inline-flex;
  align-items: center;
  gap: 0.35em;
  padding: 0.35em 0.8em;
  border-radius: 999px;
  background: rgba(10, 13, 44, 0.75);
  box-shadow: inset 0 0 0 2px var(--line);
  font-size: 0.85rem;
  white-space: nowrap;
  text-decoration: none;
}
.chip--glow { box-shadow: inset 0 0 0 2px rgba(124, 246, 255, 0.7), 0 0 14px rgba(124, 246, 255, 0.35); }

.tag {
  display: inline-block;
  padding: 0.1em 0.55em;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 600;
  background: #ffffff1f;
  vertical-align: middle;
}
.tag--gold { background: var(--yellow); color: #fff; text-shadow: 0 1px 2px rgba(80, 50, 0, 0.8); }
.tag--young { background: #1f9d55; color: #eafff1; }
.tag--old { background: #7a2430; color: #ffe1e4; }
.tag--win { background: var(--green); color: #003314; }
.tag--rival { background: var(--orange); color: #3a1c00; }

/* ---------- Modal ---------- */
.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: grid;
  place-items: center;
  padding: 16px;
  background: rgba(4, 6, 30, 0.7);
  backdrop-filter: blur(4px);
  animation: fade-in 0.2s ease;
}
.modal-overlay.is-leaving { animation: fade-out 0.2s ease forwards; }
.modal {
  width: min(460px, 100%);
  max-height: calc(100dvh - 32px);
  display: flex;
  flex-direction: column;
  border-radius: 22px;
  background: linear-gradient(180deg, var(--panel-2), var(--panel));
  box-shadow: inset 0 0 0 3px #ffffff22, 0 10px 0 #070a26, 0 24px 60px rgba(0, 0, 0, 0.5);
  animation: pop-in 0.3s cubic-bezier(0.2, 1.5, 0.4, 1);
}
.modal--wide { width: min(760px, 100%); }
.modal--report { width: min(620px, 100%); }
.modal__head { display: flex; align-items: center; justify-content: space-between; padding: 14px 18px 4px; }
.modal__head h2 { margin: 0; font-size: 1.4rem; }
.modal__close { border: 0; background: #ffffff1a; width: 34px; height: 34px; border-radius: 50%; cursor: pointer; }
.modal__body { padding: 8px 18px; overflow: auto; }
.modal__actions { display: flex; justify-content: flex-end; gap: 10px; padding: 10px 18px 18px; flex-wrap: wrap; }

/* ---------- Avisos ---------- */
.toasts {
  position: fixed;
  top: calc(var(--hud-h) + 10px);
  left: 50%;
  transform: translateX(-50%);
  z-index: 300;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  pointer-events: none;
}
.toast {
  padding: 10px 18px;
  border-radius: 14px;
  background: #11164a;
  box-shadow: inset 0 0 0 2px var(--line), 0 8px 20px rgba(0, 0, 0, 0.4);
  font-weight: 600;
  animation: toast-in 0.35s cubic-bezier(0.2, 1.4, 0.4, 1);
  max-width: min(90vw, 520px);
  text-align: center;
}
.toast--success { box-shadow: inset 0 0 0 2px var(--green), 0 0 18px rgba(61, 255, 122, 0.3); }
.toast--warn { box-shadow: inset 0 0 0 2px var(--orange), 0 0 18px rgba(255, 154, 31, 0.35); }
.toast--error { box-shadow: inset 0 0 0 2px var(--red), 0 0 18px rgba(255, 59, 71, 0.35); }
.toast.is-leaving { animation: fade-out 0.3s forwards; }

/* ---------- Formularios ---------- */
.field { display: flex; flex-direction: column; gap: 6px; margin: 10px 0; }
.field input[type='range'] { width: 100%; accent-color: var(--yellow); }

/* ---------- Animaciones compartidas ---------- */
@keyframes fade-in { from { opacity: 0; } }
@keyframes fade-out { to { opacity: 0; } }
@keyframes pop-in { from { transform: scale(0.85); opacity: 0; } }
@keyframes toast-in { from { transform: translateY(-16px) scale(0.9); opacity: 0; } }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes blink { 50% { opacity: 0.35; } }
@keyframes float-y { 50% { transform: translateY(-6px); } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; }
}
.tag--draw { background: #5a5f86; color: #fff; }
.tag--loss { background: var(--red); color: #fff; }

/* Caras y banderas dibujadas (ui/emoji.js): ocupan lo mismo que un emoji del tamaño del texto */
img.emoji { display: inline-block; width: 1.15em; height: 1.15em; vertical-align: -0.2em; object-fit: contain; }
