/* ============================================================
   PARCHÍS SOCIAL — estilos
   ============================================================ */

.ps-overlay {
    position: fixed;
    inset: 0;
    z-index: 8500;
    display: none;
    align-items: center;
    justify-content: center;
    background: #000;
    font-family: 'Outfit', sans-serif;
    overflow: hidden;
}

/* Fondo difuminado — la misma imagen, ampliada y oscurecida, rellenando
   cualquier espacio que quede fuera de la pantalla con proporción fija.
   Misma técnica que usan YouTube/Netflix con video que no llena todo. */
.ps-overlay::before {
    content: '';
    position: absolute;
    inset: -5%;
    background-image: var(--ps-bg-url, none);
    background-size: cover;
    background-position: center;
    filter: blur(40px) brightness(.45);
    z-index: 0;
}

.ps-screen {
    position: relative;
    z-index: 1;
    /* FIX: el contenedor completo (imagen + botones) mantiene SIEMPRE la
       proporción exacta de Inicio.png (1672×941) — así, sin importar el
       tamaño o forma de la pantalla, la imagen y los botones invisibles
       se escalan juntos, como una sola pieza, nunca se desalinean. */
    aspect-ratio: 1672 / 941;
    width: 100%;
    height: 100%;
    max-width: 100vw;
    max-height: 100vh;
    overflow: hidden;
    box-shadow: 0 0 60px rgba(0,0,0,.6);
}

.ps-bg-image {
    width: 100%;
    height: 100%;
    object-fit: fill; /* el contenedor ya tiene la proporción exacta — esto solo evita redondeos de sub-píxel */
    display: block;
    user-select: none;
    -webkit-user-drag: none;
}

/* Zona de toque invisible — posicionada en % sobre la imagen */
.ps-hit {
    position: absolute;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
}
/* Durante desarrollo, descomenta esto para VER las zonas de toque:
.ps-hit { background: rgba(255,0,0,.18); border: 1px solid rgba(255,0,0,.5); }
*/

/* ── Perfil (overlay con datos reales, encima del rostro genérico) ── */
.ps-profile-hit { display: flex; align-items: center; pointer-events: none; }
.ps-profile-overlay {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    height: 100%;
    padding: 0 3% 0 1.5%;
    pointer-events: auto;
    box-sizing: border-box;
}
.ps-avatar-wrap { position: relative; flex-shrink: 0; width: 22%; aspect-ratio: 1; }
/* FIX: capa sólida primero, ocultando el rostro genérico dibujado en la
   imagen — la foto de perfil real se dibuja encima de esta capa. */
.ps-avatar-bg-layer {
    position: absolute; inset: 0; border-radius: 50%;
    background: linear-gradient(135deg, #1a1230, #0c0a1a);
    z-index: 1;
}
.ps-avatar-img, .ps-avatar-fallback {
    width: 100%; height: 100%; border-radius: 50%; object-fit: cover;
    position: relative; z-index: 2;
    /* Corrida levemente a la derecha para centrar mejor sobre el espacio
       donde estaba el rostro genérico de la imagen original. */
    transform: translateX(8%);
}
.ps-avatar-fallback {
    background: linear-gradient(135deg, #6a1fa8, #c639b8);
    display: flex; align-items: center; justify-content: center;
    color: #fff; font-weight: 800; font-size: clamp(14px, 2vw, 22px);
}
.ps-level-badge {
    position: absolute; bottom: -6%; right: -6%; z-index: 3;
    background: linear-gradient(135deg, #ffd76a, #ff9d2f);
    color: #2a1500; font-weight: 900; font-size: clamp(9px, 1.1vw, 13px);
    width: 28%; height: 28%; min-width: 18px; min-height: 18px;
    border-radius: 50%; display: flex; align-items: center; justify-content: center;
    border: 2px solid #1a0a2e;
}
.ps-profile-info { flex: 1; min-width: 0; color: #fff; }
.ps-profile-name {
    font-weight: 800; font-size: clamp(10px, 1.3vw, 16px);
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.ps-profile-level { font-size: clamp(8px, 1vw, 12px); color: rgba(255,255,255,.55); margin-bottom: 3px; }
.ps-xp-bar { height: 5px; background: rgba(255,255,255,.15); border-radius: 3px; overflow: hidden; }
.ps-xp-fill { height: 100%; background: linear-gradient(90deg, #6a1fa8, #c639b8); border-radius: 3px; transition: width .6s; }

/* ── Contadores de monedas/diamantes (texto real encima de la imagen) ── */
.ps-coin-counter, .ps-diamond-counter {
    pointer-events: none;
    display: flex; align-items: center; justify-content: center;
    color: #fff; font-weight: 800; font-size: clamp(10px, 1.3vw, 15px);
    text-shadow: 0 1px 3px rgba(0,0,0,.6);
}

/* ── Panel de jugadores en línea ── */
.ps-online-panel { position: absolute; pointer-events: none; }
.ps-online-list {
    pointer-events: auto;
    height: 100%; overflow-y: auto; padding: 14% 6% 0;
    box-sizing: border-box;
}
.ps-online-row {
    display: flex; align-items: center; gap: 8px;
    padding: 6px 4px; cursor: pointer; border-radius: 8px;
    transition: background .15s;
}
.ps-online-row:hover, .ps-online-row:active { background: rgba(255,255,255,.06); }
.ps-online-avatar { width: 26px; height: 26px; border-radius: 50%; object-fit: cover; background: rgba(255,255,255,.1); flex-shrink: 0; }
.ps-online-name { flex: 1; color: #fff; font-size: clamp(9px, 1vw, 12px); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ps-online-dot { width: 7px; height: 7px; border-radius: 50%; background: #22c55e; flex-shrink: 0; box-shadow: 0 0 5px #22c55e; }
.ps-online-empty { color: rgba(255,255,255,.4); font-size: 11px; text-align: center; padding: 20px 8px; }
.ps-spinner {
    width: 22px; height: 22px; margin: 30px auto;
    border: 3px solid rgba(255,255,255,.15); border-top-color: #c639b8; border-radius: 50%;
    animation: psSpin .8s linear infinite;
}
@keyframes psSpin { to { transform: rotate(360deg); } }

/* ── Cofre — animación al abrir ── */
@keyframes psChestShake {
    0%, 100% { transform: scale(1) rotate(0deg); }
    20%      { transform: scale(1.05) rotate(-4deg); }
    40%      { transform: scale(1.05) rotate(4deg); }
    60%      { transform: scale(1.1) rotate(-3deg); }
    80%      { transform: scale(1.1) rotate(3deg); }
}
.ps-chest-opening { animation: psChestShake .5s ease-in-out; }

.ps-reward-burst {
    position: fixed; inset: 0; z-index: 9000;
    display: flex; align-items: center; justify-content: center;
    background: rgba(0,0,0,.55);
    animation: psFadeIn .2s ease;
}
.ps-reward-burst-inner { text-align: center; animation: psRewardPop .6s cubic-bezier(.34,1.56,.64,1); }
.ps-reward-burst-icon { font-size: 72px; filter: drop-shadow(0 0 30px rgba(255,215,100,.8)); }
.ps-reward-burst-text {
    font-size: 24px; font-weight: 900; color: #fff; margin-top: 10px;
    text-shadow: 0 2px 10px rgba(0,0,0,.5);
}
@keyframes psRewardPop { 0% { transform: scale(0); opacity: 0; } 60% { transform: scale(1.15); opacity: 1; } 100% { transform: scale(1); } }
@keyframes psFadeIn { from { opacity: 0; } to { opacity: 1; } }

/* ── Modal genérico ── */
.ps-modal-overlay {
    position: fixed; inset: 0; z-index: 8900;
    background: rgba(0,0,0,.65); backdrop-filter: blur(6px);
    display: flex; align-items: center; justify-content: center;
    padding: 20px;
}
.ps-modal {
    background: linear-gradient(165deg, rgba(20,12,35,.98), rgba(7,2,15,.98));
    border: 1px solid rgba(198,57,184,.25);
    border-radius: 20px;
    max-width: 480px; width: 100%; max-height: 80vh; overflow-y: auto;
    color: #fff; position: relative;
}
.ps-modal-header {
    display: flex; align-items: center; justify-content: space-between;
    padding: 16px 18px; font-weight: 800; font-size: 15px;
    border-bottom: 1px solid rgba(255,255,255,.08);
}
.ps-modal-header button, .ps-modal-close-x {
    background: rgba(255,255,255,.08); border: none; color: #fff;
    width: 28px; height: 28px; border-radius: 50%; font-size: 16px; cursor: pointer;
}
.ps-modal-close-x { position: absolute; top: 12px; right: 12px; z-index: 2; }
.ps-modal-body { padding: 18px; }

/* ── Grid de jugadores (ver todos) ── */
.ps-grid-players { display: grid; grid-template-columns: repeat(auto-fill, minmax(90px, 1fr)); gap: 12px; }
.ps-player-card {
    display: flex; flex-direction: column; align-items: center; gap: 6px;
    background: rgba(255,255,255,.04); border-radius: 12px; padding: 12px 6px;
    cursor: pointer; transition: background .15s;
}
.ps-player-card:hover { background: rgba(198,57,184,.12); }
.ps-player-card-avatar { width: 48px; height: 48px; border-radius: 50%; object-fit: cover; background: rgba(255,255,255,.1); }
.ps-player-card-name { font-size: 11px; text-align: center; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }

/* ── Tarjeta de presentación ── */
.ps-pcard { text-align: center; padding: 6px; }
.ps-pcard-avatar { width: 84px; height: 84px; border-radius: 50%; object-fit: cover; border: 3px solid rgba(198,57,184,.4); margin-bottom: 10px; }
.ps-pcard-name { font-size: 18px; font-weight: 800; }
.ps-pcard-level { font-size: 12px; color: #c639b8; margin-bottom: 14px; }
.ps-pcard-stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin-bottom: 16px; }
.ps-pcard-stats div { background: rgba(255,255,255,.05); border-radius: 10px; padding: 10px 4px; font-size: 13px; font-weight: 700; }
.ps-pcard-stats span { font-size: 16px; display: block; margin-bottom: 4px; }

.ps-btn {
    width: 100%; padding: 12px; border-radius: 12px; border: none;
    font-weight: 700; font-size: 14px; cursor: pointer; font-family: inherit;
}
.ps-btn-primary { background: linear-gradient(135deg, #6a1fa8, #c639b8); color: #fff; }

/* ── Menú ── */
.ps-menu-list { display: flex; flex-direction: column; gap: 4px; }
.ps-menu-item {
    display: flex; align-items: center; gap: 10px;
    background: rgba(255,255,255,.04); border: none; color: #fff;
    padding: 14px; border-radius: 12px; font-size: 14px; cursor: pointer; font-family: inherit;
    text-align: left;
}
.ps-menu-item:hover { background: rgba(239,68,68,.15); }

/* ── Tienda ── */
.ps-discount-banner {
    background: linear-gradient(135deg, #ffd76a, #ff9d2f); color: #2a1500;
    font-weight: 800; font-size: 12px; text-align: center;
    padding: 8px; border-radius: 10px; margin-bottom: 14px;
}
.ps-store-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); gap: 10px; }
.ps-store-card {
    background: rgba(255,255,255,.04); border: 1px solid rgba(255,255,255,.08);
    border-radius: 14px; padding: 14px 8px; text-align: center; cursor: pointer;
    transition: transform .15s, border-color .15s;
}
.ps-store-card:hover { border-color: rgba(198,57,184,.5); transform: translateY(-2px); }
.ps-store-icon { font-size: 26px; margin-bottom: 6px; }
.ps-store-amount { font-size: 13px; font-weight: 800; margin-bottom: 4px; }
.ps-store-price-old { font-size: 10px; color: rgba(255,255,255,.4); text-decoration: line-through; }
.ps-store-price { font-size: 12px; font-weight: 700; color: #4ade80; }

/* ══════════════════════════════════════════════════════════════
   FASE 2 — Invitar amigos / equipo
   ══════════════════════════════════════════════════════════════ */

/* ── Panel de amigos conectados (versión grande de la pantalla de invitar) ── */
.ps-friends-online-panel { position: absolute; pointer-events: none; }
.ps-friends-online-panel > div { pointer-events: auto; height: 100%; overflow-y: auto; padding: 6px; box-sizing: border-box; }

/* ── Tarjetas de equipo — se sobreponen exactamente sobre los "+" de la imagen ── */
.ps-team-card {
    position: absolute;
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    gap: 4px; pointer-events: none;
}
.ps-team-card-me { pointer-events: none; }
.ps-team-avatar {
    width: 44%; aspect-ratio: 1; border-radius: 50%; object-fit: cover;
    background: rgba(255,255,255,.1); border: 2px solid rgba(198,57,184,.5);
}
.ps-team-name {
    color: #fff; font-size: clamp(9px, 1vw, 12px); font-weight: 700;
    text-align: center; max-width: 90%; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
    text-shadow: 0 1px 3px rgba(0,0,0,.6);
}
.ps-team-status { color: #4ade80; font-size: clamp(7px, .8vw, 10px); }
.ps-team-remove {
    position: absolute; top: -4px; right: 8%; pointer-events: auto;
    width: 20px; height: 20px; border-radius: 50%; border: none;
    background: rgba(239,68,68,.85); color: #fff; font-size: 13px; cursor: pointer;
    display: flex; align-items: center; justify-content: center; z-index: 2;
}
.ps-team-empty {
    display: flex; align-items: center; justify-content: center;
}
.ps-team-plus {
    color: rgba(255,255,255,.55); font-size: clamp(20px, 2.6vw, 32px); font-weight: 300;
    pointer-events: none;
}

/* ── Insignia en forma de estrella (pantalla Modo de Juego) ── */
.ps-star-badge {
    position: absolute; bottom: -10%; right: -14%; z-index: 3;
    width: 46%; aspect-ratio: 1;
    background: linear-gradient(135deg, #ffd76a, #ff9d2f);
    clip-path: polygon(50% 0%, 61% 35%, 98% 35%, 68% 57%, 79% 91%, 50% 70%, 21% 91%, 32% 57%, 2% 35%, 39% 35%);
    display: flex; align-items: center; justify-content: center;
}
.ps-star-badge span {
    color: #2a1500; font-weight: 900; font-size: clamp(9px, 1vw, 13px);
    transform: translateY(8%);
}

.ps-team-hint {
    position: absolute; display: flex; align-items: center; justify-content: center;
    gap: 6px; color: #ffd76a; font-size: clamp(9px, 1.1vw, 12px); font-weight: 700;
    text-align: center; pointer-events: none; text-shadow: 0 1px 4px rgba(0,0,0,.7);
    padding: 0 4%;
}
.ps-start-now-btn {
    background: linear-gradient(135deg, #1faa59, #16c172);
    border-radius: 16px; display: flex; align-items: center; justify-content: center;
    color: #fff; font-weight: 800; font-size: clamp(11px, 1.4vw, 16px);
    animation: psStartPulse 1.6s ease-in-out infinite;
    box-shadow: 0 6px 24px rgba(31,170,89,.5);
}
@keyframes psStartPulse { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.04); } }

.ps-mode-btn {
    display: flex; align-items: center; justify-content: center;
    background: rgba(255,255,255,.08); border-radius: 12px;
    color: #fff; font-size: clamp(9px, 1vw, 12px); font-weight: 700;
}
.ps-ai-btn {
    display: flex; align-items: center; justify-content: center; gap: 6px;
    background: rgba(106,31,168,.25); border-radius: 12px; border: 1px solid rgba(198,57,184,.4);
    color: #fff; font-size: clamp(9px, 1vw, 12px); font-weight: 700;
}

/* Transición entre modos */
.ps-mode-transition { animation: psModeSwitch .3s ease; }
@keyframes psModeSwitch { 0% { opacity: 1; } 50% { opacity: .3; transform: scale(.98); } 100% { opacity: 1; } }

/* ── Buscador ── */
.ps-search-input {
    width: 100%; padding: 12px 14px; border-radius: 12px;
    background: rgba(255,255,255,.06); border: 1px solid rgba(255,255,255,.12);
    color: #fff; font-size: 14px; font-family: inherit; box-sizing: border-box;
}
.ps-search-row {
    display: flex; align-items: center; gap: 10px; padding: 8px 4px;
    border-bottom: 1px solid rgba(255,255,255,.06);
}
.ps-friend-tag {
    font-size: 9px; background: rgba(76,175,80,.2); color: #4ade80;
    padding: 2px 6px; border-radius: 6px; font-weight: 700;
}
.ps-btn-mini {
    background: linear-gradient(135deg, #6a1fa8, #c639b8); border: none; color: #fff;
    font-size: 11px; font-weight: 700; padding: 7px 12px; border-radius: 10px; cursor: pointer;
    flex-shrink: 0; font-family: inherit;
}

/* ── Mi código ── */
.ps-code-display {
    font-size: 28px; font-weight: 900; letter-spacing: 4px; color: #fff;
    background: rgba(255,255,255,.06); border-radius: 12px; padding: 10px;
}
.ps-input-label { display: block; font-size: 11px; color: rgba(255,255,255,.5); margin-bottom: 6px; }

/* ── Selector de modo ── */
.ps-mode-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
.ps-mode-option {
    background: rgba(255,255,255,.04); border: 2px solid rgba(255,255,255,.08);
    border-radius: 14px; padding: 18px 10px; cursor: pointer; color: #fff;
    display: flex; flex-direction: column; align-items: center; gap: 6px;
    transition: all .15s; font-family: inherit;
}
.ps-mode-option:hover { transform: translateY(-2px); }
.ps-mode-option-active { border-color: #c639b8; background: rgba(198,57,184,.15); }
.ps-mode-option-icon { font-size: 22px; font-weight: 900; color: #c639b8; }
.ps-mode-option-label { font-size: 13px; font-weight: 700; }

/* ── Aviso emergente — solicitudes / invitaciones, encima de todo ── */
.ps-incoming-popup {
    position: fixed; top: 16px; left: 50%; transform: translateX(-50%);
    z-index: 9999; animation: psIncomingSlide .3s ease;
}
@keyframes psIncomingSlide { from { transform: translate(-50%, -30px); opacity: 0; } to { transform: translateX(-50%); opacity: 1; } }
.ps-incoming-box {
    background: linear-gradient(165deg, rgba(20,12,35,.98), rgba(7,2,15,.98));
    border: 1px solid rgba(198,57,184,.4); border-radius: 16px; padding: 16px 18px;
    color: #fff; min-width: 260px; max-width: 90vw; box-shadow: 0 10px 40px rgba(0,0,0,.5);
    font-family: 'Outfit', sans-serif;
}
.ps-incoming-title { font-weight: 800; font-size: 14px; margin-bottom: 4px; }
.ps-incoming-msg { font-size: 12px; color: rgba(255,255,255,.7); }

