/* Reset and base styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Outfit', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    min-height: 100vh;
    width: 100%;
    overflow-x: hidden;
    
    /* Beautiful gradient background */
    background: linear-gradient(135deg, 
        hsl(260, 75%, 35%) 0%, 
        hsl(280, 70%, 45%) 25%,
        hsl(300, 75%, 50%) 50%, 
        hsl(320, 75%, 55%) 75%,
        hsl(340, 80%, 60%) 100%);
    
    /* Animated gradient */
    background-size: 200% 200%;
    animation: gradientShift 15s ease infinite;
}

@keyframes gradientShift {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

/* Screen Management */
.screen {
    display: none;
    min-height: 100vh;
    width: 100%;
}

.screen.active {
    display: block;
    animation: fadeIn 0.4s ease-out;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Container */
.container {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    padding: 20px;
}

/* Card */
.card {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border-radius: 24px;
    padding: 40px 32px;
    max-width: 500px;
    width: 100%;
    box-shadow: 
        0 20px 60px rgba(0, 0, 0, 0.3),
        0 0 0 1px rgba(255, 255, 255, 0.1);
    animation: cardEntrance 0.6s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes cardEntrance {
    from {
        opacity: 0;
        transform: scale(0.9) translateY(20px);
    }
    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

/* Logo */
.logo {
    font-size: 4rem;
    text-align: center;
    margin-bottom: 16px;
    animation: bounce 2s ease-in-out infinite;
}

@keyframes bounce {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-10px); }
}

/* Typography */
.title {
    font-size: clamp(1.75rem, 5vw, 2.25rem);
    font-weight: 800;
    color: hsl(260, 75%, 25%);
    text-align: center;
    margin-bottom: 12px;
    line-height: 1.2;
}

.subtitle {
    font-size: clamp(0.95rem, 3vw, 1.05rem);
    font-weight: 400;
    color: hsl(260, 30%, 45%);
    text-align: center;
    margin-bottom: 32px;
    line-height: 1.5;
}

.label {
    display: block;
    font-size: 1rem;
    font-weight: 600;
    color: hsl(260, 50%, 30%);
    margin-bottom: 12px;
}

.section-title {
    font-size: 1.1rem;
    font-weight: 600;
    color: hsl(260, 50%, 30%);
    margin-bottom: 16px;
}

/* Input Group */
.input-group {
    margin-bottom: 24px;
}

.input-field {
    width: 100%;
    padding: 16px 20px;
    font-size: 1.05rem;
    font-family: 'Outfit', sans-serif;
    border: 2px solid hsl(260, 30%, 85%);
    border-radius: 12px;
    background: white;
    color: hsl(260, 50%, 20%);
    transition: all 0.3s ease;
    outline: none;
}

.input-field:focus {
    border-color: hsl(280, 70%, 55%);
    box-shadow: 0 0 0 4px hsla(280, 70%, 55%, 0.1);
}

.input-field::placeholder {
    color: hsl(260, 20%, 60%);
}

/* PIN Pad Styles */
.pin-display {
    display: flex;
    justify-content: center;
    gap: 16px;
    margin-bottom: 24px;
}

.pin-dot {
    width: 16px;
    height: 16px;
    background: hsl(260, 20%, 85%);
    border-radius: 50%;
    transition: all 0.2s ease;
}

.pin-dot.filled {
    background: hsl(280, 70%, 55%);
    transform: scale(1.2);
    box-shadow: 0 0 10px hsla(280, 70%, 55%, 0.4);
}

.pin-dot.error {
    background: hsl(0, 70%, 55%);
    animation: shake 0.4s;
}

.pin-pad {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
    max-width: 280px;
    margin: 0 auto;
}

.pin-btn {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    border: none;
    font-size: 1.5rem;
    font-weight: 600;
    color: hsl(260, 60%, 30%);
    background: rgba(255, 255, 255, 0.5);
    cursor: pointer;
    transition: all 0.1s ease;
    display: flex;
    justify-content: center;
    align-items: center;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.05); /* Sombra sutil */
}

.pin-btn:active {
    background: hsl(280, 70%, 95%);
    transform: scale(0.95);
}

.pin-btn:disabled {
    cursor: default;
    background: transparent;
    box-shadow: none;
}

.delete-btn {
    font-size: 1.2rem;
    color: hsl(0, 60%, 50%);
}

.pin-btn:hover:not(:disabled) {
    background: rgba(255, 255, 255, 0.8);
}

/* Ensure centering on mobile */
@media (max-width: 480px) {
    .card {
        padding: 24px 16px;
    }
    
    .pin-pad {
        gap: 12px;
    }
    
    .pin-btn {
        width: 56px;
        height: 56px;
        font-size: 1.25rem;
    }
}

/* Buttons */
.btn {
    width: 100%;
    padding: 16px 24px;
    font-size: 1.1rem;
    font-weight: 700;
    font-family: 'Outfit', sans-serif;
    border: none;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.3s ease;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    outline: none;
    position: relative;
    overflow: hidden;
}

.btn::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.3);
    transform: translate(-50%, -50%);
    transition: width 0.6s, height 0.6s;
}

.btn:active::before {
    width: 300px;
    height: 300px;
}

.btn-primary {
    background: linear-gradient(135deg, hsl(280, 70%, 55%), hsl(320, 75%, 60%));
    color: white;
    box-shadow: 0 4px 15px hsla(300, 70%, 50%, 0.4);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px hsla(300, 70%, 50%, 0.5);
}

.btn-primary:active {
    transform: translateY(0);
}

.btn-secondary {
    background: white;
    color: hsl(280, 70%, 55%);
    border: 2px solid hsl(280, 70%, 55%);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    margin-top: 12px;
}

.btn-secondary:hover {
    background: hsl(280, 70%, 55%);
    color: white;
    transform: translateY(-2px);
}

/* Mode Selection */
.mode-options {
    display: flex;
    flex-direction: column;
    gap: 16px;
    margin-bottom: 24px;
}

.mode-card {
    background: linear-gradient(135deg, hsl(280, 60%, 96%), hsl(300, 60%, 98%));
    border: 2px solid hsl(280, 40%, 90%);
    border-radius: 16px;
    padding: 24px;
    cursor: pointer;
    transition: all 0.3s ease;
    text-align: center;
    width: 100%;
}

.mode-card:hover {
    transform: translateY(-4px);
    border-color: hsl(280, 70%, 55%);
    box-shadow: 0 8px 24px hsla(280, 70%, 50%, 0.2);
    background: linear-gradient(135deg, hsl(280, 70%, 98%), hsl(300, 70%, 99%));
}

.mode-icon {
    font-size: 3rem;
    margin-bottom: 12px;
}

.mode-title {
    font-size: 1.3rem;
    font-weight: 700;
    color: hsl(260, 70%, 30%);
    margin-bottom: 8px;
}

.mode-description {
    font-size: 0.95rem;
    color: hsl(260, 30%, 50%);
    line-height: 1.4;
}

/* Configuration Section */
.config-section {
    margin-bottom: 28px;
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

.badge {
    background: hsl(280, 70%, 90%);
    color: hsl(280, 70%, 55%);
    padding: 4px 12px;
    border-radius: 12px;
    font-weight: 700;
    font-size: 0.9rem;
}

.players-inputs-container {
    display: flex;
    flex-direction: column;
    gap: 12px;
    max-height: 300px;
    overflow-y: auto;
    padding-right: 4px;
    margin-bottom: 16px;
}

.player-input-row {
    display: flex;
    gap: 8px;
    animation: slideIn 0.3s ease-out;
}

@keyframes slideIn {
    from { opacity: 0; transform: translateX(-10px); }
    to { opacity: 1; transform: translateX(0); }
}

.player-name-input {
    flex: 1;
    padding: 12px 16px;
    border: 2px solid hsl(260, 20%, 90%);
    border-radius: 12px;
    font-family: 'Outfit', sans-serif;
    font-size: 1rem;
    outline: none;
    transition: all 0.2s;
}

.player-name-input:focus {
    border-color: hsl(280, 70%, 55%);
}

.remove-player-btn {
    width: 44px;
    height: 44px; /* Matches input height roughly */
    display: flex;
    align-items: center;
    justify-content: center;
    background: hsl(0, 70%, 95%);
    color: hsl(0, 70%, 50%);
    border: none;
    border-radius: 12px;
    cursor: pointer;
    font-size: 1.2rem;
    transition: all 0.2s;
}

.remove-player-btn:hover {
    background: hsl(0, 70%, 50%);
    color: white;
}

.btn-small {
    padding: 12px;
    font-size: 0.9rem;
}

.number-input {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 24px;
}

.number-btn {
    width: 48px;
    height: 48px;
    font-size: 1.5rem;
    font-weight: 700;
    border: 2px solid hsl(280, 70%, 55%);
    border-radius: 12px;
    background: white;
    color: hsl(280, 70%, 55%);
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.number-btn:hover {
    background: hsl(280, 70%, 55%);
    color: white;
    transform: scale(1.1);
}

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

.number-display {
    font-size: 2rem;
    font-weight: 700;
    color: hsl(260, 70%, 30%);
    min-width: 60px;
    text-align: center;
}

/* Role Reveal */
.reveal-card {
    text-align: center;
    min-height: 400px;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.player-turn-header {
    margin-bottom: 24px;
}

.turn-label {
    display: block;
    font-size: 0.9rem;
    text-transform: uppercase;
    color: hsl(260, 40%, 60%);
    margin-bottom: 4px;
    letter-spacing: 1px;
}

.current-player-name {
    font-size: 2rem;
    font-weight: 800;
    color: hsl(280, 70%, 55%);
    line-height: 1.2;
}

.player-number {
    display: none; /* Deprecated */
}

.role-display {
    padding: 40px 20px;
    margin-bottom: 24px;
    cursor: pointer;
    transition: all 0.3s ease;
    border-radius: 16px;
}

.role-display:hover {
    background: hsla(280, 50%, 95%, 0.5);
}

.role-icon {
    font-size: 5rem;
    margin-bottom: 16px;
    animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.05); }
}

.role-text {
    font-size: 1.5rem;
    font-weight: 700;
    color: hsl(260, 60%, 30%);
}

.role-impostor {
    background: linear-gradient(135deg, hsl(0, 70%, 95%), hsl(10, 70%, 95%));
    border: 3px solid hsl(0, 70%, 50%);
}

.role-impostor .role-icon {
    font-size: 6rem;
}

.role-impostor .role-text {
    color: hsl(0, 70%, 40%);
    font-size: 2rem;
}

.role-innocent {
    background: linear-gradient(135deg, hsl(140, 60%, 95%), hsl(160, 60%, 95%));
    border: 3px solid hsl(150, 60%, 45%);
}

.role-innocent .role-icon {
    font-size: 6rem;
}

.role-innocent .role-text {
    color: hsl(150, 60%, 30%);
    font-size: 2rem;
}

/* Secret Word Display */
.secret-word {
    margin: 24px 0;
    padding: 24px;
    background: white;
    border-radius: 12px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.word-label {
    font-size: 1rem;
    font-weight: 600;
    color: hsl(150, 40%, 40%);
    margin-bottom: 8px;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.word-display {
    font-size: 2.5rem;
    font-weight: 800;
    color: hsl(150, 60%, 35%);
    margin: 0;
    text-transform: uppercase;
    letter-spacing: 2px;
    animation: wordPulse 2s ease-in-out infinite;
}

@keyframes wordPulse {
    0%, 100% { 
        transform: scale(1);
        text-shadow: 0 2px 8px hsla(150, 60%, 35%, 0.3);
    }
    50% { 
        transform: scale(1.05);
        text-shadow: 0 4px 16px hsla(150, 60%, 35%, 0.5);
    }
}

.role-instruction {
    font-size: 0.95rem;
    color: hsl(260, 40%, 50%);
    margin-top: 16px;
    font-style: italic;
    line-height: 1.4;
}

/* Share Section */
.share-section {
    margin-bottom: 32px;
}

.share-code {
    background: linear-gradient(135deg, hsl(280, 70%, 55%), hsl(320, 75%, 60%));
    padding: 20px;
    border-radius: 12px;
    margin-bottom: 16px;
    text-align: center;
}

.share-code span {
    font-size: 2rem;
    font-weight: 800;
    color: white;
    letter-spacing: 4px;
}

/* Players Waiting */
.players-waiting {
    margin-bottom: 24px;
}

.players-list {
    background: hsl(280, 40%, 97%);
    border-radius: 12px;
    padding: 16px;
    max-height: 200px;
    overflow-y: auto;
}

.player-item {
    padding: 12px 16px;
    background: white;
    border-radius: 8px;
    margin-bottom: 8px;
    font-weight: 600;
    color: hsl(260, 60%, 30%);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.player-item:last-child {
    margin-bottom: 0;
}

/* Responsive Design */
@media (max-width: 480px) {
    .container {
        padding: 16px;
    }
    
    .card {
        padding: 32px 24px;
        border-radius: 20px;
    }
    
    .logo {
        font-size: 3rem;
    }
    
    .mode-card {
        padding: 20px;
    }
    
    .mode-icon {
        font-size: 2.5rem;
    }
    
    .number-btn {
        width: 44px;
        height: 44px;
    }
    
    .number-display {
        font-size: 1.75rem;
    }
    
    .word-display {
        font-size: 2rem;
    }
    
    .secret-word {
        padding: 20px;
    }
}

@media (max-height: 600px) and (orientation: landscape) {
    .container {
        padding: 12px;
    }
    
    .card {
        padding: 24px 20px;
    }
    
    .logo {
        font-size: 2.5rem;
        margin-bottom: 8px;
    }
    
    .title {
        font-size: 1.5rem;
        margin-bottom: 8px;
    }
    
    .subtitle {
        margin-bottom: 16px;
    }
}

/* Tablet */
@media (min-width: 481px) and (max-width: 768px) {
    .card {
        max-width: 600px;
    }
}

/* Desktop */
@media (min-width: 769px) {
    .mode-options {
        flex-direction: row;
    }
    
    .mode-card {
        flex: 1;
    }
}
