/* ── RESET & BASE ─────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

@import url('https://fonts.googleapis.com/css2?family=Press+Start+2P&family=Nunito:wght@400;700;900&display=swap');

:root {
    --bg:       #0d0d1a;
    --surface:  #1a1a2e;
    --accent:   #4fc3f7;
    --accent2:  #FFD700;
    --danger:   #ef5350;
    --text:     #e8eaf6;
    --text-dim: #7986cb;
    --radius:   14px;
    --shadow:   0 8px 32px rgba(0,0,0,0.5);
}

html, body {
    height: 100%;
    width: 100%;
    overflow: hidden;
}

body {
    font-family: 'Nunito', sans-serif;
    background: var(--bg);
    background-image:
        radial-gradient(ellipse at 20% 20%, rgba(79,195,247,0.08) 0%, transparent 50%),
        radial-gradient(ellipse at 80% 80%, rgba(156,39,176,0.08) 0%, transparent 50%);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text);
}

/* ── PANTALLAS ───────────────────────────── */
.pantalla {
    display: none;
    width: 100%;
    max-width: 420px;
    padding: 28px 24px;
    text-align: center;
    background: var(--surface);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    border: 1px solid rgba(79,195,247,0.15);
    animation: fadeIn 0.3s ease;
}

.pantalla.activa { display: block; }

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(12px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* ── PANTALLA INICIO ─────────────────────── */
.logo-bird {
    font-size: 64px;
    line-height: 1;
    margin-bottom: 12px;
    animation: float 2.5s ease-in-out infinite;
}

@keyframes float {
    0%, 100% { transform: translateY(0); }
    50%       { transform: translateY(-10px); }
}

#pantallaInicio h1 {
    font-family: 'Press Start 2P', monospace;
    font-size: 22px;
    color: var(--accent);
    line-height: 1.5;
    margin-bottom: 28px;
    text-shadow: 0 0 20px rgba(79,195,247,0.5);
}

#pantallaInicio h1 span {
    color: var(--accent2);
}

/* ── PANTALLA PRINCIPAL ──────────────────── */
#pantallaPrincipal h2 {
    font-family: 'Press Start 2P', monospace;
    font-size: 15px;
    color: var(--accent2);
    margin-bottom: 12px;
}

.record-display {
    background: rgba(79,195,247,0.1);
    border: 1px solid rgba(79,195,247,0.25);
    border-radius: 8px;
    padding: 8px 16px;
    font-size: 15px;
    font-weight: 700;
    color: var(--accent2);
    margin-bottom: 20px;
    display: inline-block;
}

#menuNiveles h3 {
    font-size: 13px;
    color: var(--text-dim);
    text-transform: uppercase;
    letter-spacing: 2px;
    margin-bottom: 14px;
}

.niveles-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 8px;
    margin-bottom: 20px;
}

.btn-nivel {
    padding: 10px 4px;
    font-size: 10px;
    font-family: 'Nunito', sans-serif;
    font-weight: 700;
    cursor: pointer;
    border: 1px solid rgba(255,255,255,0.15);
    border-radius: 10px;
    background: linear-gradient(135deg, var(--nivel-top, #87CEEB), var(--nivel-bot, #4fc3f7));
    color: white;
    text-shadow: 0 1px 3px rgba(0,0,0,0.5);
    transition: transform 0.15s, box-shadow 0.15s;
    line-height: 1.4;
}

.btn-nivel:hover {
    transform: translateY(-3px) scale(1.05);
    box-shadow: 0 6px 18px rgba(0,0,0,0.4);
}

.btn-nivel small { display: block; font-size: 8px; opacity: 0.9; }

/* ── PANTALLA JUEGO ──────────────────────── */
#pantallaJuego {
    padding: 12px 12px 14px;
    max-width: 440px;
}

.hud {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 6px 8px;
    margin-bottom: 8px;
    background: rgba(0,0,0,0.3);
    border-radius: 8px;
}

.hud-item {
    font-size: 13px;
    font-weight: 700;
    color: var(--text);
}

.nivel-badge {
    background: rgba(79,195,247,0.2);
    border: 1px solid rgba(79,195,247,0.4);
    border-radius: 6px;
    padding: 2px 8px;
    font-size: 11px;
    color: var(--accent);
}

#juegoCanvasContainer {
    position: relative;
    width: 100%;
    height: 520px;
    border-radius: 10px;
    overflow: hidden;
    border: 2px solid rgba(79,195,247,0.2);
    box-shadow: 0 0 24px rgba(79,195,247,0.1);
}

#juegoCanvas {
    width: 100%;
    height: 100%;
    display: block;
    cursor: pointer;
    touch-action: none;
}

#powerupIndicator {
    position: absolute;
    bottom: 8px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0,0,0,0.6);
    border-radius: 20px;
    padding: 3px 12px;
    font-size: 12px;
    font-weight: 700;
    color: white;
    pointer-events: none;
    min-height: 22px;
    white-space: nowrap;
}

.game-controls {
    display: flex;
    gap: 10px;
    margin-top: 10px;
    justify-content: center;
}

/* ── BOTONES ──────────────────────────────── */
input {
    padding: 12px 16px;
    font-size: 15px;
    font-family: 'Nunito', sans-serif;
    margin: 0 0 16px;
    width: 85%;
    background: rgba(255,255,255,0.07);
    border: 1px solid rgba(79,195,247,0.3);
    border-radius: 10px;
    color: var(--text);
    outline: none;
    transition: border-color 0.2s;
}

input:focus {
    border-color: var(--accent);
    background: rgba(79,195,247,0.08);
}

input::placeholder { color: var(--text-dim); }

.btn-primary, .btn-secondary {
    padding: 12px 28px;
    font-size: 14px;
    font-family: 'Nunito', sans-serif;
    font-weight: 900;
    cursor: pointer;
    border: none;
    border-radius: 10px;
    transition: transform 0.15s, box-shadow 0.15s, background 0.2s;
    letter-spacing: 0.5px;
}

.btn-primary {
    background: linear-gradient(135deg, #4fc3f7, #0288d1);
    color: #0d0d1a;
    box-shadow: 0 4px 16px rgba(79,195,247,0.35);
    display: block;
    width: 85%;
    margin: 0 auto;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(79,195,247,0.5);
}

.btn-secondary {
    background: rgba(255,255,255,0.08);
    color: var(--text);
    border: 1px solid rgba(255,255,255,0.15);
    padding: 9px 18px;
    font-size: 13px;
}

.btn-secondary:hover {
    background: rgba(255,255,255,0.14);
    transform: translateY(-1px);
}

/* ── RESPONSIVE ───────────────────────────── */
@media (max-height: 700px) {
    #juegoCanvasContainer { height: 420px; }
    .pantalla { padding: 18px 16px; }
}

@media (max-width: 380px) {
    .niveles-grid { grid-template-columns: repeat(5, 1fr); gap: 5px; }
    .btn-nivel { font-size: 9px; padding: 8px 2px; }
}

/* ── PANTALLA PRINCIPAL: top bar ─────────── */
.top-bar {
    display: flex;
    justify-content: center;
    gap: 14px;
    margin-bottom: 16px;
    flex-wrap: wrap;
}

.monedas-display {
    background: rgba(255,215,0,0.12);
    border: 1px solid rgba(255,215,0,0.35);
    border-radius: 8px;
    padding: 8px 16px;
    font-size: 15px;
    font-weight: 700;
    color: #FFD700;
    display: inline-block;
}

.menu-acciones {
    display: flex;
    gap: 10px;
    justify-content: center;
    margin-top: 6px;
}

.btn-tienda {
    padding: 10px 22px;
    font-size: 14px;
    font-family: 'Nunito', sans-serif;
    font-weight: 900;
    cursor: pointer;
    border: none;
    border-radius: 10px;
    background: linear-gradient(135deg, #FFD700, #FF8F00);
    color: #1a0800;
    box-shadow: 0 4px 14px rgba(255,183,0,0.35);
    transition: transform 0.15s, box-shadow 0.15s;
    letter-spacing: 0.3px;
}

.btn-tienda:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 22px rgba(255,183,0,0.5);
}

/* ── PANEL TIENDA ─────────────────────────── */
.panel-tienda {
    position: fixed;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0,0,0,0.75);
    z-index: 100;
    backdrop-filter: blur(4px);
    transition: opacity 0.25s ease;
}

.panel-tienda.oculto  { opacity: 0; pointer-events: none; }
.panel-tienda.visible { opacity: 1; pointer-events: all;  }

.panel-tienda > * {
    /* children centered */
}

/* Inner card */
.panel-tienda .tienda-header,
.panel-tienda .skins-list,
.panel-tienda #btnCerrarTienda {
    width: min(92vw, 400px);
}

.tienda-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: var(--surface);
    border: 1px solid rgba(255,215,0,0.25);
    border-bottom: none;
    border-radius: 14px 14px 0 0;
    padding: 14px 18px;
}

.tienda-header h2 {
    font-family: 'Press Start 2P', monospace;
    font-size: 13px;
    color: #FFD700;
    margin: 0;
}

.tienda-monedas {
    font-size: 15px;
    font-weight: 900;
    color: #FFD700;
    background: rgba(255,215,0,0.1);
    border: 1px solid rgba(255,215,0,0.3);
    border-radius: 8px;
    padding: 4px 10px;
}

.skins-list {
    background: var(--surface);
    border-left: 1px solid rgba(255,215,0,0.25);
    border-right: 1px solid rgba(255,215,0,0.25);
    max-height: 54vh;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding: 6px 10px;
}

.skins-list::-webkit-scrollbar { width: 4px; }
.skins-list::-webkit-scrollbar-track { background: transparent; }
.skins-list::-webkit-scrollbar-thumb { background: rgba(255,215,0,0.3); border-radius: 4px; }

/* Skin card */
.skin-card {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 10px 12px;
    border-radius: 10px;
    border: 1px solid rgba(255,255,255,0.07);
    background: rgba(255,255,255,0.04);
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s, transform 0.12s;
}

.skin-card:hover {
    background: rgba(255,255,255,0.09);
    transform: translateX(3px);
}

.skin-card.skin-activa {
    border-color: #FFD700;
    background: rgba(255,215,0,0.1);
}

.skin-card.skin-bloqueada {
    opacity: 0.75;
}

.skin-preview {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    flex-shrink: 0;
    box-shadow: 0 3px 10px rgba(0,0,0,0.4);
}

.skin-info {
    flex: 1;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.skin-nombre {
    font-weight: 700;
    font-size: 14px;
    color: var(--text);
}

.badge-activa       { color: #FFD700; font-weight: 900; font-size: 13px; }
.badge-desbloqueada { color: #81C784; font-weight: 700; font-size: 13px; cursor: pointer; }
.badge-precio       { color: #FFB300; font-weight: 700; font-size: 13px; }

/* Cerrar tienda */
#btnCerrarTienda {
    display: block;
    width: min(92vw, 400px);
    border-radius: 0 0 14px 14px;
    border-top: 1px solid rgba(255,255,255,0.08);
    padding: 12px;
    font-size: 14px;
    background: rgba(255,255,255,0.06);
}

/* ── TOAST ────────────────────────────────── */
.tienda-toast {
    position: fixed;
    bottom: 28px;
    left: 50%;
    transform: translateX(-50%) translateY(20px);
    background: rgba(30,30,50,0.95);
    border: 1px solid rgba(255,215,0,0.4);
    color: white;
    padding: 10px 20px;
    border-radius: 24px;
    font-size: 14px;
    font-weight: 700;
    font-family: 'Nunito', sans-serif;
    pointer-events: none;
    opacity: 0;
    z-index: 200;
    transition: opacity 0.3s ease, transform 0.3s ease;
    white-space: nowrap;
}

.tienda-toast.toast-show {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

/* ── BOTÓN PASE ───────────────────────────── */
.btn-pase {
    padding: 10px 22px;
    font-size: 14px;
    font-family: 'Nunito', sans-serif;
    font-weight: 900;
    cursor: pointer;
    border: none;
    border-radius: 10px;
    background: linear-gradient(135deg, #7E57C2, #4527A0);
    color: white;
    box-shadow: 0 4px 14px rgba(126,87,194,0.4);
    transition: transform 0.15s, box-shadow 0.15s;
    letter-spacing: 0.3px;
}
.btn-pase:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 22px rgba(126,87,194,0.55);
}

/* ── PANEL PASE ───────────────────────────── */
.panel-pase {
    position: fixed;
    inset: 0;
    display: flex;
    align-items: flex-start;
    justify-content: center;
    background: rgba(0,0,0,0.82);
    z-index: 110;
    backdrop-filter: blur(6px);
    overflow-y: auto;
    padding: 20px 0 30px;
    transition: opacity 0.25s ease;
}
.panel-pase.oculto  { opacity: 0; pointer-events: none; }
.panel-pase.visible { opacity: 1; pointer-events: all;  }

.pase-inner {
    width: min(96vw, 420px);
    display: flex;
    flex-direction: column;
    gap: 0;
}

/* Header */
.pase-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: linear-gradient(135deg, #1a0040, #2d006e);
    border: 1px solid rgba(126,87,194,0.5);
    border-bottom: none;
    border-radius: 16px 16px 0 0;
    padding: 14px 16px 12px;
}
.pase-titulo { display: flex; flex-direction: column; gap: 2px; }
.pase-season {
    font-size: 10px;
    font-weight: 700;
    color: rgba(200,170,255,0.7);
    text-transform: uppercase;
    letter-spacing: 2px;
}
.pase-header h2 {
    font-family: 'Press Start 2P', monospace;
    font-size: 11px;
    color: #CE93D8;
    margin: 0;
}
.pase-xp-total {
    display: flex;
    flex-direction: column;
    align-items: center;
    background: rgba(126,87,194,0.25);
    border: 1px solid rgba(126,87,194,0.4);
    border-radius: 10px;
    padding: 6px 12px;
    min-width: 60px;
}
.pase-xp-total span { font-size: 10px; color: rgba(200,170,255,0.7); font-weight: 700; }
.pase-xp-total strong { font-size: 18px; color: #CE93D8; }
.btn-cerrar-pase {
    background: rgba(255,255,255,0.08);
    border: 1px solid rgba(255,255,255,0.15);
    color: white;
    border-radius: 8px;
    padding: 6px 10px;
    cursor: pointer;
    font-size: 14px;
    font-family: 'Nunito', sans-serif;
    transition: background 0.15s;
}
.btn-cerrar-pase:hover { background: rgba(255,255,255,0.16); }

/* Barra XP */
.pase-xp-bar-wrap {
    background: rgba(13,0,30,0.95);
    border-left: 1px solid rgba(126,87,194,0.5);
    border-right: 1px solid rgba(126,87,194,0.5);
    padding: 10px 14px 12px;
}
.pase-xp-label {
    display: flex;
    justify-content: space-between;
    font-size: 12px;
    font-weight: 700;
    color: rgba(200,170,255,0.8);
    margin-bottom: 6px;
}
.pase-xp-bar-bg {
    width: 100%;
    height: 10px;
    background: rgba(255,255,255,0.08);
    border-radius: 10px;
    overflow: hidden;
}
.pase-xp-bar-fill {
    height: 100%;
    border-radius: 10px;
    background: linear-gradient(90deg, #7E57C2, #CE93D8);
    transition: width 0.5s ease;
    box-shadow: 0 0 8px rgba(206,147,216,0.6);
    min-width: 4px;
}

/* Track de recompensas */
.pase-track-wrap {
    background: rgba(10,0,25,0.97);
    border: 1px solid rgba(126,87,194,0.5);
    border-top: none;
    padding: 14px 10px 10px;
    overflow-x: auto;
}
.pase-track-wrap::-webkit-scrollbar { height: 4px; }
.pase-track-wrap::-webkit-scrollbar-thumb { background: rgba(126,87,194,0.4); border-radius: 4px; }

.pase-track {
    display: flex;
    flex-direction: row;
    align-items: flex-start;
    gap: 0;
    width: max-content;
    padding: 0 6px;
}

.pase-col {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    position: relative;
}

/* Número de nivel */
.pase-num {
    font-size: 10px;
    font-weight: 900;
    color: rgba(200,170,255,0.5);
    font-family: 'Press Start 2P', monospace;
    width: 72px;
    text-align: center;
}
.pase-num-actual {
    color: #CE93D8;
    text-shadow: 0 0 8px rgba(206,147,216,0.7);
}

/* Línea conectora */
.pase-linea {
    width: 72px;
    height: 3px;
    background: rgba(255,255,255,0.07);
    border-radius: 2px;
    margin-top: 28px;
    align-self: center;
    position: absolute;
    top: 50px;
    left: 72px;
    z-index: 0;
}
.pase-linea-on {
    background: linear-gradient(90deg, #7E57C2, #CE93D8);
    box-shadow: 0 0 6px rgba(206,147,216,0.4);
}

/* Tarjeta de recompensa */
.pase-card {
    width: 68px;
    min-height: 80px;
    border-radius: 12px;
    border: 1px solid rgba(255,255,255,0.08);
    background: rgba(255,255,255,0.04);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    padding: 8px 4px;
    position: relative;
    transition: transform 0.15s, border-color 0.15s;
    cursor: default;
    z-index: 1;
}
.pase-card-disponible {
    border-color: #CE93D8;
    background: rgba(126,87,194,0.2);
    cursor: pointer;
    animation: pase-pulse 1.8s ease-in-out infinite;
}
.pase-card-disponible:hover { transform: scale(1.08); }

@keyframes pase-pulse {
    0%,100% { box-shadow: 0 0 0   rgba(206,147,216,0.3); }
    50%      { box-shadow: 0 0 14px rgba(206,147,216,0.7); }
}

.pase-card-reclamada {
    border-color: rgba(100,220,100,0.4);
    background: rgba(50,120,50,0.15);
    opacity: 0.7;
}
.pase-card-bloqueada { opacity: 0.38; }
.pase-card-premium   { border-color: rgba(255,193,7,0.4); }

.pase-card-icono  { font-size: 24px; line-height: 1; }
.pase-card-nombre {
    font-size: 8px;
    font-weight: 700;
    color: rgba(220,200,255,0.85);
    text-align: center;
    line-height: 1.3;
    word-break: break-word;
}
.pase-premium-lock {
    font-size: 7px;
    color: #FFD700;
    font-weight: 900;
    background: rgba(255,193,7,0.12);
    border-radius: 4px;
    padding: 1px 4px;
}
.pase-reclamada-check {
    position: absolute;
    top: 4px; right: 5px;
    font-size: 10px;
    color: #81C784;
    font-weight: 900;
}

/* Banner premium */
.pase-premium-banner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: linear-gradient(135deg, rgba(30,10,0,0.9), rgba(60,30,0,0.9));
    border: 1px solid rgba(255,193,7,0.35);
    border-top: none;
    border-radius: 0 0 16px 16px;
    padding: 12px 14px;
    margin-top: 2px;
    gap: 10px;
}
.pase-prem-txt {
    display: flex;
    flex-direction: column;
    gap: 2px;
}
.pase-prem-txt strong { font-size: 13px; color: #FFD700; }
.pase-prem-txt span   { font-size: 11px; color: rgba(255,200,100,0.7); }
.btn-premium {
    padding: 8px 14px;
    font-size: 12px;
    font-family: 'Nunito', sans-serif;
    font-weight: 900;
    border: none;
    border-radius: 8px;
    background: linear-gradient(135deg, #FFD700, #FF8F00);
    color: #1a0800;
    cursor: pointer;
    white-space: nowrap;
    transition: transform 0.12s;
    flex-shrink: 0;
}
.btn-premium:hover { transform: scale(1.05); }
.pase-prem-activo {
    font-size: 13px;
    font-weight: 900;
    color: #FFD700;
    text-align: center;
    width: 100%;
}

/* Hint */
.pase-hint {
    background: rgba(10,0,25,0.97);
    border: 1px solid rgba(126,87,194,0.3);
    border-top: none;
    border-radius: 0 0 16px 16px;
    padding: 8px 14px;
    font-size: 11px;
    color: rgba(180,150,220,0.6);
    text-align: center;
    margin-top: 0;
}

/* Toast pase (un poco más arriba para no solapar) */
.pase-toast { bottom: 70px !important; border-color: rgba(126,87,194,0.5) !important; }

/* ── BOTÓN CARRERA ────────────────────────── */
.btn-carrera {
    padding: 10px 22px;
    font-size: 14px;
    font-family: 'Nunito', sans-serif;
    font-weight: 900;
    cursor: pointer;
    border: none;
    border-radius: 10px;
    background: linear-gradient(135deg, #EF6C00, #BF360C);
    color: white;
    box-shadow: 0 4px 14px rgba(239,108,0,0.4);
    transition: transform 0.15s, box-shadow 0.15s;
    letter-spacing: 0.3px;
}
.btn-carrera:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 22px rgba(239,108,0,0.55);
}
