* { margin: 0; padding: 0; box-sizing: border-box; }
body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    padding: 20px;
    color: #333;
}
.container { max-width: 1800px; margin: 0 auto; }
.header {
    background: white;
    padding: 20px 30px;
    border-radius: 10px;
    margin-bottom: 20px;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 15px;
}
.header h1 { color: #667eea; font-size: 28px; }
.message { padding: 15px 20px; border-radius: 5px; margin-bottom: 20px; font-weight: 500; }
.message.success { background: #c6f6d5; color: #22543d; border-left: 4px solid #22543d; }
.message.error { background: #fed7d7; color: #c53030; border-left: 4px solid #c53030; }
.btn { padding: 10px 20px; border: none; border-radius: 5px; cursor: pointer; font-size: 14px; font-weight: 600; transition: all 0.3s; color: white; }
.btn-primary { background: #667eea; }
.btn-primary:hover { background: #5568d3; transform: translateY(-2px); box-shadow: 0 4px 8px rgba(0,0,0,0.2); }
.btn-success { background: #48bb78; }
.btn-success:hover { background: #38a169; transform: translateY(-2px); }
.btn-danger { background: #f56565; }
.btn-danger:hover { background: #e53e3e; transform: translateY(-2px); }
.btn-warning { background: #ed8936; }
.btn-warning:hover { background: #dd6b20; transform: translateY(-2px); }
.empty-state { text-align: center; padding: 40px; color: #a0aec0; font-style: italic; }
.loading { text-align: center; padding: 20px; color: #718096; }
.error { text-align: center; padding: 20px; color: #c53030; background: #fed7d7; border-radius: 5px; }

/* Lobby */
.main-content { display: grid; grid-template-columns: 1fr; gap: 20px; }
.games-panel, .player-panel {
    background: white;
    padding: 30px;
    border-radius: 10px;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
}
.games-panel h2, .player-panel h2 { color: #667eea; margin-bottom: 20px; font-size: 24px; }
.games-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 20px; margin-bottom: 30px; }
.game-item {
    background: #f7fafc;
    border: 2px solid #e2e8f0;
    border-radius: 8px;
    padding: 20px;
    cursor: pointer;
    transition: all 0.3s;
}
.game-item:hover { border-color: #667eea; transform: translateY(-2px); box-shadow: 0 4px 8px rgba(0,0,0,0.1); }
.game-item-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; }
.game-item-header h3 { color: #2d3748; font-size: 18px; }
.game-badge { background: #667eea; color: white; padding: 4px 12px; border-radius: 12px; font-size: 12px; font-weight: 600; }
.game-item-info { color: #718096; font-size: 14px; margin-bottom: 15px; }
.game-item-actions { display: flex; gap: 10px; }
.create-game-section { margin-top: 30px; padding-top: 30px; border-top: 2px solid #e2e8f0; }
.create-game-section h3 { color: #667eea; margin-bottom: 20px; }
.form-group { margin-bottom: 15px; }
.form-group label { display: block; margin-bottom: 5px; color: #2d3748; font-weight: 600; }
.form-group input, .form-group select { width: 100%; padding: 10px; border: 2px solid #e2e8f0; border-radius: 5px; font-size: 14px; }
.form-group input:focus, .form-group select:focus { outline: none; border-color: #667eea; }
.game-info { background: #f7fafc; padding: 20px; border-radius: 8px; margin-bottom: 20px; }
.game-details h3 { color: #2d3748; margin-bottom: 10px; }
.game-stats { display: flex; gap: 15px; flex-wrap: wrap; }
.game-stats span { background: #edf2f7; padding: 5px 10px; border-radius: 4px; font-size: 14px; color: #2d3748; }
.players-list { display: flex; flex-direction: column; gap: 15px; margin-bottom: 20px; }
.player-item {
    background: #f7fafc;
    border: 2px solid #e2e8f0;
    border-radius: 8px;
    padding: 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: all 0.3s;
    cursor: pointer;
}
.player-item:hover { border-color: #667eea; transform: translateX(5px); }
.player-info h4 { color: #2d3748; margin-bottom: 5px; }
.player-stats { color: #718096; font-size: 14px; }

/* Play */
.game-info-header, .header-controls { display: flex; gap: 15px; align-items: center; flex-wrap: wrap; }
.game-info-header span, .header-controls span { color: #2d3748; font-size: 14px; }
.game-layout { display: grid; grid-template-columns: 250px 1fr 350px; gap: 20px; height: calc(100vh - 200px); }
.info-panel, .hand-panel {
    background: white;
    border-radius: 10px;
    padding: 20px;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
    overflow-y: auto;
}
.info-panel h2, .hand-panel h2 { color: #667eea; margin-bottom: 15px; font-size: 20px; }
.info-panel h3 { color: #2d3748; margin-top: 20px; margin-bottom: 15px; font-size: 16px; }
.stat-item { background: #f7fafc; padding: 10px; border-radius: 5px; font-size: 14px; }
.stat-item strong { color: #667eea; }
.players-info { display: flex; flex-direction: column; gap: 10px; }
.player-item.current-player { border-color: #667eea; background: #edf2f7; }
.player-name { font-weight: 600; color: #2d3748; margin-bottom: 5px; }
.player-hand-size { font-size: 12px; color: #718096; }
.main-panel {
    background: white;
    border-radius: 10px;
    padding: 20px;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 30px;
}
.board-section h2, .discard-section h2 { color: #667eea; margin-bottom: 15px; font-size: 20px; }
.board-cards, .discard-pile {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    min-height: 150px;
    padding: 20px;
    background: #edf2f7;
    border-radius: 8px;
}
.discard-pile { background: #fed7d7; }
.hand-actions { display: flex; flex-direction: column; gap: 10px; margin-bottom: 20px; }
.hand-cards { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; }

/* Cards */
.card {
    width: 100px;
    height: 140px;
    background: white;
    border: 2px solid #cbd5e0;
    border-radius: 8px;
    padding: 10px;
    cursor: pointer;
    transition: all 0.3s;
    position: relative;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}
.card:hover { transform: translateY(-5px) scale(1.05); box-shadow: 0 6px 12px rgba(0,0,0,0.2); z-index: 10; }
.card.flipped { background: linear-gradient(135deg, #667eea 0%, #764ba2 100%); color: white; }
.card.flipped .card-name, .card.flipped .card-value, .card.flipped .card-color, .card.flipped .card-effect { display: none; }
.card-name { font-size: 11px; font-weight: bold; color: #2d3748; text-align: center; word-break: break-word; line-height: 1.2; }
.card-value { font-size: 20px; font-weight: bold; text-align: center; color: #2d3748; }
.card-color { width: 20px; height: 20px; border-radius: 50%; margin: 0 auto; border: 2px solid #cbd5e0; }
.card-color.red { background: #e53e3e; }
.card-color.black { background: #2d3748; }
.card-color.blue { background: #3182ce; }
.card-color.green { background: #38a169; }
.card-color.amarillo { background: #d69e2e; }
.card-color.blanco { background: #f7fafc; border-color: #cbd5e0; }
.card-effect { font-size: 9px; color: #718096; text-align: center; margin-top: 5px; font-style: italic; }
.card.rotated-90 { transform: rotate(90deg); }
.card.rotated-180 { transform: rotate(180deg); }
.card.rotated-270 { transform: rotate(270deg); }
.card-actions {
    position: absolute;
    top: -35px;
    left: 50%;
    transform: translateX(-50%);
    display: none;
    gap: 3px;
    background: white;
    padding: 5px;
    border-radius: 5px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.2);
    z-index: 20;
    flex-wrap: wrap;
    max-width: 200px;
}
.card:hover .card-actions { display: flex; }
.card-action-btn { padding: 5px 10px; font-size: 11px; border: none; border-radius: 3px; cursor: pointer; background: #667eea; color: white; white-space: nowrap; }
.card-action-btn:hover { background: #5568d3; }

/* Replay */
.replay-controls {
    background: white;
    padding: 20px;
    border-radius: 10px;
    margin-bottom: 20px;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 20px;
}
.control-group { display: flex; align-items: center; gap: 10px; }
.control-group label { color: #2d3748; font-weight: 600; }
.control-group select { padding: 8px 12px; border: 2px solid #e2e8f0; border-radius: 5px; font-size: 14px; }
.main-content.replay { display: grid; grid-template-columns: 350px 1fr 300px; gap: 20px; height: calc(100vh - 250px); }
.history-panel { background: white; border-radius: 10px; padding: 20px; box-shadow: 0 4px 6px rgba(0,0,0,0.1); overflow-y: auto; }
.history-panel h2 { color: #667eea; margin-bottom: 15px; font-size: 20px; }
.history-list { display: flex; flex-direction: column; gap: 10px; }
.history-item {
    background: #f7fafc;
    border: 2px solid #e2e8f0;
    border-radius: 8px;
    padding: 15px;
    cursor: pointer;
    transition: all 0.3s;
}
.history-item:hover { border-color: #667eea; transform: translateX(5px); }
.history-item.active { border-color: #667eea; background: #edf2f7; box-shadow: 0 2px 8px rgba(102,126,234,0.3); }
.history-item-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
.action-number { background: #667eea; color: white; padding: 2px 8px; border-radius: 4px; font-size: 12px; font-weight: 600; }
.action-type { font-weight: 600; color: #2d3748; margin-bottom: 4px; }
.action-player { font-size: 12px; color: #718096; }
.action-description { font-size: 12px; color: #4a5568; }
.game-panel { background: white; border-radius: 10px; padding: 20px; box-shadow: 0 4px 6px rgba(0,0,0,0.1); overflow-y: auto; }
.game-panel h2 { color: #667eea; margin-bottom: 15px; }
.players-panel { background: white; border-radius: 10px; padding: 20px; box-shadow: 0 4px 6px rgba(0,0,0,0.1); overflow-y: auto; }
.players-panel h2 { color: #667eea; margin-bottom: 15px; }

@media (max-width: 1024px) {
    .game-layout { grid-template-columns: 1fr; height: auto; }
    .main-content.replay { grid-template-columns: 1fr; }
}
