/* =========================================================
   shared/connections.css | PUCK CONNECTIONS · ligas
   Igual que /connections.css (NHL), pero con el color de la
   liga (--neon-blue lo define el header.css de cada sección).
   16 fichas de jugador en una rejilla de 4x4. Los grupos
   acertados suben arriba como barras de color (amarillo,
   verde, azul, morado: de más fácil a más difícil).
   Mismo estilo oscuro y neón que el resto de la web.
   ========================================================= */

.hidden { display: none !important; }

:root {
    --cx-1: #ffd43b;   /* fácil */
    --cx-2: #4ade80;
    --cx-3: #38bdf8;
    --cx-4: #c084fc;   /* difícil */
    --cx-tile: #161d2b;
    --cx-tile-hover: #1d2638;
}

.game-wrapper {
    display: flex; flex-direction: column; align-items: center;
    padding: 0 12px 40px; box-sizing: border-box;
}

/* --- Navegación de días --- */
.daily-nav { display: flex; align-items: center; justify-content: center; gap: 15px; width: 100%; max-width: 420px; margin: 20px 0 6px; }
.btn-nav { padding: 5px 15px; font-size: 1.2rem; border-radius: 8px; cursor: pointer; background: transparent; border: 1px solid var(--neon-blue); color: var(--neon-blue); transition: all .3s; }
.btn-nav:hover:not(:disabled) { background: color-mix(in srgb, var(--neon-blue) 10%, transparent); box-shadow: 0 0 10px var(--neon-blue-glow); }
.btn-nav:disabled { opacity: .3; cursor: not-allowed; border-color: var(--text-secondary); color: var(--text-secondary); }
.day-info { text-align: center; min-width: 170px; }
.day-text { margin: 0; font-size: 1.5rem; font-weight: 900; color: var(--neon-blue); letter-spacing: 2px; text-shadow: 0 0 10px var(--neon-blue-glow); }

.cx-intro { margin: 4px 0 18px; color: var(--text-secondary); font-size: .95rem; text-align: center; }
.cx-intro b { color: #fff; }

/* --- Tablero --- */
.cx-board { width: 100%; max-width: 640px; }
.cx-solved { display: flex; flex-direction: column; gap: 8px; }
.cx-solved:not(:empty) { margin-bottom: 8px; }
.cx-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.cx-loading { grid-column: 1 / -1; padding: 60px 0; text-align: center; color: var(--text-secondary); }

.cx-tile {
    position: relative;
    display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px;
    min-height: 96px; padding: 10px 6px;
    border: 1px solid var(--border-dark); border-radius: 12px;
    background: linear-gradient(180deg, var(--cx-tile-hover), var(--cx-tile));
    color: #fff; font-family: inherit; cursor: pointer;
    transition: transform .12s, background .15s, border-color .15s, box-shadow .15s;
    -webkit-tap-highlight-color: transparent;
}
.cx-tile:hover:not(:disabled) { border-color: color-mix(in srgb, var(--neon-blue) 50%, transparent); }
.cx-tile:active:not(:disabled) { transform: scale(.96); }
.cx-tile:focus-visible { outline: 2px solid var(--neon-blue); outline-offset: 2px; }
.cx-tile:disabled { cursor: default; }

.cx-photo {
    width: 46px; height: 46px; border-radius: 50%; object-fit: cover;
    background: #e8edf3; border: 2px solid #2a3441; flex: none;
}
.cx-photo.broken { visibility: hidden; }
.cx-photo.flag { object-fit: cover; background: #222; }
.cx-name {
    font-size: .82rem; font-weight: 800; line-height: 1.15; text-align: center;
    overflow-wrap: anywhere; text-transform: uppercase; letter-spacing: .2px;
}
.cx-name small { display: block; font-size: .68rem; font-weight: 600; color: var(--text-secondary); text-transform: none; letter-spacing: 0; }

.cx-tile.sel {
    background: var(--neon-blue);
    border-color: var(--neon-blue);
    color: #04141a;
    box-shadow: 0 0 16px var(--neon-blue-glow);
}
.cx-tile.sel .cx-name small { color: #0a3a44; }
.cx-tile.sel .cx-photo { border-color: #04141a; }

/* Animaciones de comprobar y fallar */
.cx-tile.jump { animation: cxJump .32s ease; }
@keyframes cxJump { 40% { transform: translateY(-10px); } }
.cx-grid.shake .cx-tile.sel { animation: cxShake .4s ease; }
@keyframes cxShake {
    20% { transform: translateX(-6px); } 40% { transform: translateX(6px); }
    60% { transform: translateX(-4px); } 80% { transform: translateX(4px); }
}

/* --- Grupo resuelto --- */
.cx-group {
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    min-height: 96px; padding: 12px 14px; border-radius: 12px; text-align: center;
    color: #10131a; animation: cxPop .35s ease;
}
.cx-group[data-lvl="1"] { background: var(--cx-1); }
.cx-group[data-lvl="2"] { background: var(--cx-2); }
.cx-group[data-lvl="3"] { background: var(--cx-3); }
.cx-group[data-lvl="4"] { background: var(--cx-4); }
.cx-group.missed { opacity: .55; }
.cx-group-label { font-size: 1rem; font-weight: 900; text-transform: uppercase; letter-spacing: .5px; }
.cx-group-names { margin-top: 4px; font-size: .85rem; font-weight: 600; }
@keyframes cxPop { from { transform: scale(.94); opacity: .4; } to { transform: scale(1); opacity: 1; } }

/* --- Fallos que quedan (discos) --- */
.cx-mistakes { display: flex; align-items: center; gap: 12px; margin: 18px 0 4px; color: var(--text-secondary); font-size: .9rem; }
.cx-pucks { display: flex; gap: 8px; }
.cx-puck {
    width: 16px; height: 16px; border-radius: 50%;
    background: radial-gradient(circle at 35% 30%, #4b5563, #0b0d12 70%);
    border: 1px solid #5b6474; box-shadow: 0 0 6px var(--neon-blue-glow);
    transition: transform .3s, opacity .3s;
}
.cx-puck.lost { opacity: .15; transform: scale(.6); box-shadow: none; }

/* --- Botones --- */
.cx-actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; margin-top: 14px; }
.cx-btn {
    padding: 11px 22px; border-radius: 999px; cursor: pointer;
    background: transparent; border: 1px solid #c9d1d9; color: #fff;
    font-family: inherit; font-weight: 800; font-size: .9rem; letter-spacing: .3px;
    transition: background .2s, box-shadow .2s, opacity .2s;
}
.cx-btn:hover:not(:disabled) { background: rgba(255, 255, 255, .08); }
.cx-btn.primary { background: var(--neon-blue); border-color: var(--neon-blue); color: #04141a; }
.cx-btn.primary:hover:not(:disabled) { background: var(--neon-blue); box-shadow: 0 0 14px var(--neon-blue-glow); }
.cx-btn:disabled { opacity: .35; cursor: not-allowed; }

/* --- Aviso --- */
.toast {
    position: fixed; left: 50%; top: calc(var(--header-h, 72px) + 16px); transform: translateX(-50%); z-index: 2000;
    background: #fff; color: #0b0d12; padding: 10px 18px; border-radius: 10px;
    font-weight: 800; font-size: .9rem; box-shadow: 0 8px 24px rgba(0, 0, 0, .45);
}

/* --- Resultado --- */
.modal-overlay {
    position: fixed; inset: 0; z-index: 1500; display: flex; align-items: center; justify-content: center;
    padding: 16px; background: rgba(4, 7, 12, .82); backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px);
}
.modal-box {
    position: relative; width: 100%; max-width: 440px; max-height: 92vh; overflow-y: auto;
    padding: 26px 22px 22px; box-sizing: border-box; text-align: center;
    background: #131a26; border: 1px solid var(--border-dark); border-radius: 16px;
    box-shadow: 0 0 30px color-mix(in srgb, var(--neon-blue) 20%, transparent);
}
.modal-close { position: absolute; top: 8px; right: 12px; background: none; border: 0; color: var(--text-secondary); font-size: 1.8rem; cursor: pointer; line-height: 1; }
.modal-close:hover { color: #fff; }
.modal-title { margin: 0 0 6px; font-size: 1.3rem; font-weight: 900; letter-spacing: 2px; text-transform: uppercase; color: var(--neon-blue); }
.modal-verdict { font-size: 1.05rem; font-weight: 800; margin-bottom: 16px; }
.modal-verdict.win { color: var(--cx-2); }
.modal-verdict.lose { color: var(--neon-pink); }

.modal-path { display: inline-flex; flex-direction: column; gap: 4px; margin-bottom: 18px; }
.modal-path .row { display: flex; gap: 4px; }
.modal-path i { width: 26px; height: 26px; border-radius: 6px; }
.modal-path i[data-lvl="1"] { background: var(--cx-1); }
.modal-path i[data-lvl="2"] { background: var(--cx-2); }
.modal-path i[data-lvl="3"] { background: var(--cx-3); }
.modal-path i[data-lvl="4"] { background: var(--cx-4); }

.modal-stats-grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; margin-bottom: 16px; }
.stat-box { display: flex; flex-direction: column; align-items: center; }
.stat-num { font-size: 1.5rem; font-weight: 900; color: #fff; }
.stat-text { font-size: .66rem; color: var(--text-secondary); text-transform: uppercase; letter-spacing: .5px; }
.modal-countdown { margin-bottom: 16px; font-size: .9rem; color: var(--text-secondary); }
.modal-countdown b { color: #fff; font-variant-numeric: tabular-nums; }
.modal-buttons { display: flex; justify-content: center; gap: 10px; flex-wrap: wrap; }

/* --- Cómo se juega --- */
.game-head { padding-top: 6px; }
.faq-section {
    width: 100%; margin: 2rem 0 0; padding: 4rem 2rem; box-sizing: border-box;
    border-top: 1px solid color-mix(in srgb, var(--neon-blue) 20%, transparent); border-bottom: 1px solid color-mix(in srgb, var(--neon-blue) 20%, transparent);
    background: rgba(13, 17, 26, .4);
}
.faq-container { max-width: 800px; margin: 0 auto; text-align: left; }
.faq-title { font-size: 1.6rem; font-weight: 900; color: #fff; margin: 0 0 2rem; letter-spacing: -.5px; }
.faq-title .accent { color: var(--neon-blue); }
.faq-question { font-size: 1.1rem; font-weight: 800; color: var(--neon-blue); margin: 1.8rem 0 .6rem; }
.faq-answer { font-size: .95rem; color: var(--text-secondary); line-height: 1.6; margin: 0; }
.faq-answer strong { color: #fff; }

@media (max-width: 560px) {
    .cx-grid, .cx-solved { gap: 6px; }
    .cx-tile { min-height: 84px; padding: 8px 3px; gap: 4px; border-radius: 10px; }
    .cx-photo { width: 36px; height: 36px; }
    .cx-name { font-size: .64rem; }
    .cx-name small { font-size: .58rem; }
    .cx-group { min-height: 84px; }
    .cx-group-label { font-size: .85rem; }
    .cx-group-names { font-size: .74rem; }
    .cx-btn { padding: 10px 16px; font-size: .82rem; }
    .day-text { font-size: 1.2rem; }
    .modal-stats-grid { grid-template-columns: repeat(3, 1fr); row-gap: 12px; }
    .faq-section { padding: 3rem 1.2rem; }
}

@media (prefers-reduced-motion: reduce) {
    .cx-tile, .cx-group, .cx-puck { animation: none !important; transition: none !important; }
}
