/* ===========================
   PISTO PLAY — GAME.CSS
   Game Screen — Fully Responsive
   =========================== */

/* ── Page Layout ── */
.game-page {
    min-height: 100dvh;
    display: flex;
    flex-direction: column;
    position: relative;
    overflow-x: hidden;
    overflow-y: auto;
    width: 100%;
}

/* Desktop: center a constrained column */
@media (min-width: 768px) {
    .game-page {
        max-width: 700px;
        margin: 0 auto;
    }

    body {
        display: flex;
        flex-direction: column;
    }
}

/* ── Game Header ── */
.game-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--space-3) var(--space-5);
    position: relative;
    z-index: var(--z-card);
    flex-shrink: 0;
}

@media (min-width: 480px) {
    .game-header { padding: var(--space-4) var(--space-6); }
}

.game-logo {
    font-size: var(--fs-lg);
    font-weight: 900;
    background: linear-gradient(90deg, var(--purple-400), var(--coral-400));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.game-header-right {
    display: flex;
    align-items: center;
    gap: var(--space-2);
}

.mode-badge {
    padding: var(--space-1) var(--space-3);
    border-radius: var(--radius-full);
    font-size: var(--fs-xs);
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    white-space: nowrap;
}

.mode-badge.el-pre {
    background: rgba(124, 58, 237, 0.2);
    color: var(--purple-300);
    border: 1px solid rgba(124, 58, 237, 0.3);
}

.mode-badge.hot {
    background: rgba(249, 115, 22, 0.2);
    color: var(--coral-400);
    border: 1px solid rgba(249, 115, 22, 0.3);
}

.mode-badge.yo-nunca {
    background: rgba(16, 185, 129, 0.15);
    color: #6ee7b7;
    border: 1px solid rgba(16, 185, 129, 0.25);
}

/* ── Progress Section ── */
.game-progress {
    padding: 0 var(--space-5) var(--space-3);
    position: relative;
    z-index: var(--z-base);
    flex-shrink: 0;
}

@media (min-width: 480px) {
    .game-progress { padding: 0 var(--space-6) var(--space-3); }
}

.progress-text {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: var(--space-2);
    font-size: var(--fs-xs);
    color: var(--text-muted);
    font-weight: 500;
}

.progress-count {
    color: var(--text-secondary);
    font-weight: 700;
}

/* ── Player Queue ── */
.player-queue {
    display: flex;
    gap: var(--space-2);
    padding: 0 var(--space-5) var(--space-3);
    overflow-x: auto;
    overflow-y: visible;
    scrollbar-width: none;
    position: relative;
    z-index: var(--z-base);
    flex-shrink: 0;
    padding-top: var(--space-2);
}

.player-queue::-webkit-scrollbar { display: none; }

@media (min-width: 480px) {
    .player-queue { padding-left: var(--space-6); padding-right: var(--space-6); }
}

.queue-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    flex-shrink: 0;
}

.queue-avatar {
    width: 36px;
    height: 36px;
    min-width: 36px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--dark-600), var(--dark-700));
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: var(--fs-xs);
    font-weight: 800;
    color: var(--text-muted);
    border: 2px solid var(--border);
    transition: all var(--transition-base);
    box-sizing: border-box;
}

.queue-item.active .queue-avatar {
    background: linear-gradient(135deg, var(--purple-500), var(--coral-500));
    color: white;
    border-color: var(--purple-400);
    box-shadow: 0 0 14px rgba(124, 58, 237, 0.5);
    transform: scale(1.18);
}

.queue-name {
    font-size: 0.6rem;
    color: var(--text-muted);
    font-weight: 500;
    max-width: 44px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    text-align: center;
}

.queue-item.active .queue-name {
    color: var(--purple-400);
    font-weight: 700;
}

/* ── Current Player ── */
.current-player-section {
    padding: var(--space-2) var(--space-5);
    display: flex;
    align-items: center;
    gap: var(--space-3);
    position: relative;
    z-index: var(--z-base);
    flex-shrink: 0;
    overflow: visible;
}

@media (min-width: 480px) {
    .current-player-section { padding: var(--space-3) var(--space-6); }
}

.player-turn-label {
    font-size: var(--fs-xs);
    color: var(--text-muted);
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    margin-bottom: 2px;
}

.current-player-name {
    font-size: var(--fs-xl);
    font-weight: 800;
    color: var(--text-primary);
    transition: all var(--transition-spring);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: min(200px, 50vw);
}

@media (min-width: 480px) {
    .current-player-name { max-width: 280px; }
}

.player-avatar-lg {
    width: 48px;
    height: 48px;
    min-width: 48px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--purple-500), var(--coral-500));
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: var(--fs-lg);
    font-weight: 900;
    color: white;
    flex-shrink: 0;
    box-shadow:
        0 0 0 3px rgba(124, 58, 237, 0.3),
        0 0 20px rgba(124, 58, 237, 0.2);
    transition: all var(--transition-spring);
    box-sizing: border-box;
}

/* ── Card Area ── */
.card-area {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: var(--space-2) var(--space-4);
    position: relative;
    z-index: var(--z-card);
    min-height: 0;
}

@media (min-width: 480px) {
    .card-area { padding: var(--space-3) var(--space-6) var(--space-2); }
}

/* ── Card Stack Wrapper ── */
.card-stack {
    position: relative;
    width: 100%;
    max-width: 460px;
    padding-bottom: 14px;
}

.card-stack::before,
.card-stack::after {
    content: '';
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    border-radius: var(--radius-xl);
    background: rgba(124, 58, 237, 0.07);
    border: 1px solid rgba(124, 58, 237, 0.12);
    width: calc(100% - 20px);
    height: calc(100% - 14px);
}

.card-stack::before { bottom: 7px; z-index: -1; }
.card-stack::after  { bottom: 0; width: calc(100% - 40px); z-index: -2; opacity: 0.5; }

/* ── Question Card (3D Flip) ── */
.card-scene {
    width: 100%;
    perspective: 1000px;
}

.card-flip {
    position: relative;
    width: 100%;
    height: clamp(260px, 42vh, 320px);
    transition: transform 0.55s cubic-bezier(0.23, 1, 0.32, 1);
    transform-style: preserve-3d;
    cursor: pointer;
}

@media (min-width: 480px) {
    .card-flip { height: clamp(300px, 44vh, 340px); }
}

@media (min-width: 768px) {
    .card-flip { height: 360px; }
}

.card-flip.flipped { transform: rotateY(180deg); }

.card-face {
    position: absolute;
    inset: 0;
    border-radius: var(--radius-xl);
    padding: var(--space-5);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: var(--space-3);
    backface-visibility: hidden;
    -webkit-backface-visibility: hidden;
    text-align: center;
}

@media (min-width: 480px) {
    .card-face { padding: var(--space-6); }
}

/* Card Front */
.card-front {
    background: linear-gradient(145deg, var(--dark-700), var(--dark-800));
    border: 1px solid var(--border-accent);
    box-shadow: var(--shadow-lg), var(--shadow-glow);
}

.card-type-icon {
    font-size: clamp(1.75rem, 5vw, 2.2rem);
    flex-shrink: 0;
    line-height: 1;
    animation: floatBounce 3s ease-in-out infinite;
}

.card-question {
    font-size: var(--fs-lg);
    font-weight: 700;
    line-height: 1.45;
    color: var(--text-primary);
    flex: 1;
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 7;
    line-clamp: 7;
    -webkit-box-orient: vertical;
}

@media (min-width: 480px) {
    .card-question { font-size: var(--fs-xl); }
}

.card-category {
    font-size: var(--fs-xs);
    color: var(--text-muted);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    flex-shrink: 0;
    border-top: 1px solid var(--border);
    width: 100%;
    padding-top: var(--space-2);
    margin-top: auto;
}

/* Card Back */
.card-back {
    background: linear-gradient(145deg, var(--purple-800), var(--purple-900));
    border: 1px solid rgba(167, 139, 250, 0.2);
    transform: rotateY(180deg);
}

.card-back-logo {
    font-size: clamp(2.5rem, 7vw, 3.5rem);
    flex-shrink: 0;
}

.card-back-text {
    font-size: var(--fs-sm);
    color: var(--purple-400);
    font-weight: 600;
}

/* ── Swipe Hint ── */
.swipe-hint {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    color: var(--text-muted);
    font-size: var(--fs-xs);
    margin-top: var(--space-2);
    opacity: 0.65;
    flex-shrink: 0;
}

/* ── Action Buttons ── */
.game-actions {
    padding: var(--space-3) var(--space-4) var(--space-5);
    display: flex;
    flex-direction: column;
    gap: var(--space-3);
    position: relative;
    z-index: var(--z-card);
    flex-shrink: 0;
}

@media (min-width: 480px) {
    .game-actions { padding: var(--space-4) var(--space-6) var(--space-6); }
}

@media (min-width: 768px) {
    .game-actions { padding-bottom: var(--space-8); }
}

.next-btn {
    font-size: var(--fs-lg);
    font-weight: 800;
    padding: var(--space-4) var(--space-6);
    letter-spacing: 0.02em;
    gap: var(--space-3);
    min-height: 54px;
}

@media (min-width: 480px) {
    .next-btn { font-size: var(--fs-xl); padding: var(--space-5); }
}

.next-btn .btn-emoji {
    font-size: var(--fs-xl);
    transition: transform var(--transition-spring);
}

.next-btn:hover .btn-emoji {
    transform: translateX(6px) scale(1.2);
}

.skip-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-2);
    font-size: var(--fs-sm);
    color: var(--text-muted);
    padding: var(--space-3);
    transition: color var(--transition-fast);
    background: none;
    border: none;
    cursor: pointer;
    font-family: var(--font);
    width: 100%;
    min-height: 44px;
    touch-action: manipulation;
}

.skip-btn:hover { color: var(--text-secondary); }

.skip-count {
    background: rgba(255, 255, 255, 0.08);
    padding: 2px 8px;
    border-radius: var(--radius-full);
    font-size: var(--fs-xs);
    font-weight: 700;
}

/* ── Yo Nunca Instruction ── */
.yo-nunca-instruction {
    padding: var(--space-3);
    font-size: var(--fs-sm);
    color: var(--text-muted);
    display: flex;
    align-items: center;
    gap: var(--space-2);
    flex-shrink: 0;
    background: rgba(16, 185, 129, 0.07);
    margin: 0 var(--space-4) var(--space-2);
    border-radius: var(--radius-md);
    border: 1px solid rgba(16, 185, 129, 0.15);
}

@media (min-width: 480px) {
    .yo-nunca-instruction { margin: 0 var(--space-6) var(--space-2); }
}

/* ── End Game Screen ── */
.endgame-screen {
    position: fixed;
    inset: 0;
    background: linear-gradient(145deg, var(--dark-900), var(--purple-900));
    z-index: 99;
    display: none;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: var(--space-6) var(--space-5);
    text-align: center;
    overflow-y: auto;
}

.endgame-screen.show {
    display: flex;
    animation: pageFadeIn 0.5s ease;
}

.endgame-emoji {
    font-size: clamp(3rem, 10vw, 4.5rem);
    margin-bottom: var(--space-4);
    animation: floatBounce 3s ease-in-out infinite;
}

.endgame-title {
    font-size: var(--fs-4xl);
    font-weight: 900;
    margin-bottom: var(--space-3);
    line-height: 1.1;
}

.endgame-subtitle {
    font-size: var(--fs-base);
    color: var(--text-muted);
    margin-bottom: var(--space-6);
    max-width: 300px;
}

.endgame-actions {
    display: flex;
    flex-direction: column;
    gap: var(--space-3);
    width: 100%;
    max-width: 340px;
}

/* Landscape / wide endgame layout */
@media (min-width: 600px) {
    .endgame-actions {
        flex-direction: row;
        justify-content: center;
        gap: var(--space-4);
    }

    .endgame-actions .btn {
        white-space: nowrap;
        flex: 1;
        max-width: 200px;
    }
}

/* ── Stats Row ── */
.stats-row {
    display: flex;
    gap: var(--space-6);
    padding: 0 var(--space-5);
    justify-content: center;
    margin-bottom: var(--space-6);
    flex-wrap: wrap;
}

.stat-item { text-align: center; }

.stat-value {
    font-size: var(--fs-2xl);
    font-weight: 800;
    color: var(--text-primary);
}

.stat-label {
    font-size: var(--fs-xs);
    color: var(--text-muted);
}

/* ── Confetti ── */
.confetti-piece {
    position: fixed;
    pointer-events: none;
    z-index: 999;
    border-radius: 2px;
    animation: confettiFall linear forwards;
}

@keyframes confettiFall {
    0%   { transform: translateY(-20px) rotate(0deg);   opacity: 1; }
    100% { transform: translateY(100vh) rotate(720deg); opacity: 0; }
}

/* ── Player Change Animation ── */
@keyframes playerIn {
    from { opacity: 0; transform: translateX(-16px); }
    to   { opacity: 1; transform: translateX(0); }
}

.player-changing {
    animation: playerIn 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* ── Beta Feedback Buttons ── */
.beta-feedback-container {
    display: flex;
    gap: var(--space-3);
    width: 100%;
}

.feedback-btn {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: var(--space-3) var(--space-2);
    border-radius: var(--radius-lg);
    border: 2px solid transparent;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    font-family: var(--font);
    gap: 4px;
}

.feedback-btn:active {
    transform: scale(0.95);
}

.feedback-btn-emoji {
    font-size: 1.5rem;
}

.feedback-btn-label {
    font-size: 0.75rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

/* Success/Culpable styles */
.feedback-btn-success {
    background: linear-gradient(135deg, rgba(16, 185, 129, 0.1), rgba(16, 185, 129, 0.2));
    border-color: rgba(16, 185, 129, 0.3);
    color: #6ee7b7;
}
.feedback-btn-success:hover {
    background: rgba(16, 185, 129, 0.25);
    border-color: #10b981;
}

/* Fail/Inocente styles */
.feedback-btn-fail {
    background: linear-gradient(135deg, rgba(244, 63, 94, 0.1), rgba(244, 63, 94, 0.2));
    border-color: rgba(244, 63, 94, 0.3);
    color: #fb7185;
}
.feedback-btn-fail:hover {
    background: rgba(244, 63, 94, 0.25);
    border-color: #f43f5e;
}

/* Neutral/Single styles */
.feedback-btn-neutral {
    background: linear-gradient(135deg, var(--purple-500), var(--coral-500));
    color: white;
    border-color: rgba(255, 255, 255, 0.2);
    padding: var(--space-4);
}
.feedback-btn-neutral .feedback-btn-label {
    font-size: var(--fs-base);
}