@import url('https://fonts.googleapis.com/css2?family=Fredoka:wght@400;500;600;700&display=swap');

:root {
  --rosa: #f32876;
  --teal: #10cccc;
  --naranja: #ff8d26;
  --amarillo: #fcac1d;
  --azul: #1056a8;
  --verde: #12a557;
  --rojo: #f21e44;
  --crema: #fdf6ec;
  --blanco: #fff;
  --oscuro: #24201f;
}

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

body {
  font-family: 'Fredoka', sans-serif;
  background: var(--crema);
  color: var(--oscuro);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

body > .landing-page {
  flex: 1;
}

/* ── Papel picado banner ── */
.papel-picado {
  height: 28px;
  width: 100%;
  display: flex;
  overflow: hidden;
}

.papel-picado span {
  flex: 1;
  position: relative;
}

.papel-picado span::after {
  content: '';
  position: absolute;
  bottom: 0; left: 50%;
  transform: translateX(-50%);
  width: 0; height: 0;
  border-left: 12px solid transparent;
  border-right: 12px solid transparent;
  border-top: 10px solid currentColor;
}

.papel-picado .p1 { background: var(--rosa); color: var(--rosa); }
.papel-picado .p2 { background: var(--teal); color: var(--teal); }
.papel-picado .p3 { background: var(--naranja); color: var(--naranja); }
.papel-picado .p4 { background: var(--amarillo); color: var(--amarillo); }
.papel-picado .p5 { background: var(--verde); color: var(--verde); }
.papel-picado .p6 { background: var(--azul); color: var(--azul); }
.papel-picado .p7 { background: var(--rojo); color: var(--rojo); }

/* ── Auth banner ── */
.auth-banner {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 12px;
  padding: 10px 20px;
  background: var(--azul);
  color: white;
  font-size: 14px;
  font-weight: 500;
}

/* ── Buttons ── */
.btn-primary {
  padding: 12px 28px;
  background: var(--rosa);
  color: white;
  border: none;
  border-radius: 50px;
  font-family: inherit;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.15s, box-shadow 0.15s;
  box-shadow: 0 3px 0 #c11a5e;
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 5px 0 #c11a5e;
}

.btn-primary:active {
  transform: translateY(1px);
  box-shadow: 0 1px 0 #c11a5e;
}

.btn-secondary {
  padding: 8px 20px;
  background: var(--teal);
  color: white;
  border: none;
  border-radius: 50px;
  font-family: inherit;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  box-shadow: 0 3px 0 #0b9999;
}

.btn-secondary:hover { transform: translateY(-1px); }

.btn-link {
  background: none;
  border: none;
  color: var(--azul);
  cursor: pointer;
  text-decoration: underline;
  font-family: inherit;
  font-size: 14px;
  font-weight: 500;
}

/* ── Game page layout ── */
.game-page {
  width: 45vw;
  margin: 0 auto;
  padding: 20px;
  text-align: center;
}

/* ── Game header banner ── */
.game-header {
  padding: 32px 20px 28px;
  margin: 0 -20px 24px;
  color: white;
  text-align: center;
  position: relative;
}

.game-header::after {
  content: '';
  position: absolute;
  bottom: -16px;
  left: 0; right: 0;
  height: 16px;
}

.game-header--rosa { background: var(--rosa); }
.game-header--rosa::after {
  background:
    linear-gradient(135deg, var(--rosa) 33.33%, transparent 33.33%) 0 0 / 16px 16px,
    linear-gradient(225deg, var(--rosa) 33.33%, transparent 33.33%) 0 0 / 16px 16px;
}
.game-header--naranja { background: var(--naranja); }
.game-header--naranja::after {
  background:
    linear-gradient(135deg, var(--naranja) 33.33%, transparent 33.33%) 0 0 / 16px 16px,
    linear-gradient(225deg, var(--naranja) 33.33%, transparent 33.33%) 0 0 / 16px 16px;
}
.game-header--verde { background: var(--verde); }
.game-header--verde::after {
  background:
    linear-gradient(135deg, var(--verde) 33.33%, transparent 33.33%) 0 0 / 16px 16px,
    linear-gradient(225deg, var(--verde) 33.33%, transparent 33.33%) 0 0 / 16px 16px;
}

.game-header .icon {
  font-size: 2.5rem;
  margin-bottom: 4px;
}

.game-header h1 {
  color: white;
  font-size: 1.8rem;
  margin-bottom: 4px;
  text-shadow: 2px 2px 0 rgba(0,0,0,0.15);
}

.game-header p {
  color: rgba(255,255,255,0.9);
  font-size: 1rem;
}

.back-link-hero {
  display: inline-block;
  color: rgba(255,255,255,0.85);
  text-decoration: none;
  font-weight: 600;
  font-size: 0.9rem;
  margin-bottom: 10px;
}

.back-link-hero:hover { color: white; }

.game-container {
  background: var(--blanco);
  padding: 30px 20px;
  border-radius: 4px;
  border-left: 6px solid var(--rosa);
  box-shadow: 4px 4px 0 rgba(0, 0, 0, 0.08);
  margin-top: 16px;
  margin-bottom: 24px;
}

.game-container h1 {
  color: var(--azul);
  margin-bottom: 8px;
}

.game-container p {
  margin-bottom: 12px;
  line-height: 1.5;
}

.back-link {
  display: inline-block;
  margin-bottom: 16px;
  color: var(--azul);
  text-decoration: none;
  font-weight: 600;
}

.back-link:hover { text-decoration: underline; }

/* ── Modal ── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 1000;
}

.modal-content {
  background: var(--crema);
  padding: 32px;
  border-radius: 4px;
  border-top: 6px solid var(--amarillo);
  max-width: 380px;
  width: 90%;
  text-align: center;
  box-shadow: 6px 6px 0 rgba(0, 0, 0, 0.1);
}

.modal-content h2 {
  color: var(--azul);
  margin-bottom: 20px;
}

.modal-content input {
  display: block;
  width: 100%;
  padding: 12px;
  margin-bottom: 12px;
  border: 3px solid var(--amarillo);
  border-radius: 4px;
  font-family: inherit;
  font-size: 15px;
  background: var(--blanco);
}

.modal-content input:focus {
  border-color: var(--teal);
  outline: none;
}

.modal-content .btn-primary {
  width: 100%;
  margin-bottom: 12px;
}

.error-text {
  color: var(--rojo);
  font-size: 14px;
}

/* ── Leaderboard ── */
.leaderboard {
  background: var(--blanco);
  padding: 20px;
  border-radius: 4px;
  border-left: 6px solid var(--amarillo);
  box-shadow: 4px 4px 0 rgba(0, 0, 0, 0.08);
}

.leaderboard h3 {
  color: var(--azul);
  margin-bottom: 12px;
  font-size: 1.1rem;
}

.leaderboard table {
  width: 100%;
  border-collapse: collapse;
}

.leaderboard th {
  text-align: left;
  padding: 8px 12px;
  border-bottom: 3px solid var(--naranja);
  color: var(--azul);
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.leaderboard td {
  padding: 10px 12px;
  border-bottom: 1px solid #eee;
}

.leaderboard .rank {
  font-weight: 700;
  color: var(--rosa);
  width: 40px;
}

.leaderboard .points {
  font-weight: 600;
  color: var(--azul);
}

.leaderboard .streak {
  color: var(--verde);
  font-size: 13px;
  font-weight: 600;
}

.empty-state {
  color: #999;
  font-style: italic;
  padding: 20px;
}

/* ── Utilities ── */
.hidden { display: none !important; }

/* ── Landing page ── */
.landing-page {
  max-width: 800px;
  margin: 0 auto;
  padding: 20px;
  text-align: center;
}

.landing-header {
  background: var(--azul);
  margin: 0 -20px 30px;
  padding: 48px 20px 40px;
  position: relative;
}

.landing-header::after {
  content: '';
  position: absolute;
  bottom: -20px;
  left: 0; right: 0;
  height: 20px;
  background:
    linear-gradient(135deg, var(--azul) 33.33%, transparent 33.33%) 0 0 / 20px 20px,
    linear-gradient(225deg, var(--azul) 33.33%, transparent 33.33%) 0 0 / 20px 20px;
  background-position: top left;
}

.landing-header h1 {
  color: var(--amarillo);
  font-size: 2.6rem;
  font-weight: 700;
  line-height: 1.15;
  margin-bottom: 8px;
  text-shadow: 2px 2px 0 rgba(0,0,0,0.2);
}

.landing-header p {
  color: var(--blanco);
  font-size: 1.15rem;
  font-weight: 500;
  opacity: 0.9;
}

.landing-header .subtitle {
  color: var(--teal);
  font-size: 0.95rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  margin-bottom: 8px;
}

.game-cards {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
  margin: 40px 0 30px;
}

.game-card {
  padding: 28px 20px;
  text-decoration: none;
  color: white;
  transition: transform 0.15s, box-shadow 0.15s;
  border-radius: 4px;
  box-shadow: 5px 5px 0 rgba(0, 0, 0, 0.15);
  position: relative;
  overflow: hidden;
}

.game-card::before {
  content: '';
  position: absolute;
  top: -30px; right: -30px;
  width: 80px; height: 80px;
  background: rgba(255,255,255,0.12);
  border-radius: 50%;
}

.game-card:nth-child(1) { background: var(--rosa); }
.game-card:nth-child(2) { background: var(--naranja); }
.game-card:nth-child(3) { background: var(--verde); }

.game-card:hover {
  transform: translate(-2px, -3px);
  box-shadow: 7px 8px 0 rgba(0, 0, 0, 0.18);
}

.game-card:active {
  transform: translate(2px, 2px);
  box-shadow: 2px 2px 0 rgba(0, 0, 0, 0.15);
}

.game-card .icon {
  font-size: 2.8rem;
  margin-bottom: 12px;
}

.game-card h2 {
  color: white;
  font-size: 1.3rem;
  margin-bottom: 6px;
  font-weight: 700;
}

.game-card p {
  color: rgba(255, 255, 255, 0.9);
  font-size: 0.9rem;
  line-height: 1.4;
  font-weight: 400;
}

#global-leaderboard {
  margin-top: 30px;
}

/* ── Responsive ── */
@media (max-width: 600px) {
  .game-cards {
    grid-template-columns: 1fr;
  }

  .landing-header h1 {
    font-size: 1.8rem;
  }

  .landing-header {
    padding: 32px 16px 28px;
  }
}
