/* Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary-color: #6C63FF;
    --secondary-color: #FF6584;
    --accent-color: #4CAF50;
    --dark-bg: #1a1a2e;
    --card-bg: #16213e;
    --text-light: #ffffff;
    --text-muted: #a8a8a8;
    --success: #4CAF50;
    --warning: #FFA726;
    --danger: #EF5350;
    --gradient-1: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    --gradient-2: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
    --gradient-3: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);
    --shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
    --shadow-hover: 0 15px 50px rgba(0, 0, 0, 0.4);
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: var(--dark-bg);
    color: var(--text-light);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 20px;
    overflow-x: hidden;
}

/* Animated Background */
.background-animation {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(45deg, #1a1a2e, #0f3460, #16213e);
    background-size: 400% 400%;
    animation: gradientShift 15s ease infinite;
    z-index: -1;
}

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

/* Container */
.container {
    max-width: 800px;
    width: 100%;
    position: relative;
    z-index: 1;
}

/* Screen Management */
.screen {
    background: var(--card-bg);
    border-radius: 20px;
    padding: 40px;
    box-shadow: var(--shadow);
    display: none;
    animation: fadeIn 0.5s ease;
}

.screen.active {
    display: block;
}

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

/* Logo and Header */
.logo {
    text-align: center;
    margin-bottom: 30px;
}

.logo h1 {
    font-size: 3.5em;
    background: var(--gradient-1);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 10px;
    text-shadow: 0 0 30px rgba(108, 99, 255, 0.5);
}

.subtitle {
    font-size: 1.2em;
    color: var(--text-muted);
    font-weight: 300;
}

/* Game Description */
.game-description {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 15px;
    padding: 25px;
    margin-bottom: 30px;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.game-description h3 {
    color: var(--primary-color);
    margin-bottom: 15px;
    font-size: 1.5em;
}

.game-description ul {
    list-style: none;
    padding: 0;
}

.game-description li {
    padding: 10px 0;
    padding-left: 30px;
    position: relative;
    line-height: 1.6;
}

.game-description li::before {
    content: "▶";
    position: absolute;
    left: 0;
    color: var(--primary-color);
}

/* Player Selection */
.player-selection {
    margin-bottom: 30px;
}

.player-selection label {
    display: block;
    margin-bottom: 15px;
    font-size: 1.2em;
    text-align: center;
    color: var(--text-muted);
}

.player-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    justify-content: center;
}

.player-btn {
    width: 60px;
    height: 60px;
    border: 2px solid var(--primary-color);
    background: transparent;
    color: var(--text-light);
    font-size: 1.5em;
    border-radius: 15px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-weight: bold;
}

.player-btn:hover {
    background: var(--primary-color);
    transform: scale(1.1);
    box-shadow: 0 5px 20px rgba(108, 99, 255, 0.4);
}

.player-btn.selected {
    background: var(--gradient-1);
    border-color: transparent;
    transform: scale(1.15);
    box-shadow: 0 5px 20px rgba(108, 99, 255, 0.6);
}

/* Buttons */
.btn {
    width: 100%;
    padding: 18px 40px;
    border: none;
    border-radius: 50px;
    font-size: 1.1em;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-top: 10px;
}

.btn-primary {
    background: var(--gradient-1);
    color: var(--text-light);
    box-shadow: 0 5px 20px rgba(108, 99, 255, 0.4);
}

.btn-primary:hover:not(:disabled) {
    transform: translateY(-3px);
    box-shadow: var(--shadow-hover);
}

.btn-primary:disabled {
    background: #555;
    cursor: not-allowed;
    opacity: 0.5;
}

.btn-secondary {
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-light);
    border: 2px solid rgba(255, 255, 255, 0.2);
}

.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: translateY(-3px);
}

/* Distribution Screen */
.distribution-header {
    text-align: center;
    margin-bottom: 30px;
}

.distribution-header h2 {
    font-size: 2.5em;
    margin-bottom: 10px;
    background: var(--gradient-2);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.role-info {
    color: var(--text-muted);
    font-size: 1.1em;
}

.player-card {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 20px;
    padding: 40px;
    text-align: center;
    border: 2px solid rgba(255, 255, 255, 0.1);
    margin-bottom: 20px;
}

.player-number {
    font-size: 3em;
    font-weight: bold;
    margin-bottom: 30px;
    background: var(--gradient-3);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.word-display {
    margin: 30px 0;
    padding: 30px;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 15px;
    border: 3px dashed var(--primary-color);
    animation: pulse 2s ease infinite;
}

@keyframes pulse {
    0%, 100% { border-color: var(--primary-color); }
    50% { border-color: var(--secondary-color); }
}

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

.word-container h3 {
    font-size: 3em;
    margin-bottom: 15px;
    color: var(--accent-color);
    text-shadow: 0 0 20px rgba(76, 175, 80, 0.5);
}

.word-container p {
    font-size: 1.3em;
    color: var(--text-muted);
}

.hidden {
    display: none;
}

.progress-indicator {
    text-align: center;
    padding: 20px;
    font-size: 1.2em;
    color: var(--text-muted);
}

/* Game Play Screen */
.game-header {
    text-align: center;
    margin-bottom: 30px;
}

.game-header h2 {
    font-size: 2.5em;
    margin-bottom: 10px;
}

.game-header p {
    color: var(--text-muted);
    font-size: 1.1em;
}

.game-info {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.info-card {
    background: rgba(255, 255, 255, 0.05);
    padding: 20px;
    border-radius: 15px;
    text-align: center;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.info-card h4 {
    font-size: 1em;
    color: var(--text-muted);
    margin-bottom: 10px;
}

.info-card p {
    font-size: 2em;
    font-weight: bold;
    background: var(--gradient-1);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.game-rules {
    background: rgba(255, 255, 255, 0.05);
    padding: 25px;
    border-radius: 15px;
    margin-bottom: 30px;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.game-rules h3 {
    color: var(--secondary-color);
    margin-bottom: 15px;
}

.game-rules ol {
    padding-left: 20px;
}

.game-rules li {
    padding: 8px 0;
    line-height: 1.6;
}

.voting-section {
    background: rgba(255, 255, 255, 0.05);
    padding: 25px;
    border-radius: 15px;
    margin-bottom: 30px;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.voting-section h3 {
    margin-bottom: 20px;
    text-align: center;
    color: var(--warning);
}

.player-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 15px;
}

.player-item {
    background: rgba(255, 255, 255, 0.08);
    padding: 15px;
    border-radius: 10px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border: 2px solid transparent;
    transition: all 0.3s ease;
}

.player-item:hover {
    border-color: var(--primary-color);
    transform: translateY(-2px);
}

.player-item.eliminated {
    opacity: 0.4;
    background: rgba(239, 83, 80, 0.2);
    border-color: var(--danger);
}

.player-item span {
    font-size: 1.1em;
    font-weight: 500;
}

.eliminate-btn {
    padding: 8px 20px;
    background: var(--danger);
    color: white;
    border: none;
    border-radius: 20px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 0.9em;
}

.eliminate-btn:hover:not(:disabled) {
    background: #d32f2f;
    transform: scale(1.05);
}

.eliminate-btn:disabled {
    background: #777;
    cursor: not-allowed;
}

.action-buttons {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
}

/* Reveal Screen */
.reveal-header {
    text-align: center;
    margin-bottom: 30px;
}

.reveal-header h2 {
    font-size: 2.5em;
    background: var(--gradient-2);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.reveal-content {
    margin-bottom: 30px;
}

.reveal-player {
    background: rgba(255, 255, 255, 0.05);
    padding: 20px;
    margin-bottom: 15px;
    border-radius: 15px;
    border-left: 4px solid var(--primary-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.reveal-player.mr-white {
    border-left-color: var(--danger);
    background: rgba(239, 83, 80, 0.1);
}

.reveal-player.undercover {
    border-left-color: var(--warning);
    background: rgba(255, 167, 38, 0.1);
}

.reveal-player.civilian {
    border-left-color: var(--success);
    background: rgba(76, 175, 80, 0.1);
}

.reveal-player-name {
    font-size: 1.3em;
    font-weight: bold;
}

.reveal-role {
    font-size: 1em;
    padding: 8px 15px;
    border-radius: 20px;
    background: rgba(255, 255, 255, 0.1);
}

.reveal-word {
    font-size: 1.2em;
    color: var(--accent-color);
    font-weight: 500;
}

/* Responsive Design */
@media (max-width: 768px) {
    .screen {
        padding: 25px;
    }

    .logo h1 {
        font-size: 2.5em;
    }

    .player-btn {
        width: 50px;
        height: 50px;
        font-size: 1.2em;
    }

    .word-container h3 {
        font-size: 2em;
    }

    .action-buttons {
        grid-template-columns: 1fr;
    }

    .player-list {
        grid-template-columns: 1fr;
    }

    .game-info {
        grid-template-columns: 1fr;
    }

    .modal-content {
        margin: 10% auto;
        padding: 25px;
        max-width: 95%;
    }

    .player-names-form {
        grid-template-columns: 1fr;
    }

    .header-buttons {
        flex-direction: column;
        width: 100%;
    }

    .icon-btn {
        width: 100%;
    }
}

@media (max-width: 480px) {
    body {
        padding: 10px;
    }

    .screen {
        padding: 20px;
    }

    .logo h1 {
        font-size: 2em;
    }

    .btn {
        padding: 15px 30px;
        font-size: 1em;
    }

    .player-buttons {
        gap: 8px;
    }

    .player-btn {
        width: 45px;
        height: 45px;
        font-size: 1em;
    }
}

/* Animations */
@keyframes slideIn {
    from {
        transform: translateX(-100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

.slide-in {
    animation: slideIn 0.5s ease;
}

/* Modal Styles */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(5px);
    animation: fadeIn 0.3s ease;
}

.modal-content {
    background: var(--card-bg);
    margin: 5% auto;
    padding: 40px;
    border-radius: 20px;
    max-width: 700px;
    max-height: 85vh;
    overflow-y: auto;
    box-shadow: var(--shadow);
    position: relative;
    animation: slideIn 0.4s ease;
}

.close-modal {
    position: absolute;
    right: 20px;
    top: 20px;
    font-size: 35px;
    font-weight: bold;
    color: var(--text-muted);
    cursor: pointer;
    transition: all 0.3s ease;
    line-height: 1;
}

.close-modal:hover {
    color: var(--danger);
    transform: rotate(90deg);
}

.rules-section {
    background: rgba(255, 255, 255, 0.05);
    padding: 20px;
    margin-bottom: 20px;
    border-radius: 15px;
    border-left: 4px solid var(--primary-color);
}

.rules-section h3 {
    color: var(--primary-color);
    margin-bottom: 15px;
    font-size: 1.3em;
}

.rules-section ol, .rules-section ul {
    padding-left: 25px;
    line-height: 1.8;
}

.rules-section ol li, .rules-section ul li {
    margin-bottom: 10px;
}

.rules-section ul ul {
    margin-top: 10px;
    padding-left: 20px;
}

.rules-section p {
    margin-bottom: 10px;
    line-height: 1.6;
}

/* Settings Styles */
.settings-section {
    background: rgba(255, 255, 255, 0.05);
    padding: 25px;
    margin-bottom: 20px;
    border-radius: 15px;
}

.settings-section h3 {
    color: var(--secondary-color);
    margin-bottom: 20px;
    font-size: 1.3em;
}

.setting-item {
    margin-bottom: 20px;
    padding: 15px;
    background: rgba(255, 255, 255, 0.03);
    border-radius: 10px;
}

.setting-item label {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    font-size: 1.1em;
}

.setting-item input[type="checkbox"] {
    width: 24px;
    height: 24px;
    cursor: pointer;
    accent-color: var(--primary-color);
}

.setting-item select {
    width: 100%;
    padding: 12px;
    margin-top: 10px;
    background: rgba(255, 255, 255, 0.1);
    border: 2px solid rgba(255, 255, 255, 0.2);
    border-radius: 10px;
    color: var(--text-light);
    font-size: 1em;
    cursor: pointer;
}

.setting-item select:focus {
    outline: none;
    border-color: var(--primary-color);
}

.setting-item select option {
    background: var(--card-bg);
    color: var(--text-light);
}

/* Header Buttons */
.header-buttons {
    display: flex;
    gap: 10px;
    justify-content: center;
    flex-wrap: wrap;
}

.icon-btn {
    padding: 12px 25px;
    background: rgba(255, 255, 255, 0.1);
    border: 2px solid rgba(255, 255, 255, 0.2);
    border-radius: 25px;
    color: var(--text-light);
    font-size: 1em;
    cursor: pointer;
    transition: all 0.3s ease;
    font-weight: 500;
}

.icon-btn:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: translateY(-2px);
    border-color: var(--primary-color);
}

/* Player Names Form */
.player-names-form {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 15px;
    margin-bottom: 30px;
}

.player-name-input {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.player-name-input label {
    font-size: 0.9em;
    color: var(--text-muted);
    font-weight: 500;
}

.player-name-input input {
    padding: 15px;
    background: rgba(255, 255, 255, 0.08);
    border: 2px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    color: var(--text-light);
    font-size: 1em;
    transition: all 0.3s ease;
}

.player-name-input input:focus {
    outline: none;
    border-color: var(--primary-color);
    background: rgba(255, 255, 255, 0.12);
}

.player-name-input input::placeholder {
    color: rgba(255, 255, 255, 0.3);
}

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

.bounce {
    animation: bounce 0.6s ease;
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-10px); }
    75% { transform: translateX(10px); }
}

.shake {
    animation: shake 0.5s ease;
}
