* {
    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, #1a1a2e 0%, #16213e 100%);
    color: #e0e0e0;
    min-height: 100vh;
    padding: 20px;
}

.container {
    max-width: 600px;
    margin: 0 auto;
}

.screen {
    display: none;
    animation: fadeIn 0.3s ease-in;
}

.screen.active {
    display: block;
}

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

h1 {
    font-size: 2.5rem;
    text-align: center;
    margin-bottom: 10px;
    color: #fff;
    text-shadow: 0 0 20px rgba(138, 43, 226, 0.5);
}

h2 {
    font-size: 1.5rem;
    margin: 25px 0 15px;
    color: #fff;
}

.subtitle {
    text-align: center;
    color: #b0b0b0;
    margin-bottom: 30px;
    font-size: 1.1rem;
}

.current-player {
    text-align: center;
    color: #8a2be2;
    font-size: 2rem;
    margin: 20px 0;
}

/* Buttons */
.btn {
    padding: 12px 24px;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.btn-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

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

.btn-success {
    background: linear-gradient(135deg, #11998e 0%, #38ef7d 100%);
    color: white;
}

.btn-success:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 20px rgba(56, 239, 125, 0.4);
}

.btn-danger {
    background: linear-gradient(135deg, #eb3349 0%, #f45c43 100%);
    color: white;
}

.btn-danger:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 20px rgba(235, 51, 73, 0.4);
}

.btn-warning {
    background: linear-gradient(135deg, #f2994a 0%, #f2c94c 100%);
    color: #1a1a2e;
}

.btn-warning:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 20px rgba(242, 153, 74, 0.4);
}

.btn-reveal {
    background: linear-gradient(135deg, #8a2be2 0%, #da22ff 100%);
    color: white;
    font-size: 1.3rem;
    padding: 20px 40px;
    width: 100%;
    margin: 20px 0;
}

.btn-reveal:hover {
    transform: scale(1.05);
    box-shadow: 0 10px 30px rgba(138, 43, 226, 0.5);
}

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

.btn-small {
    padding: 6px 12px;
    margin-top: 0;
    font-size: 0.8rem;
}

/* Input Group */
.input-group {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
}

input[type="text"] {
    flex: 1;
    padding: 12px;
    border: 2px solid #3a3a5c;
    border-radius: 8px;
    background: #252541;
    color: #e0e0e0;
    font-size: 1rem;
}

input[type="text"]:focus {
    outline: none;
    border-color: #8a2be2;
    box-shadow: 0 0 10px rgba(138, 43, 226, 0.3);
}

/* Player List */
.player-list {
    list-style: none;
    background: #252541;
    border-radius: 8px;
    padding: 10px;
    max-height: 300px;
    overflow-y: auto;
}

.player-list li {
    display: flex;
    align-items: center;
    padding: 12px;
    margin: 5px 0;
    background: #2f2f4a;
    border-radius: 6px;
    cursor: grab;
}

.player-list li .player-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
}

.player-list li.dragging {
    background: #4a4a6a;
}

.player-list li .drag-handle {
    margin-right: 10px;
    cursor: grab;
    color: #aaa;
}

.player-list li span {
    font-size: 1.1rem;
}

.grabbing, .grabbing * {
    cursor: grabbing !important;
}

/* Game Settings */
.game-settings {
    background: #252541;
    padding: 20px;
    border-radius: 8px;
    margin: 20px 0;
}

.setting-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin: 15px 0;
}

.setting-item label {
    font-size: 1rem;
    color: #e0e0e0;
}

select {
    padding: 8px 16px;
    border: 2px solid #3a3a5c;
    border-radius: 6px;
    background: #2f2f4a;
    color: #e0e0e0;
    font-size: 1rem;
    cursor: pointer;
}

select:focus {
    outline: none;
    border-color: #8a2be2;
}

/* Reveal Area */
.reveal-area {
    text-align: center;
    margin: 40px 0;
}

.role-display {
    margin: 20px 0;
}

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

.reveal-area.hidden {
    display: none;
}

/* Role Cards */
.role-card {
    padding: 30px;
    border-radius: 12px;
    text-align: center;
    margin: 20px 0;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
}

.role-card.imposter {
    background: linear-gradient(135deg, #8a2be2 0%, #da22ff 100%);
    border: 3px solid #ff00ff;
}

.role-card.undercover {
    background: linear-gradient(135deg, #f2994a 0%, #f2c94c 100%);
    border: 3px solid #ffaa00;
    color: #1a1a2e;
}

.role-card.civilian {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border: 3px solid #667eea;
}

.role-card h2 {
    font-size: 2rem;
    margin-bottom: 15px;
}

.word {
    font-size: 2.5rem;
    font-weight: bold;
    margin: 20px 0;
    text-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
}

.role-hint {
    font-size: 1rem;
    margin-top: 15px;
    opacity: 0.9;
}

/* Active Players List */
.active-players-list {
    list-style: none;
    background: #252541;
    border-radius: 8px;
    padding: 10px;
}

.active-players-list li {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px;
    margin: 8px 0;
    background: #2f2f4a;
    border-radius: 6px;
    border-left: 4px solid #8a2be2;
}

.player-name {
    font-size: 1.2rem;
    font-weight: 600;
    padding: 0px 12px;
}

.start-player-result {
    margin-top: 20px;
    padding: 20px;
    border: 2px dashed #8a2be2;
    border-radius: 8px;
    text-align: center;
    min-height: 100px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    overflow: hidden;
}

.player-shuffler {
    animation: shuffle 0.1s linear infinite;
}

.player-shuffler .shuffling-player {
    font-size: 2rem;
    color: #e0e0e0;
}

.final-player {
    font-size: 2.5rem;
    font-weight: bold;
    color: #38ef7d;
    animation: zoomIn 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes shuffle {
    from { transform: translateY(-10px); }
    to { transform: translateY(10px); }
}

@keyframes zoomIn {
    from {
        transform: scale(0.5);
        opacity: 0;
    }
    to {
        transform: scale(1);
        opacity: 1;
    }
}

/* Game Info */
.game-info {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    padding: 20px;
    border-radius: 8px;
    margin: 20px 0;
    text-align: center;
}

.game-info p {
    font-size: 1.1rem;
    margin: 0;
}

.round-indicator {
    font-size: 1.2rem;
    font-weight: bold;
    color: #f2c94c;
    margin-bottom: 10px;
}

/* Winner Message */
.winner-message {
    background: linear-gradient(135deg, #11998e 0%, #38ef7d 100%);
    padding: 30px;
    border-radius: 12px;
    text-align: center;
    margin: 20px 0;
    font-size: 1.3rem;
    font-weight: 600;
}

/* All Roles List */
.all-roles-list {
    list-style: none;
    background: #252541;
    border-radius: 8px;
    padding: 10px;
    margin: 20px 0;
}

.role-item {
    display: grid;
    grid-template-columns: 1fr auto auto auto;
    gap: 10px;
    padding: 15px;
    margin: 8px 0;
    background: #2f2f4a;
    border-radius: 6px;
    align-items: center;
}

.role-item.imposter {
    border-left: 4px solid #8a2be2;
}

.role-item.undercover {
    border-left: 4px solid #f2994a;
}

.role-item.civilian {
    border-left: 4px solid #667eea;
}

.role-item.eliminated {
    opacity: 0.6;
}

.role-badge {
    padding: 6px 12px;
    border-radius: 6px;
    font-size: 0.85rem;
    font-weight: 600;
    text-transform: uppercase;
}

.role-item.imposter .role-badge {
    background: #8a2be2;
    color: white;
}

.role-item.undercover .role-badge {
    background: #f2994a;
    color: #1a1a2e;
}

.role-item.civilian .role-badge {
    background: #667eea;
    color: white;
}

.word-badge {
    padding: 6px 12px;
    background: #3a3a5c;
    border-radius: 6px;
    font-size: 0.9rem;
}

.status-badge {
    padding: 6px 12px;
    border-radius: 6px;
    font-size: 0.85rem;
    font-weight: 600;
}

.role-item.active .status-badge {
    background: #38ef7d;
    color: #1a1a2e;
}

.role-item.eliminated .status-badge {
    background: #eb3349;
    color: white;
}

.modal-buttons {
    display: flex;
    justify-content: center;
    gap: 15px;
    margin-top: 25px;
}

.modal-buttons .btn {
    min-width: 120px;
    padding: 12px 24px;
    font-size: 1rem;
}

/* Responsive Design */
@media (max-width: 600px) {
    body {
        padding: 10px;
    }

    .input-group {
        flex-direction: column;
    }
    
    h1 {
        font-size: 2rem;
    }
    
    h2 {
        font-size: 1.3rem;
    }
    
    .word {
        font-size: 2rem;
    }
    
    .role-item {
        grid-template-columns: 1fr;
        gap: 8px;
    }
    
    .role-badge,
    .word-badge,
    .status-badge {
        text-align: center;
    }
}

/* Modal Styles */
.modal {
    display: none;
    position: fixed;
    z-index: 100;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    align-items: flex-start;
    justify-content: center;
    overflow-y: auto;
    background-color: rgba(0, 0, 0, 0.7);
    animation: fadeIn 0.3s;
}

.modal-content {
    background: #252541;
    margin: 20px auto;
    padding: 30px;
    border: 1px solid #8a2be2;
    border-radius: 12px;
    max-width: 90%;
    width: 500px;
    max-height: calc(100vh - 40px);
    overflow-y: auto;
    position: relative;
    box-shadow: 0 10px 40px rgba(0,0,0,0.4);
}

.modal-content h2 {
    margin-top: 0;
    color: #fff;
}

.modal-content p, .modal-content ul, .modal-content ol {
    margin-bottom: 15px;
    line-height: 1.6;
}

.modal-content ul, .modal-content ol {
    padding-left: 20px;
}

.modal-content strong {
    color: #8a2be2;
}

.close-button {
    color: #aaa;
    float: right;
    font-size: 28px;
    font-weight: bold;
    position: absolute;
    top: 15px;
    right: 25px;
}

.close-button:hover,
.close-button:focus {
    color: #fff;
    text-decoration: none;
    cursor: pointer;
}