* {
    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;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 15px;
}

.container {
    width: 100%;
    max-width: 100%;
}

h1 {
    text-align: center;
    color: white;
    font-size: 2.2em;
    margin-bottom: 20px;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.3);
}

.screen {
    display: none;
    animation: fadeIn 0.5s ease-in;
}

.screen.active {
    display: block;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Setup Screen */
.setup-box {
    background: white;
    border-radius: 15px;
    padding: 25px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.2);
}

.setup-box h2 {
    color: #667eea;
    margin-bottom: 20px;
    text-align: center;
    font-size: 1.5em;
}

.input-group {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
}

input[type="text"] {
    flex: 1;
    padding: 14px 18px;
    border: 2px solid #e0e0e0;
    border-radius: 10px;
    font-size: 16px;
    transition: border-color 0.3s;
}

input[type="text"]:focus {
    outline: none;
    border-color: #667eea;
}

.btn {
    padding: 14px 28px;
    border: none;
    border-radius: 12px;
    font-size: 17px;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s;
}

.btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(0,0,0,0.2);
}

.btn:active {
    transform: translateY(0);
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

.btn-primary {
    background: #667eea;
    color: white;
}

.btn-success {
    background: #48bb78;
    color: white;
    width: 100%;
    margin-top: 20px;
    padding: 16px;
    font-size: 19px;
}

.btn-danger {
    background: #f56565;
    color: white;
    margin-top: 20px;
}

.btn-spin {
    background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
    color: white;
    font-size: 22px;
    padding: 18px 50px;
    display: block;
    margin: 25px auto;
    box-shadow: 0 5px 20px rgba(245, 87, 108, 0.4);
}

.players-list {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin: 20px 0;
    min-height: 50px;
}

.player-tag {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 8px 15px;
    border-radius: 20px;
    display: flex;
    align-items: center;
    gap: 10px;
    animation: slideIn 0.3s ease-out;
}

@keyframes slideIn {
    from { transform: scale(0); }
    to { transform: scale(1); }
}

.player-tag .remove-btn {
    background: rgba(255,255,255,0.3);
    border: none;
    border-radius: 50%;
    width: 20px;
    height: 20px;
    cursor: pointer;
    font-weight: bold;
    color: white;
}

/* Game Screen */
.game-info {
    background: white;
    border-radius: 15px;
    padding: 18px;
    display: flex;
    justify-content: space-around;
    margin-bottom: 25px;
    box-shadow: 0 5px 15px rgba(0,0,0,0.1);
    flex-wrap: wrap;
    gap: 10px;
}

.game-info div {
    font-size: 17px;
    font-weight: bold;
    color: #667eea;
}

.game-info span {
    color: #764ba2;
}

/* Game Main Layout */
.game-main {
    display: flex;
    flex-direction: column;
    gap: 25px;
    align-items: center;
}

/* Ruleta */
.ruleta-container {
    position: relative;
    width: 90vw;
    max-width: 400px;
    height: 90vw;
    max-height: 400px;
    margin: 0 auto;
}

.ruleta-pointer {
    position: absolute;
    top: -35px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 50px;
    color: #f5576c;
    z-index: 10;
    filter: drop-shadow(0 3px 6px rgba(0,0,0,0.4));
    animation: pulse 1.5s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% { transform: translateX(-50%) translateY(0); }
    50% { transform: translateX(-50%) translateY(5px); }
}

.ruleta {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    position: relative;
    box-shadow: 0 15px 50px rgba(0,0,0,0.4);
    border: 8px solid white;
    background: white;
    overflow: hidden;
    user-select: none;
}

.ruleta-section {
    position: absolute;
    width: 50%;
    height: 50%;
    left: 50%;
    top: 50%;
    transform-origin: 0% 0%;
    clip-path: polygon(0 0, 100% 0, 0 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: visible;
}

.ruleta-section span {
    position: absolute;
    left: 40%;
    top: 30%;
    transform: rotate(-22.5deg) translateX(-50%);
    font-weight: 900;
    color: white;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.5);
    font-size: clamp(11px, 2.8vw, 16px);
    text-align: center;
    line-height: 1.1;
    display: block;
    width: auto;
    white-space: nowrap;
}

.ruleta-section:nth-child(1) { 
    background: linear-gradient(135deg, #ff6b6b 0%, #ee5a52 100%);
    transform: rotate(0deg);
    border-right: 2px solid rgba(255,255,255,0.3);
}
.ruleta-section:nth-child(2) { 
    background: linear-gradient(135deg, #4ecdc4 0%, #44a6a0 100%);
    transform: rotate(45deg);
    border-right: 2px solid rgba(255,255,255,0.3);
}
.ruleta-section:nth-child(3) { 
    background: linear-gradient(135deg, #45b7d1 0%, #3da5bc 100%);
    transform: rotate(90deg);
    border-right: 2px solid rgba(255,255,255,0.3);
}
.ruleta-section:nth-child(4) { 
    background: linear-gradient(135deg, #feca57 0%, #feb72b 100%);
    transform: rotate(135deg);
    border-right: 2px solid rgba(255,255,255,0.3);
}
.ruleta-section:nth-child(5) { 
    background: linear-gradient(135deg, #48dbfb 0%, #34c9f5 100%);
    transform: rotate(180deg);
    border-right: 2px solid rgba(255,255,255,0.3);
}
.ruleta-section:nth-child(6) { 
    background: linear-gradient(135deg, #ff9ff3 0%, #f77fec 100%);
    transform: rotate(225deg);
    border-right: 2px solid rgba(255,255,255,0.3);
}
.ruleta-section:nth-child(7) { 
    background: linear-gradient(135deg, #54a0ff 0%, #3d8aed 100%);
    transform: rotate(270deg);
    border-right: 2px solid rgba(255,255,255,0.3);
}
.ruleta-section:nth-child(8) { 
    background: linear-gradient(135deg, #00d2d3 0%, #00bfc0 100%);
    transform: rotate(315deg);
    border-right: 2px solid rgba(255,255,255,0.3);
}

/* Modal de Resultado */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1000;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.modal.active {
    display: flex;
}

.modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(8px);
    animation: fadeIn 0.3s ease-out;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.modal-content {
    position: relative;
    background: white;
    border-radius: 25px;
    padding: 40px 30px;
    max-width: 500px;
    width: 100%;
    box-shadow: 0 20px 60px rgba(0,0,0,0.4);
    animation: modalBounceIn 0.5s cubic-bezier(0.68, -0.55, 0.265, 1.55);
    text-align: center;
}

@keyframes modalBounceIn {
    0% {
        transform: scale(0.3) rotate(-10deg);
        opacity: 0;
    }
    50% {
        transform: scale(1.08) rotate(2deg);
    }
    100% {
        transform: scale(1) rotate(0);
        opacity: 1;
    }
}

.modal-emoji {
    font-size: clamp(60px, 15vw, 100px);
    margin-bottom: 20px;
    animation: emojiPop 0.6s ease-out 0.3s both;
}

@keyframes emojiPop {
    0% {
        transform: scale(0) rotate(0deg);
    }
    50% {
        transform: scale(1.2) rotate(180deg);
    }
    100% {
        transform: scale(1) rotate(360deg);
    }
}

.modal-content h2 {
    color: #667eea;
    font-size: clamp(24px, 5vw, 32px);
    margin-bottom: 15px;
    animation: slideInFromTop 0.4s ease-out 0.4s both;
}

@keyframes slideInFromTop {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.modal-content p {
    color: #555;
    font-size: clamp(17px, 4vw, 22px);
    line-height: 1.6;
    margin-bottom: 30px;
    animation: slideInFromBottom 0.4s ease-out 0.5s both;
}

@keyframes slideInFromBottom {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.modal-content .btn {
    animation: slideInFromBottom 0.4s ease-out 0.6s both;
}

.btn-large {
    padding: 18px 50px;
    font-size: 20px;
}
/* Game Log */
.game-log {
    background: white;
    border-radius: 15px;
    padding: 18px;
    margin-top: 20px;
    max-height: 250px;
    overflow-y: auto;
    box-shadow: 0 5px 15px rgba(0,0,0,0.1);
}

.game-log h3 {
    color: #667eea;
    margin-bottom: 15px;
    font-size: 1.3em;
}

.log-entry {
    padding: 12px;
    margin: 8px 0;
    background: #f7fafc;
    border-radius: 8px;
    border-left: 4px solid #667eea;
    font-size: 15px;
    color: #555;
    line-height: 1.4;
}

#reset-game-btn {
    display: block;
    margin: 20px auto 0;
}

/* Rounds Selector */
.rounds-selector {
    margin: 20px 0;
    padding: 15px;
    background: #f7fafc;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 15px;
}

.rounds-selector label {
    font-weight: bold;
    color: #667eea;
    font-size: 16px;
}

.rounds-selector input[type="number"] {
    width: 80px;
    padding: 10px;
    border: 2px solid #667eea;
    border-radius: 8px;
    font-size: 18px;
    font-weight: bold;
    text-align: center;
    color: #764ba2;
}

/* Final Screen */
.final-box {
    background: white;
    border-radius: 15px;
    padding: 30px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.2);
    max-width: 700px;
    margin: 0 auto;
}

.final-box h2 {
    color: #667eea;
    text-align: center;
    margin-bottom: 15px;
    font-size: 2em;
}

.final-box h3 {
    color: #764ba2;
    text-align: center;
    margin-bottom: 25px;
    font-size: 1.4em;
}

.gifts-summary {
    margin: 20px 0;
}

.final-message {
    text-align: center;
    padding: 20px;
    background: linear-gradient(135deg, #ffeaa7 0%, #fdcb6e 100%);
    border-radius: 12px;
    margin-bottom: 25px;
}

.final-message p {
    margin: 8px 0;
    font-size: 18px;
    font-weight: bold;
    color: #2d3436;
}

.gift-results {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.gift-result-item {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 15px 20px;
    background: linear-gradient(135deg, #f7fafc 0%, #edf2f7 100%);
    border-radius: 12px;
    border-left: 4px solid #667eea;
    transition: transform 0.2s;
}

.gift-result-item:hover {
    transform: translateX(5px);
}



.player-name {
    font-weight: bold;
    color: #667eea;
    font-size: 17px;
    min-width: 120px;
}

.gift-arrow {
    color: #764ba2;
    font-size: 20px;
    font-weight: bold;
}

.gift-owner {
    flex: 1;
    color: #555;
    font-size: 16px;
}

#new-game-btn {
    width: 100%;
    margin-top: 25px;
}

/* Player Select Modal */
.player-select-buttons {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-top: 20px;
    max-height: 400px;
    overflow-y: auto;
}

.btn-player-select {
    padding: 15px 20px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    border-radius: 12px;
    font-size: 16px;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s;
    text-align: left;
}

.btn-player-select:hover {
    transform: translateX(5px);
    box-shadow: 0 5px 15px rgba(102, 126, 234, 0.4);
}

.btn-player-select:active {
    transform: translateX(3px);
}

/* Protection Modal */
.protection-buttons {
    display: flex;
    flex-direction: column;
    gap: 15px;
    margin-top: 25px;
}

@media (min-width: 768px) {
    .protection-buttons {
        flex-direction: row;
        justify-content: center;
    }
}

/* Gifts Tracker */
.gifts-tracker {
    background: white;
    border-radius: 15px;
    padding: 20px;
    box-shadow: 0 5px 15px rgba(0,0,0,0.1);
    width: 100%;
    max-width: 500px;
}

.gifts-tracker h3 {
    color: #667eea;
    margin-bottom: 15px;
    font-size: 1.2em;
    text-align: center;
}

.gifts-tracker-content {
    display: flex;
    flex-direction: column;
    gap: 10px;
    max-height: 350px;
    overflow-y: auto;
}

.gift-tracker-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 15px;
    background: #f7fafc;
    border-radius: 10px;
    border-left: 4px solid #e0e0e0;
    transition: all 0.3s;
}

.gift-tracker-item.current {
    background: linear-gradient(135deg, #ffeaa7 0%, #fdcb6e 100%);
    border-left-color: #f39c12;
    transform: scale(1.02);
    box-shadow: 0 3px 10px rgba(243, 156, 18, 0.3);
}

.gift-tracker-item.protected {
    background: linear-gradient(135deg, #c6f6d5 0%, #9ae6b4 100%);
    border-left-color: #48bb78;
}

.tracker-player {
    font-weight: bold;
    color: #667eea;
    min-width: 100px;
    font-size: 15px;
}

.tracker-arrow {
    color: #764ba2;
    font-weight: bold;
}

.tracker-gift {
    flex: 1;
    color: #555;
    font-size: 14px;
}

.tracker-shield {
    font-size: 18px;
}

/* Responsive Desktop */
@media (min-width: 768px) {
    .container {
        max-width: 1200px;
    }
    
    h1 {
        font-size: 3em;
        margin-bottom: 30px;
    }
    
    .setup-box {
        padding: 40px;
    }
    
    .setup-box h2 {
        font-size: 1.8em;
    }
    
    .game-info {
        padding: 20px;
        margin-bottom: 30px;
    }
    
    .game-info div {
        font-size: 20px;
    }
    
    .game-main {
        flex-direction: row;
        justify-content: center;
        align-items: flex-start;
    }
    
    .ruleta-container {
        max-width: 450px;
        max-height: 450px;
    }
    
    .gifts-tracker {
        max-width: 450px;
    }
    
    .btn-spin {
        font-size: 26px;
        padding: 22px 60px;
        margin: 30px auto;
    }
    
    .result-box {
        padding: 35px;
        margin: 30px 0;
    }
    
    .game-log {
        padding: 25px;
        max-height: 300px;
    }
    
    .game-log h3 {
        font-size: 1.5em;
    }
}
