* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 20px;
}

.container {
    width: 100%;
    max-width: 600px;
}

.screen {
    display: none;
    background: white;
    border-radius: 20px;
    padding: 40px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    animation: fadeIn 0.3s ease-in;
}

.screen.active {
    display: block;
}

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

h1 {
    font-size: 2.5rem;
    text-align: center;
    color: #333;
    margin-bottom: 10px;
}

h2 {
    font-size: 1.8rem;
    color: #333;
    margin-bottom: 20px;
    text-align: center;
}

h3 {
    font-size: 1.3rem;
    color: #555;
    margin: 20px 0 10px;
}

.subtitle {
    text-align: center;
    color: #666;
    margin-bottom: 40px;
}

.game-select {
    margin-top: 30px;
}

.game-btn {
    width: 100%;
    padding: 20px;
    font-size: 1.2rem;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    border-radius: 12px;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
    margin-bottom: 15px;
}

.game-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(102, 126, 234, 0.4);
}

.action-buttons {
    display: flex;
    gap: 15px;
    margin-bottom: 30px;
}

.btn-primary,
.btn-secondary,
.btn-back {
    padding: 12px 24px;
    font-size: 1rem;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
    font-weight: 500;
}

.btn-primary {
    background: #667eea;
    color: white;
}

.btn-primary:hover:not(:disabled) {
    background: #5568d3;
    transform: translateY(-1px);
}

.btn-primary:disabled {
    background: #ccc;
    cursor: not-allowed;
}

.btn-secondary {
    background: #f0f0f0;
    color: #333;
    flex: 1;
}

.btn-secondary:hover {
    background: #e0e0e0;
}

.btn-large {
    width: 100%;
    padding: 16px;
    font-size: 1.1rem;
    margin-top: 20px;
}

.btn-back {
    background: transparent;
    color: #667eea;
    margin-top: 20px;
    padding: 10px;
}

.btn-back:hover {
    background: #f0f0f0;
}

.form-section {
    margin-top: 20px;
}

.form-section.hidden {
    display: none;
}

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

.host-header h3 {
    margin: 0;
}

.btn-toggle-roles {
    background: #667eea;
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.9rem;
    transition: all 0.2s;
}

.btn-toggle-roles:hover {
    background: #5568d3;
}

.btn-toggle-roles.hidden {
    display: none;
}

input[type="text"] {
    width: 100%;
    padding: 12px;
    font-size: 1rem;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    margin-bottom: 10px;
    transition: border-color 0.2s;
}

input[type="text"]:focus {
    outline: none;
    border-color: #667eea;
}

.room-code-display {
    text-align: center;
    background: #f8f9fa;
    padding: 15px;
    border-radius: 8px;
    margin-bottom: 20px;
    font-size: 1.1rem;
    font-weight: 600;
    color: #667eea;
}

.room-code-display span {
    font-size: 1.5rem;
    letter-spacing: 3px;
}

.player-input-group {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
}

.player-input-group input {
    flex: 1;
    margin-bottom: 0;
}

.player-input-group button {
    white-space: nowrap;
}

.player-list {
    margin: 20px 0;
    max-height: 300px;
    overflow-y: auto;
}

.player-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px;
    background: #f8f9fa;
    border-radius: 8px;
    margin-bottom: 8px;
}

.player-item span {
    font-size: 1rem;
    color: #333;
}

.player-role {
    display: inline-block;
    margin-left: 10px;
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 0.85rem;
    font-weight: 500;
}

.player-role.mafia {
    background: #ff4757;
    color: white;
}

.player-role.police {
    background: #3742fa;
    color: white;
}

.player-role.doctor {
    background: #2ed573;
    color: white;
}

.player-role.citizen {
    background: #ced6e0;
    color: #333;
}

.player-role.hidden {
    display: none;
}

.remove-player-btn {
    background: #ff4757;
    color: white;
    border: none;
    padding: 6px 12px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.9rem;
}

.remove-player-btn:hover {
    background: #ee3344;
}

.player-name-list {
    display: grid;
    gap: 12px;
    margin-top: 20px;
}

.player-name-btn {
    padding: 16px;
    font-size: 1.1rem;
    background: #f8f9fa;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
}

.player-name-btn:hover {
    background: #667eea;
    color: white;
    border-color: #667eea;
    transform: translateY(-2px);
}

.player-info {
    text-align: center;
    margin: 30px 0;
}

.player-name-display {
    font-size: 1.2rem;
    color: #666;
    margin-bottom: 20px;
}

.role-card {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 40px;
    border-radius: 16px;
    box-shadow: 0 10px 30px rgba(102, 126, 234, 0.3);
    margin: 20px 0;
}

.role-name {
    font-size: 2rem;
    font-weight: bold;
    margin-bottom: 15px;
}

.role-description {
    font-size: 1rem;
    line-height: 1.6;
    opacity: 0.95;
}

/* Waiting Screen */
.waiting-message {
    text-align: center;
    padding: 40px 20px;
}

.waiting-message p {
    font-size: 1.2rem;
    color: #666;
    margin-bottom: 20px;
}

.loading-dots {
    display: flex;
    justify-content: center;
    gap: 8px;
}

.loading-dots span {
    width: 12px;
    height: 12px;
    background: #667eea;
    border-radius: 50%;
    animation: bounce 1.4s infinite ease-in-out both;
}

.loading-dots span:nth-child(1) {
    animation-delay: -0.32s;
}

.loading-dots span:nth-child(2) {
    animation-delay: -0.16s;
}

@keyframes bounce {
    0%, 80%, 100% {
        transform: scale(0);
    }
    40% {
        transform: scale(1);
    }
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.6);
    animation: fadeIn 0.3s ease-in;
}

.modal.active {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 20px;
}

.modal-content {
    background: white;
    padding: 40px;
    border-radius: 20px;
    max-width: 600px;
    max-height: 80vh;
    overflow-y: auto;
    position: relative;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
}

.close-modal {
    position: absolute;
    right: 20px;
    top: 20px;
    font-size: 2rem;
    cursor: pointer;
    color: #999;
    transition: color 0.2s;
}

.close-modal:hover {
    color: #333;
}

#rules-content ul {
    margin-left: 20px;
    margin-bottom: 15px;
}

#rules-content li {
    margin-bottom: 8px;
    line-height: 1.6;
}

#rules-content p {
    margin-bottom: 10px;
    line-height: 1.6;
}

/* Imposter Word Card Variants */
.role-card.word {
    background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
}

.role-card.imposter {
    background: linear-gradient(135deg, #434343 0%, #000000 100%);
}

/* Voting Screen */
.voting-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin: 20px 0;
}

.vote-button {
    width: 100%;
    padding: 16px;
    font-size: 1.1rem;
    background: #f8f9fa;
    color: #333;
    border: 2px solid #e0e0e0;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.3s;
    font-weight: 500;
}

.vote-button:hover:not(:disabled) {
    background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
    color: white;
    border-color: #f093fb;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(240, 147, 251, 0.4);
}

.vote-button:disabled {
    background: #e0e0e0;
    color: #999;
    cursor: not-allowed;
    border-color: #d0d0d0;
}

.voting-status {
    margin-top: 20px;
    padding: 15px;
    background: #f8f9fa;
    border-radius: 8px;
}

/* Results Screen */
.results-container {
    margin: 30px 0;
}

.results-main {
    text-align: center;
    margin-bottom: 30px;
}

.secret-word-reveal {
    background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
    padding: 30px;
    border-radius: 16px;
    margin-bottom: 20px;
}

.secret-word-reveal h3 {
    color: white;
    margin: 0 0 10px 0;
    font-size: 1.2rem;
}

.secret-word {
    font-size: 2.5rem;
    font-weight: bold;
    color: white;
    text-transform: uppercase;
    letter-spacing: 2px;
}

.imposter-reveal {
    background: linear-gradient(135deg, #434343 0%, #000000 100%);
    padding: 30px;
    border-radius: 16px;
    margin-bottom: 20px;
}

.imposter-reveal h3 {
    color: white;
    margin: 0 0 10px 0;
    font-size: 1.2rem;
}

.imposter-name {
    font-size: 2rem;
    font-weight: bold;
    color: white;
}

.outcome {
    padding: 20px;
    border-radius: 12px;
    background: #f8f9fa;
}

.outcome h3 {
    margin: 0;
    font-size: 1.5rem;
}

.results-details {
    margin-top: 30px;
}

.results-details h3 {
    text-align: center;
    margin-bottom: 15px;
    color: #555;
}

.vote-results-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.vote-result-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px;
    background: #f8f9fa;
    border-radius: 10px;
    border: 2px solid #e0e0e0;
}

.vote-result-item span {
    font-size: 1rem;
    color: #333;
}

.vote-count {
    background: #667eea;
    color: white;
    padding: 6px 12px;
    border-radius: 8px;
    font-weight: 600;
    font-size: 0.95rem !important;
}

/* Hide voting button initially */
#start-voting-btn {
    display: none;
}

/* Responsive */
@media (max-width: 600px) {
    .screen {
        padding: 30px 20px;
    }

    h1 {
        font-size: 2rem;
    }

    h2 {
        font-size: 1.5rem;
    }

    .action-buttons {
        flex-direction: column;
    }

    .modal-content {
        padding: 30px 20px;
    }

    .secret-word {
        font-size: 2rem;
    }

    .imposter-name {
        font-size: 1.5rem;
    }
}
