/* ========== FUENTES ========== */
@import url('https://fonts.googleapis.com/css2?family=Poppins:wght@300;400;500;600;700;800&family=Roboto+Slab:wght@400;500;600;700&display=swap');

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary-font: 'Poppins', sans-serif;
    --heading-font: 'Roboto Slab', serif;
    --primary-color: #667eea;
    --primary-dark: #5a67d8;
    --secondary-color: #764ba2;
    --success-color: #48bb78;
    --danger-color: #f56565;
    --warning-color: #ed8936;
    --info-color: #4299e1;
    --light-color: #f7fafc;
    --dark-color: #2d3748;
    --gray-color: #a0aec0;
    --border-radius: 12px;
    --box-shadow: 0 10px 25px rgba(0, 0, 0, 0.1);
    --transition: all 0.3s ease;
}

body {
    font-family: var(--primary-font);
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    padding: 20px;
    color: var(--dark-color);
    overflow-x: hidden;
}

h1,
h2,
h3,
h4,
h5,
h6 {
    font-family: var(--heading-font);
    font-weight: 600;
}

.screen {
    background: white;
    border-radius: var(--border-radius);
    padding: 30px;
    max-width: 1200px;
    margin: 20px auto;
    box-shadow: var(--box-shadow);
    min-height: 85vh;
}

.hidden {
    display: none !important;
}

.container {
    max-width: 1000px;
    margin: 0 auto;
}

/* ========== PANTALLA DE INICIO ========== */
.logo {
    text-align: center;
    margin-bottom: 40px;
    padding-bottom: 20px;
    border-bottom: 2px solid var(--light-color);
}

.logo h1 {
    font-family: var(--heading-font);
    font-weight: 700;
    color: var(--primary-color);
    font-size: 2.8em;
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 15px;
}

.logo .subtitle {
    color: var(--gray-color);
    font-size: 1.1em;
}

.form-card {
    background: var(--light-color);
    border-radius: var(--border-radius);
    padding: 30px;
    margin-bottom: 30px;
}

.form-group {
    margin-bottom: 25px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: var(--dark-color);
    display: flex;
    align-items: center;
    gap: 8px;
}

.form-group input,
.form-group select {
    width: 100%;
    padding: 14px 20px;
    border: 2px solid #e2e8f0;
    border-radius: 8px;
    font-size: 16px;
    transition: var(--transition);
    background: white;
}

.form-group input:focus,
.form-group select:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.button-group {
    display: flex;
    gap: 15px;
    margin-top: 30px;
    flex-wrap: wrap;
}

.button-group button {
    flex: 1;
    min-width: 200px;
}

@media (max-width: 768px) {
    .button-group {
        flex-direction: column;
    }

    .button-group button {
        min-width: 100%;
    }
}

.btn-primary,
.btn-secondary,
.btn-success,
.btn-danger,
.btn-warning,
.btn-action,
.btn-small,
.btn-tiny {
    padding: 14px 28px;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    flex: 1;
}

.btn-primary {
    background: var(--primary-color);
    color: white;
}

.btn-primary:hover {
    background: var(--primary-dark);
    transform: translateY(-2px);
    box-shadow: 0 7px 20px rgba(102, 126, 234, 0.3);
}

.btn-secondary {
    background: var(--light-color);
    color: var(--dark-color);
    border: 2px solid #e2e8f0;
}

.btn-secondary:hover {
    background: #e2e8f0;
    transform: translateY(-2px);
}

.btn-success {
    background: var(--success-color);
    color: white;
}

.btn-success:hover {
    background: #38a169;
    transform: translateY(-2px);
    box-shadow: 0 7px 20px rgba(72, 187, 120, 0.3);
}

.btn-danger {
    background: var(--danger-color);
    color: white;
}

.btn-danger:hover {
    background: #e53e3e;
    transform: translateY(-2px);
    box-shadow: 0 7px 20px rgba(245, 101, 101, 0.3);
}

.btn-warning {
    background: var(--warning-color);
    color: white;
}

.btn-warning:hover {
    background: #dd6b20;
    transform: translateY(-2px);
    box-shadow: 0 7px 20px rgba(237, 137, 54, 0.3);
}

.btn-small {
    padding: 8px 16px;
    font-size: 14px;
    flex: 0 0 auto;
}

.btn-tiny {
    padding: 5px 10px;
    font-size: 12px;
    flex: 0 0 auto;
}

/* ========== SALA DE ESPERA ========== */
.lobby-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
    padding-bottom: 20px;
    border-bottom: 2px solid var(--light-color);
}

.lobby-header h2 {
    color: var(--dark-color);
    display: flex;
    align-items: center;
    gap: 10px;
}

.room-id {
    background: var(--primary-color);
    color: white;
    padding: 5px 15px;
    border-radius: 20px;
    font-family: monospace;
    font-size: 1.2em;
}

.player-list-card {
    background: var(--light-color);
    border-radius: var(--border-radius);
    padding: 25px;
    margin-bottom: 30px;
}

.player-list-card h3 {
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.player-list {
    list-style: none;
    margin-bottom: 20px;
}

.player-list li {
    background: white;
    padding: 15px 20px;
    margin: 10px 0;
    border-radius: 8px;
    border-left: 4px solid var(--primary-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    transition: var(--transition);
}

.player-list li:hover {
    transform: translateX(5px);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
}

.player-list li .player-name {
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 10px;
}

.waiting-message {
    background: #e8f4fd;
    border: 1px dashed var(--info-color);
    border-radius: 8px;
    padding: 20px;
    text-align: center;
    color: var(--info-color);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

/* ========== CONTROLES DEL LOBBY ========== */
.lobby-controls {
    display: flex;
    gap: 15px;
    margin-top: 20px;
    flex-wrap: wrap;
}

.lobby-controls button {
    flex: 1;
    min-width: 200px;
}

@media (max-width: 768px) {
    .lobby-controls {
        flex-direction: column;
    }

    .lobby-controls button {
        min-width: 100%;
    }
}

/* ========== PANTALLA DE JUEGO ========== */
.game-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 20px;
    background: var(--light-color);
    border-radius: var(--border-radius);
    margin-bottom: 25px;
}

.game-info {
    display: flex;
    gap: 30px;
    flex-wrap: wrap;
}

.info-item {
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--dark-color);
}

.highlight {
    font-weight: 600;
    color: var(--primary-color);
    background: white;
    padding: 3px 10px;
    border-radius: 15px;
    border: 1px solid #e2e8f0;
}

.game-container {
    display: grid;
    grid-template-columns: 1fr 1fr;
    grid-template-rows: auto auto auto;
    gap: 25px;
    height: calc(85vh - 100px);
}

.center-area {
    grid-column: 1 / -1;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 25px;
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    border-radius: var(--border-radius);
    gap: 30px;
}

.deck-container {
    display: flex;
    gap: 30px;
    align-items: center;
}

.deck {
    width: 130px;
    height: 180px;
    background: white;
    border-radius: 12px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
    transition: var(--transition);
    position: relative;
    border: 3px solid var(--primary-color);
}

.deck:hover {
    transform: translateY(-8px) scale(1.05);
    box-shadow: 0 15px 35px rgba(102, 126, 234, 0.3);
}

.deck-count {
    font-size: 2.5em;
    font-weight: 800;
    color: var(--primary-color);
    margin-bottom: 10px;
}

.deck-label {
    font-weight: 600;
    color: var(--dark-color);
    font-size: 1.1em;
}

.discard-pile {
    width: 130px;
    height: 180px;
    background: #f8f9fa;
    border-radius: 12px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    border: 3px dashed #cbd5e0;
}

.discard-count {
    font-size: 2em;
    font-weight: 600;
    color: var(--gray-color);
    margin-bottom: 10px;
}

.discard-label {
    font-weight: 600;
    color: var(--gray-color);
}

.turn-indicator {
    background: var(--primary-color);
    color: white;
    padding: 20px 40px;
    border-radius: 50px;
    font-weight: 700;
    font-size: 1.2em;
    display: flex;
    align-items: center;
    gap: 15px;
    min-width: 300px;
    text-align: center;
    justify-content: center;
    transition: var(--transition);
}

.turn-indicator.my-turn {
    background: var(--success-color);
    animation: pulse 2s infinite;
    box-shadow: 0 0 30px rgba(72, 187, 120, 0.4);
}

@keyframes pulse {
    0% {
        box-shadow: 0 0 0 0 rgba(72, 187, 120, 0.7);
    }

    70% {
        box-shadow: 0 0 0 20px rgba(72, 187, 120, 0);
    }

    100% {
        box-shadow: 0 0 0 0 rgba(72, 187, 120, 0);
    }
}

.game-stats {
    display: flex;
    gap: 30px;
}

.stat {
    text-align: center;
    min-width: 100px;
}

.stat-value {
    font-size: 2.5em;
    font-weight: 800;
    color: var(--primary-color);
    margin-bottom: 5px;
}

.stat-label {
    font-size: 0.9em;
    color: var(--gray-color);
    font-weight: 600;
}

/* ========== CARTAS EN HORIZONTAL ========== */
.cards-horizontal {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    justify-content: flex-start;
    align-items: center;
    min-height: 100px;
    width: 100%;
    padding: 10px;
    background: #f8f9fa;
    border-radius: 8px;
    overflow-x: auto;
    overflow-y: hidden;
}

.card {
    width: 60px;
    height: 85px;
    background: white;
    border-radius: 8px;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 1.8em;
    font-weight: 800;
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.15);
    border: 3px solid;
    transition: all 0.2s;
    flex-shrink: 0;
    user-select: none;
    position: relative;
}

.card:hover {
    transform: translateY(-5px) scale(1.05);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.2);
    z-index: 10;
}

/* Colores según valor */
.card[data-value="1"] {
    border-color: #ff6b6b;
    color: #ff6b6b;
}

.card[data-value="2"] {
    border-color: #4ecdc4;
    color: #4ecdc4;
}

.card[data-value="3"] {
    border-color: #ffd166;
    color: #ffd166;
}

.card[data-value="4"] {
    border-color: #06d6a0;
    color: #06d6a0;
}

.card[data-value="5"] {
    border-color: #118ab2;
    color: #118ab2;
}

.card[data-value="6"] {
    border-color: #ef476f;
    color: #ef476f;
}

.card[data-value="7"] {
    border-color: #073b4c;
    color: #073b4c;
}

.card[data-value="8"] {
    border-color: #7209b7;
    color: #7209b7;
}

.card[data-value="9"] {
    border-color: #f3722c;
    color: #f3722c;
}

.card[data-value="10"] {
    border-color: #90be6d;
    color: #90be6d;
}

/* Animación para cartas nuevas */
@keyframes cardAppear {
    0% {
        transform: scale(0.5) rotate(-10deg);
        opacity: 0;
    }

    70% {
        transform: scale(1.1) rotate(5deg);
        opacity: 1;
    }

    100% {
        transform: scale(1) rotate(0deg);
        opacity: 1;
    }
}

.new-card {
    animation: cardAppear 0.5s ease-out;
}

/* ========== ESTILOS PARA ROBO ========== */
.steal-actions {
    margin-top: 10px;
    padding: 10px;
    background: #fff8e1;
    border-radius: 8px;
    border: 2px dashed #ffd700;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.steal-all-btn {
    background: linear-gradient(135deg, #ffd700 0%, #ffed4e 100%);
    color: #805500;
    border: none;
    padding: 10px 15px;
    border-radius: 20px;
    font-weight: 600;
    font-size: 0.9em;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    transition: all 0.3s;
    border: 2px solid #ffd700;
    text-align: center;
}

.steal-all-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(255, 215, 0, 0.3);
}

.steal-all-btn:active {
    transform: translateY(0);
}

/* Cartas que se pueden robar */
.card.stealable-card {
    position: relative;
    animation: stealPulse 1.5s infinite;
    cursor: pointer !important;
}

.card.stealable-card::after {
    content: '🦹';
    position: absolute;
    top: -5px;
    right: -5px;
    background: #ffd700;
    color: #805500;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 10px;
    border: 2px solid white;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
}

@keyframes stealPulse {
    0% {
        box-shadow: 0 0 5px #ffd700, 0 0 0 0 rgba(255, 215, 0, 0.7);
        transform: translateY(0);
    }

    50% {
        box-shadow: 0 0 15px #ffd700, 0 0 0 8px rgba(255, 215, 0, 0);
        transform: translateY(-3px);
    }

    100% {
        box-shadow: 0 0 5px #ffd700, 0 0 0 0 rgba(255, 215, 0, 0);
        transform: translateY(0);
    }
}

/* ========== OPONENTES ========== */
.opponent {
    position: relative;
    margin-bottom: 15px;
    padding: 15px;
    background: white;
    border-radius: 10px;
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.08);
    border: 1px solid #e2e8f0;
}

.opponent-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
    padding-bottom: 8px;
    border-bottom: 2px solid #f1f5f9;
}

.opponent-header h4 {
    margin: 0;
    display: flex;
    align-items: center;
    gap: 8px;
    color: #2d3748;
    font-size: 1.1em;
}

.card-count-badge {
    background: var(--primary-color);
    color: white;
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 0.85em;
    font-weight: 600;
}

.turn-badge {
    background: var(--success-color);
    color: white;
    padding: 3px 8px;
    border-radius: 10px;
    font-size: 0.8em;
    animation: pulse 2s infinite;
}

.opponent-cards-container {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    min-height: 85px;
    padding: 10px;
    background: #f8fafc;
    border-radius: 8px;
    overflow-x: auto;
    overflow-y: hidden;
    margin-bottom: 10px;
    border: 1px solid #e2e8f0;
}

/* ========== ÁREAS DE JUEGO ========== */
.player-area,
.score-board,
.opponents-area,
.game-log {
    background: white;
    border-radius: var(--border-radius);
    padding: 20px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.05);
    border: 1px solid #e2e8f0;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.player-area {
    grid-column: 1;
    grid-row: 2;
}

.score-board {
    grid-column: 2;
    grid-row: 2;
}

.opponents-area {
    grid-column: 1;
    grid-row: 3;
}

.game-log {
    grid-column: 2;
    grid-row: 3;
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 2px solid var(--light-color);
}

.section-header h3 {
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--dark-color);
}

/* ========== BOTONES DE ACCIÓN ========== */
.btn-action {
    padding: 12px 24px;
    border: none;
    border-radius: 8px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    flex: 1;
}

.btn-action:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.btn-action:not(:disabled):hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
}

/* ========== TABLAS ========== */
.table-container {
    overflow-x: auto;
    flex: 1;
}

table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 5px;
}

th {
    background: var(--light-color);
    color: var(--dark-color);
    font-weight: 600;
    padding: 15px;
    text-align: left;
    border-bottom: 2px solid #e2e8f0;
    position: sticky;
    top: 0;
}

td {
    padding: 15px;
    border-bottom: 1px solid #e2e8f0;
}

tbody tr:hover {
    background: #f7fafc;
}

tbody tr.current-turn {
    background: #e8f4fd;
    font-weight: 600;
}

tbody tr.current-turn td:first-child {
    border-left: 4px solid var(--info-color);
}

tbody tr.my-player {
    background: #f0fff4;
    font-weight: 600;
}

tbody tr.my-player td:first-child {
    border-left: 4px solid var(--success-color);
}

/* ========== LOG DE EVENTOS ========== */
.log-messages {
    flex: 1;
    overflow-y: auto;
    padding: 10px;
    background: var(--light-color);
    border-radius: 8px;
    font-size: 0.9em;
}

.log-entry {
    padding: 10px;
    margin-bottom: 8px;
    border-radius: 6px;
    background: white;
    border-left: 4px solid var(--primary-color);
    display: flex;
    gap: 10px;
}

.log-entry.system {
    border-left-color: var(--gray-color);
}

.log-entry.draw {
    border-left-color: var(--info-color);
}

.log-entry.steal {
    border-left-color: var(--warning-color);
}

.log-entry.lose {
    border-left-color: var(--danger-color);
}

.log-entry.collect {
    border-left-color: var(--success-color);
}

.log-entry.collect-auto {
    border-left-color: #38a169;
}

.log-time {
    color: var(--gray-color);
    font-family: monospace;
    flex-shrink: 0;
}

.log-text {
    flex: 1;
}

/* ========== ESTADOS ========== */
.status-playing {
    background: var(--success-color);
    color: white;
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 0.85em;
    font-weight: 600;
}

.status-waiting {
    background: var(--gray-color);
    color: white;
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 0.85em;
    font-weight: 600;
}

.you-badge {
    background: var(--primary-color);
    color: white;
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 0.8em;
    margin-left: 5px;
}

.ai-badge {
    background: linear-gradient(135deg, #ed8936 0%, #dd6b20 100%);
    color: white;
    padding: 2px 6px;
    border-radius: 8px;
    font-size: 0.7em;
    margin-left: 5px;
    display: inline-flex;
    align-items: center;
    gap: 3px;
    border: 1px solid #dd6b20;
}

.creator-badge {
    background: linear-gradient(135deg, #FFD700 0%, #FFA500 100%);
    color: #805500;
    padding: 2px 6px;
    border-radius: 8px;
    font-size: 0.7em;
    margin-left: 5px;
    display: inline-flex;
    align-items: center;
    gap: 3px;
    border: 1px solid #FFA500;
}

/* ========== ESTADOS VACÍOS ========== */
.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 30px;
    color: #a0aec0;
    text-align: center;
    width: 100%;
}

.empty-state i {
    font-size: 3em;
    margin-bottom: 15px;
    opacity: 0.3;
}

.empty-state p {
    font-weight: 600;
    margin-bottom: 5px;
    color: #718096;
}

.empty-state small {
    font-size: 0.9em;
    opacity: 0.7;
}

.empty-state.collected i {
    color: #38a169;
    opacity: 0.7;
}

.empty-state.collected p {
    color: #22543d;
}

.no-cards {
    text-align: center;
    padding: 20px;
    color: #a0aec0;
    font-style: italic;
    width: 100%;
    font-size: 0.9em;
}

/* ========== RESPONSIVE ========== */
@media (max-width: 1024px) {
    .game-container {
        grid-template-columns: 1fr;
        grid-template-rows: auto;
        height: auto;
    }

    .player-area,
    .score-board,
    .opponents-area,
    .game-log {
        grid-column: 1;
    }

    .player-area {
        grid-row: 2;
    }

    .score-board {
        grid-row: 3;
    }

    .opponents-area {
        grid-row: 4;
    }

    .game-log {
        grid-row: 5;
    }

    .center-area {
        flex-direction: column;
        gap: 20px;
    }

    .game-stats {
        width: 100%;
        justify-content: space-around;
    }
}

@media (max-width: 768px) {
    .screen {
        padding: 20px;
        margin: 10px auto;
    }

    .logo h1 {
        font-size: 2em;
        flex-direction: column;
        gap: 10px;
    }

    .button-group {
        flex-direction: column;
    }

    .game-header {
        flex-direction: column;
        gap: 15px;
        align-items: stretch;
    }

    .game-info {
        flex-direction: column;
        gap: 10px;
    }

    .deck-container {
        flex-direction: column;
        align-items: center;
    }

    .turn-indicator {
        min-width: auto;
        width: 100%;
        padding: 15px;
        font-size: 1em;
    }

    .player-actions {
        flex-direction: column;
    }

    .card {
        width: 50px;
        height: 70px;
        font-size: 1.5em;
    }

    .card.stealable-card::after {
        width: 18px;
        height: 18px;
        font-size: 9px;
    }

    /* Orden para móvil */
    .mobile-ordered .player-area {
        order: 2;
    }

    .mobile-ordered .opponents-area {
        order: 3;
    }

    .mobile-ordered .score-board {
        order: 4;
    }

    .mobile-ordered .game-log {
        order: 5;
    }
}

/* ========== INDICADOR DE RONDA ========== */
#round-info {
    position: absolute;
    top: 20px;
    left: 20px;
    background: var(--primary-color);
    color: white;
    padding: 8px 15px;
    border-radius: 20px;
    font-weight: 600;
    font-size: 0.9em;
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.1);
    z-index: 10;
}

/* ========== PANTALLA DE RESULTADOS ========== */
.winner-card {
    text-align: center;
    padding: 40px;
    background: linear-gradient(135deg, #FFD700 0%, #FFA500 100%);
    border-radius: var(--border-radius);
    color: #805500;
    margin: 30px 0;
    box-shadow: var(--box-shadow);
    border: 3px solid #FFA500;
}

.winner-card i {
    font-size: 4em;
    margin-bottom: 20px;
    text-shadow: 0 3px 10px rgba(0, 0, 0, 0.2);
}

.winner-card h3 {
    font-size: 2.5em;
    margin-bottom: 15px;
    font-weight: 800;
}

.winner-card p {
    font-size: 1.3em;
    font-weight: 600;
    margin-bottom: 15px;
}

.celebration {
    display: block;
    margin-top: 20px;
    font-size: 1.8em;
    animation: bounce 1s infinite;
}

@keyframes bounce {

    0%,
    100% {
        transform: translateY(0);
    }

    50% {
        transform: translateY(-10px);
    }
}

.final-table {
    width: 100%;
    border-collapse: collapse;
    margin: 20px 0;
    background: white;
    border-radius: var(--border-radius);
    overflow: hidden;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.05);
}

.final-table th {
    background: var(--primary-color);
    color: white;
    padding: 18px;
    text-align: left;
    font-weight: 600;
    font-size: 1.1em;
}

.final-table td {
    padding: 18px;
    border-bottom: 1px solid #e2e8f0;
    font-size: 1.1em;
}

.final-table tr:last-child td {
    border-bottom: none;
}

.final-table tr:hover {
    background: #f7fafc;
}

.final-table tr:nth-child(1) td:first-child {
    color: #FFD700;
    font-size: 1.3em;
}

.final-table tr:nth-child(2) td:first-child {
    color: #C0C0C0;
    font-size: 1.3em;
}

.final-table tr:nth-child(3) td:first-child {
    color: #CD7F32;
    font-size: 1.3em;
}

.results-header {
    text-align: center;
    margin-bottom: 30px;
    padding-bottom: 20px;
    border-bottom: 2px solid var(--light-color);
}

.results-header h2 {
    color: var(--primary-color);
    font-size: 2.5em;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 15px;
}

.results-actions {
    display: flex;
    gap: 15px;
    margin-top: 40px;
    justify-content: center;
}

.results-actions button {
    min-width: 200px;
}

@media (max-width: 768px) {
    .results-actions {
        flex-direction: column;
    }

    .results-actions button {
        min-width: 100%;
    }

    .winner-card {
        padding: 20px;
    }

    .winner-card h3 {
        font-size: 1.8em;
    }
}

/* ========== ESTILOS PARA RECOLECCIÓN ========== */
.collected-badge {
    background: var(--success-color);
    color: white;
    padding: 3px 8px;
    border-radius: 10px;
    font-size: 0.8em;
    margin-left: 5px;
    animation: pulse 2s infinite;
}

/* ========== AJUSTES RESPONSIVE ========== */
@media (max-width: 768px) {
    #round-info {
        position: static;
        margin: 10px 0;
        text-align: center;
        display: block;
    }
}

/* ========== NOTIFICACIONES ========== */
.notification {
    position: fixed;
    top: 20px;
    right: 20px;
    padding: 15px 25px;
    border-radius: 8px;
    color: white;
    font-weight: 600;
    z-index: 10000;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
    transition: all 0.3s;
    max-width: 400px;
}

.notification.hidden {
    display: none;
}

/* ========== ANIMACIONES PARA PÉRDIDA DE TURNO ========== */
@keyframes explodeCard {
    0% {
        transform: scale(1) rotate(0deg);
        box-shadow: 0 0 0 rgba(245, 101, 101, 0);
    }

    50% {
        transform: scale(1.3) rotate(180deg);
        box-shadow: 0 0 50px rgba(245, 101, 101, 0.8);
        background: #f56565;
        color: white;
    }

    100% {
        transform: scale(0) rotate(360deg);
        opacity: 0;
        box-shadow: 0 0 100px rgba(245, 101, 101, 0);
    }
}

.card.lost-turn-highlight {
    animation: dangerPulse 2s infinite;
    border: 3px solid #f56565 !important;
    box-shadow: 0 0 20px rgba(245, 101, 101, 0.7) !important;
    position: relative;
    z-index: 100;
}

.card.lost-turn-highlight::before {
    content: '💥';
    position: absolute;
    top: -10px;
    right: -10px;
    font-size: 1.5em;
    animation: bounce 0.5s infinite;
}

@keyframes dangerPulse {

    0%,
    100% {
        box-shadow: 0 0 10px rgba(245, 101, 101, 0.7);
        transform: scale(1);
    }

    50% {
        box-shadow: 0 0 30px rgba(245, 101, 101, 1);
        transform: scale(1.05);
    }
}

.lost-turn-card {
    animation: explodeCard 1s ease-out forwards;
}

/* ========== TABS PARA OPONENTES ========== */
.opponents-tabs {
    display: none;
    margin-top: 20px;
}

.tabs-header {
    display: flex;
    background: var(--light-color);
    border-radius: 8px 8px 0 0;
    overflow: hidden;
}

.tab-btn {
    flex: 1;
    padding: 12px;
    border: none;
    background: none;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    text-align: center;
    color: var(--gray-color);
    border-bottom: 3px solid transparent;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.tab-btn.active {
    color: var(--primary-color);
    border-bottom-color: var(--primary-color);
    background: white;
}

.tabs-content {
    background: white;
    border-radius: 0 0 8px 8px;
    padding: 15px;
    border: 1px solid #e2e8f0;
    border-top: none;
}

.tab-pane {
    display: none;
    min-height: 150px;
}

.tab-pane.active {
    display: block;
}

.opponent-tab-view {
    padding: 10px;
}

/* Mostrar tabs solo en móvil */
@media (max-width: 768px) {
    .opponents-tabs {
        display: block;
    }
}

/* ========== ANIMACIÓN DE CARTA ROBADA ========== */
@keyframes stolenCard {
    0% {
        transform: scale(1) rotate(0deg);
        opacity: 1;
    }

    50% {
        transform: scale(0.8) rotate(-10deg);
        opacity: 0.7;
        box-shadow: 0 0 20px rgba(245, 101, 101, 0.5);
    }

    100% {
        transform: translateX(-100px) scale(0) rotate(-20deg);
        opacity: 0;
    }
}

.card-stolen-animation {
    animation: stolenCard 1s ease-out forwards;
    position: relative;
    z-index: 1000;
}

.steal-notification {
    position: fixed;
    top: 100px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(245, 101, 101, 0.9);
    color: white;
    padding: 12px 25px;
    border-radius: 25px;
    font-weight: 700;
    z-index: 1000;
    text-align: center;
    animation: slideDown 0.5s ease-out;
    box-shadow: 0 5px 15px rgba(245, 101, 101, 0.3);
}

@keyframes slideDown {
    from {
        transform: translate(-50%, -20px);
        opacity: 0;
    }

    to {
        transform: translate(-50%, 0);
        opacity: 1;
    }
}

/* ========== MODAL ========== */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
}

.modal-content {
    background: white;
    padding: 30px;
    border-radius: var(--border-radius);
    max-width: 400px;
    width: 90%;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
}

.modal-buttons {
    display: flex;
    gap: 15px;
    margin-top: 25px;
}

.form-select {
    width: 100%;
    padding: 12px;
    border: 2px solid #e2e8f0;
    border-radius: 8px;
    font-size: 16px;
    background: white;
    cursor: pointer;
}

.mobile-only {
    display: none;
}

@media (max-width: 768px) {
    .mobile-only {
        display: inline;
    }
}

/* ========== MEJORAS DE SCROLL EN MÓVIL ========== */
@media (max-width: 768px) {

    .cards-horizontal,
    .opponent-cards-container {
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
    }

    .cards-horizontal::-webkit-scrollbar,
    .opponent-cards-container::-webkit-scrollbar {
        display: none;
    }

    body {
        padding: 10px;
    }

    .screen {
        padding: 15px;
        margin: 10px auto;
    }
}

/* ========== ESTILOS ADICIONALES PARA v1.4.9 ========== */

/* Detección de dispositivo */
.mobile-device .desktop-only {
    display: none !important;
}

.desktop-device .mobile-only {
    display: none !important;
}

/* Optimización para móvil */
@media (max-width: 768px) {

    /* Contenedor de juego móvil */
    #game-container.mobile-optimized {
        display: flex !important;
        flex-direction: column !important;
        gap: 12px !important;
        height: auto !important;
        overflow-y: auto !important;
        -webkit-overflow-scrolling: touch !important;
    }

    /* Área de oponentes - prioridad alta */
    #opponents-area.mobile-priority {
        order: 3 !important;
        margin-top: 15px !important;
        margin-bottom: 10px !important;
        display: block !important;
        opacity: 1 !important;
        visibility: visible !important;
        height: auto !important;
        max-height: 300px !important;
        overflow-y: auto !important;
    }

    /* Ocultar descarte en móvil para ahorrar espacio */
    .discard-pile.mobile-hidden {
        display: none !important;
    }

    /* Estadísticas reducidas en móvil */
    .game-stats.mobile-compact {
        justify-content: space-between !important;
        width: 100% !important;
    }

    .game-stats.mobile-compact .stat:nth-child(3) {
        display: none !important;
    }

    /* Cartas en móvil - tamaño optimizado */
    .card.mobile-optimized {
        width: 45px !important;
        height: 63px !important;
        font-size: 1.4em !important;
        margin: 2px !important;
    }

    /* Tabla de puntuaciones móvil */
    .score-board.mobile-compact table {
        font-size: 0.9em !important;
    }

    .score-board.mobile-compact th,
    .score-board.mobile-compact td {
        padding: 8px 6px !important;
    }

    /* Log reducido en móvil */
    .game-log.mobile-compact {
        max-height: 150px !important;
        font-size: 0.85em !important;
    }

    /* Indicador de turno móvil */
    .turn-indicator.mobile-compact {
        font-size: 0.9em !important;
        padding: 12px 15px !important;
        text-align: center !important;
        line-height: 1.4 !important;
    }

    /* Botones de acción móvil */
    .player-actions.mobile-compact {
        display: flex !important;
        flex-direction: column !important;
        gap: 10px !important;
        margin-top: 15px !important;
    }

    .player-actions.mobile-compact button {
        width: 100% !important;
        min-height: 50px !important;
        font-size: 1em !important;
    }
}

/* iPhone específico */
@media (max-width: 390px) {

    /* Ajustes extra para pantallas pequeñas */
    .screen {
        padding: 10px !important;
    }

    .logo h1 {
        font-size: 1.6em !important;
    }

    .card.mobile-optimized {
        width: 40px !important;
        height: 56px !important;
        font-size: 1.2em !important;
    }

    /* Reducir espacio entre secciones */
    #game-container.mobile-optimized {
        gap: 8px !important;
    }

    /* Información de ronda móvil */
    #round-info.mobile {
        font-size: 0.8em !important;
        padding: 6px 12px !important;
        position: static !important;
        margin: 10px auto !important;
        width: fit-content !important;
    }
}

/* Tablet */
@media (min-width: 769px) and (max-width: 1024px) {

    /* Optimización tablet */
    #opponents-area {
        grid-column: 1 !important;
        grid-row: 3 !important;
        max-height: 250px !important;
        overflow-y: auto !important;
    }

    .opponents-container {
        display: grid !important;
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 10px !important;
    }

    .opponent {
        margin-bottom: 10px !important;
    }
}

/* Mejoras de rendimiento */
@media (prefers-reduced-motion: reduce) {

    .card,
    .deck,
    .turn-indicator {
        animation: none !important;
        transition: none !important;
    }
}

/* Corrección Safari iOS */
@supports (-webkit-touch-callout: none) {
    .card {
        -webkit-tap-highlight-color: transparent;
    }

    button,
    .deck {
        -webkit-tap-highlight-color: rgba(0, 0, 0, 0.1);
    }

    /* Mejorar scrolling */
    #opponents-area,
    .log-messages,
    .cards-horizontal {
        -webkit-overflow-scrolling: touch;
    }
}

/* ========== ESTILOS PARA VERSIÓN MÓVIL v1.4.9 ========== */
.mobile-opponent-empty {
    text-align: center;
    padding: 30px;
    color: #a0aec0;
}

.mobile-opponent-empty i {
    font-size: 2.5em;
    margin-bottom: 10px;
    opacity: 0.5;
}

.no-cards-mobile {
    text-align: center;
    padding: 15px;
    color: #a0aec0;
    font-style: italic;
    font-size: 0.9em;
    border: 1px dashed #e2e8f0;
    border-radius: 8px;
    margin: 10px 0;
}

.turn-indicator-mobile {
    background: var(--success-color);
    color: white;
    padding: 2px 6px;
    border-radius: 8px;
    font-size: 0.7em;
    margin-left: 5px;
    animation: pulse 2s infinite;
}

.mobile-cards-empty {
    text-align: center;
    padding: 20px;
    color: #718096;
}

.mobile-cards-empty i {
    font-size: 2em;
    margin-bottom: 10px;
    opacity: 0.3;
}

.mobile-cards-empty p {
    font-weight: 600;
    margin-bottom: 5px;
}

.mobile-cards-empty small {
    font-size: 0.9em;
    opacity: 0.7;
}

.mobile-cards-total {
    text-align: center;
    margin-top: 10px;
    padding: 8px;
    background: #f7fafc;
    border-radius: 8px;
    font-weight: 600;
    color: var(--primary-color);
    border: 1px solid #e2e8f0;
}

/* Estilos para v1.5 */
.log-entry.debug {
    border-left-color: #ff9900 !important;
    background: #fff8e1;
}

.collection-hint {
    background: #e8f4fd;
    border: 1px solid #90cdf4;
    border-radius: 8px;
    padding: 10px;
    margin: 10px 0;
    font-size: 0.9em;
    color: #2d3748;
}

.collection-hint i {
    color: #4299e1;
    margin-right: 8px;
}

.version-notice {
    background: linear-gradient(135deg, #48bb78 0%, #38a169 100%);
    color: white;
    padding: 8px 15px;
    border-radius: 20px;
    font-weight: 600;
    margin: 10px 0;
    text-align: center;
    animation: pulse 2s infinite;
}

@keyframes highlightPulse {
    0% {
        box-shadow: 0 0 0 0 rgba(72, 187, 120, 0.7);
    }

    70% {
        box-shadow: 0 0 0 10px rgba(72, 187, 120, 0);
    }

    100% {
        box-shadow: 0 0 0 0 rgba(72, 187, 120, 0);
    }
}

.highlight-card {
    animation: highlightPulse 2s infinite;
    border-width: 3px !important;
}

/* Indicador de recolección pendiente */
.pending-collection {
    position: relative;
}

.pending-collection::before {
    content: '💰';
    position: absolute;
    top: -8px;
    right: -8px;
    background: #ffd700;
    color: #805500;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 10px;
    border: 2px solid white;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
    z-index: 10;
}

/* Debug overlay */
.debug-overlay {
    position: fixed;
    top: 10px;
    left: 10px;
    background: rgba(0, 0, 0, 0.8);
    color: #0f0;
    font-family: monospace;
    font-size: 12px;
    padding: 10px;
    border-radius: 5px;
    z-index: 10000;
    max-width: 300px;
    max-height: 200px;
    overflow: auto;
    border: 1px solid #0f0;
}

/* Mensaje de colección */
.collection-message {
    animation: slideIn 0.5s ease-out;
    background: #48bb78;
    color: white;
    padding: 10px 15px;
    border-radius: 8px;
    margin: 10px 0;
    font-weight: 600;
}

@keyframes slideIn {
    from {
        transform: translateY(-20px);
        opacity: 0;
    }

    to {
        transform: translateY(0);
        opacity: 1;
    }
}