/* ============================================================
   TORNEO DE CEL — styles.css
   Estética 8-bit: paleta oscura, tipografía mono, bordes duros.
   ============================================================ */

:root {
  --bg: #0d0d1a;
  --panel: #1a1a2e;
  --accent: #ffd23f;
  --accent2: #3fd2ff;
  --danger: #ff3f6e;
  --ok: #3fff8e;
  --text: #f2f2f2;
}

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

html, body {
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: "Courier New", ui-monospace, monospace;
  -webkit-tap-highlight-color: transparent;
  overflow: hidden;
}

#app {
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* ---------- Pantallas (single page, estados) ---------- */
.screen {
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 18px;
  width: 100%;
  max-width: 420px;
  height: 100%;
  padding: 16px;
  overflow-y: auto;
}
.screen.active { display: flex; }

/* ---------- Menú ---------- */
.logo {
  font-size: 44px;
  line-height: 1.05;
  text-align: center;
  color: var(--accent);
  text-shadow: 4px 4px 0 var(--danger), 8px 8px 0 #00000088;
  letter-spacing: 4px;
}
.tagline { color: var(--accent2); font-size: 13px; }

.profile-box {
  display: flex; flex-direction: column; gap: 8px;
  width: 100%; max-width: 300px;
}
.profile-row { display: flex; gap: 8px; }
.profile-row input:first-child { width: 64px; text-transform: uppercase; }
.profile-row input:last-child { flex: 1; }

input {
  background: var(--panel);
  border: 3px solid var(--accent2);
  color: var(--text);
  font-family: inherit;
  font-size: 14px;
  padding: 10px;
  outline: none;
}
input:focus { border-color: var(--accent); }

/* ---------- Botones ---------- */
.btn {
  background: var(--panel);
  border: 3px solid var(--accent);
  color: var(--text);
  font-family: inherit;
  font-size: 15px;
  font-weight: bold;
  padding: 12px 18px;
  cursor: pointer;
  box-shadow: 4px 4px 0 #000000aa;
  text-transform: uppercase;
}
.btn:active { transform: translate(2px, 2px); box-shadow: 2px 2px 0 #000000aa; }
.btn-big { font-size: 19px; padding: 16px 24px; border-color: var(--accent2); }
.btn-small { font-size: 12px; padding: 6px 10px; }
.menu-buttons { display: flex; flex-direction: column; gap: 12px; width: 100%; max-width: 300px; }

.best-scores {
  display: flex; flex-direction: column; gap: 4px;
  font-size: 12px; color: #999; text-align: center;
}

/* ---------- Selección de jugador (cartas FIFA) ---------- */
.card-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  width: 100%;
  max-width: 360px;
}
.player-card {
  width: 100%;
  height: auto;
  cursor: pointer;
  transition: transform 0.12s;
  filter: drop-shadow(3px 4px 0 rgba(0,0,0,0.5));
}
.player-card:hover { transform: translateY(-4px) scale(1.04); }
.player-card:active { transform: translateY(0) scale(0.98); }
.stat-legend { font-size: 10px; color: #888; text-align: center; }

/* ---------- Juego ---------- */
#screen-game { position: relative; padding: 0; gap: 0; }
#game-canvas {
  width: min(100vw, 360px, calc(97vh * 0.5625));
  aspect-ratio: 9 / 16;
  height: auto;
  background: #000;
  image-rendering: pixelated;
  touch-action: none; /* necesario para gestos táctiles propios */
  border: 2px solid #333;
}
.btn-quit {
  position: absolute;
  top: 10px; right: 10px;
  z-index: 5;
  border-color: var(--danger);
}

/* ---------- Leaderboard ---------- */
.tabs { display: flex; gap: 6px; }
.tab {
  background: var(--panel);
  border: 2px solid #555;
  color: #aaa;
  font-family: inherit;
  font-size: 12px;
  padding: 8px 12px;
  cursor: pointer;
  text-transform: uppercase;
}
.tab.active { border-color: var(--accent); color: var(--accent); }

.lb-list {
  width: 100%; max-width: 340px;
  min-height: 200px;
  display: flex; flex-direction: column; gap: 6px;
  font-size: 13px;
}
.lb-row {
  display: flex; align-items: center; gap: 8px;
  background: var(--panel);
  border: 2px solid #333;
  padding: 8px 10px;
}
.lb-row.me { border-color: var(--ok); background: #12331f; }
.lb-rank { width: 30px; color: var(--accent); font-weight: bold; }
.lb-name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lb-country { color: #888; font-size: 11px; }
.lb-score { font-weight: bold; color: var(--accent2); }
.lb-sep { text-align: center; color: #555; }
.lb-empty { color: #777; text-align: center; padding: 20px 0; }

/* ---------- Game Over / Score Card ---------- */
#screen-gameover h2 { color: var(--accent); text-shadow: 3px 3px 0 var(--danger); }
.go-summary { font-size: 14px; text-align: center; line-height: 1.6; }
.go-flavor { font-size: 13px; color: var(--accent2); text-align: center; max-width: 320px; }
#card-canvas {
  width: 162px; /* preview chico; internamente es 1080x1920 */
  aspect-ratio: 9 / 16;
  height: auto;
  border: 2px solid #444;
  image-rendering: auto;
}
