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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Inter', 'Segoe UI', sans-serif;
    background: linear-gradient(135deg, #0f0f23 0%, #1a1a2e 50%, #16213e 100%);
    background-size: 400% 400%;
    animation: gradientShift 20s ease infinite;
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 20px;
    position: relative;
}

/* Modern animated background particles */
body::before {
    content: '';
    position: absolute;
    width: 100%;
    height: 100%;
    background-image:
        radial-gradient(circle at 20% 50%, rgba(120, 119, 198, 0.1) 0%, transparent 50%),
        radial-gradient(circle at 80% 80%, rgba(236, 64, 122, 0.1) 0%, transparent 50%),
        radial-gradient(circle at 40% 20%, rgba(72, 202, 228, 0.1) 0%, transparent 50%);
    animation: particleFloat 15s ease infinite;
    pointer-events: none;
}

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

@keyframes particleFloat {
    0%, 100% {
        transform: translate(0, 0);
    }
    33% {
        transform: translate(30px, -30px);
    }
    66% {
        transform: translate(-20px, 20px);
    }
}

.container {
    width: 100%;
    max-width: 600px;
    position: relative;
    z-index: 1;
}

header {
    text-align: center;
    color: white;
    margin-bottom: 40px;
}

header h1 {
    font-size: 3.5em;
    margin-bottom: 15px;
    font-weight: 800;
    letter-spacing: -2px;
    background: linear-gradient(135deg, #7877c6 0%, #ec407a 50%, #48cae4 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    text-shadow: none;
    animation: titleGlow 3s ease-in-out infinite;
}

@keyframes titleGlow {
    0%, 100% {
        filter: brightness(1);
    }
    50% {
        filter: brightness(1.2);
    }
}

.subtitle {
    font-size: 1.15em;
    opacity: 0.85;
    font-weight: 500;
    color: #b4b4d4;
}

.screen {
    display: none;
}

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

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

.card {
    background: rgba(255, 255, 255, 0.98);
    backdrop-filter: blur(20px);
    border-radius: 24px;
    padding: 45px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3),
                0 0 0 1px rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.card h2 {
    color: #1a1a2e;
    margin-bottom: 30px;
    text-align: center;
    font-size: 2.2em;
    font-weight: 700;
    letter-spacing: -1px;
}

.input-group {
    margin-bottom: 25px;
}

.input-group label {
    display: block;
    margin-bottom: 8px;
    color: #555;
    font-weight: 600;
}

.input-group input {
    width: 100%;
    padding: 14px 18px;
    border: 2px solid #e8e8f0;
    border-radius: 12px;
    font-size: 16px;
    transition: all 0.3s ease;
    background: #f9f9fb;
    font-weight: 500;
}

.input-group input:focus {
    outline: none;
    border-color: #7877c6;
    background: white;
    box-shadow: 0 0 0 4px rgba(120, 119, 198, 0.1);
}

.input-group select {
    width: 100%;
    padding: 14px 18px;
    border: 2px solid #e8e8f0;
    border-radius: 12px;
    font-size: 16px;
    transition: all 0.3s ease;
    background: #f9f9fb;
    cursor: pointer;
    font-weight: 500;
}

.input-group select:focus {
    outline: none;
    border-color: #7877c6;
    box-shadow: 0 0 0 4px rgba(120, 119, 198, 0.1);
    background: white;
}

.generated-preview {
    background: linear-gradient(135deg, #4facfe20 0%, #00f2fe20 100%);
    padding: 15px;
    border-radius: 8px;
    text-align: center;
    margin-bottom: 20px;
    border-left: 4px solid #4facfe;
}

.generated-preview p {
    margin: 0;
    color: #333;
}

.generated-preview strong {
    color: #4facfe;
    font-size: 1.2em;
}

.btn {
    width: 100%;
    padding: 16px 24px;
    border: none;
    border-radius: 14px;
    font-size: 1.05em;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    text-transform: none;
    letter-spacing: 0.3px;
    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.2);
    transform: translate(-50%, -50%);
    transition: width 0.6s, height 0.6s;
}

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

.btn-primary {
    background: linear-gradient(135deg, #7877c6 0%, #ec407a 100%);
    color: white;
    box-shadow: 0 4px 15px rgba(120, 119, 198, 0.3);
}

.btn-primary:hover:not(:disabled) {
    transform: translateY(-3px);
    box-shadow: 0 8px 25px rgba(120, 119, 198, 0.4);
}

.btn-primary:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

.btn-secondary {
    background: linear-gradient(135deg, #5c6ac4 0%, #48cae4 100%);
    color: white;
    margin-bottom: 10px;
    box-shadow: 0 4px 15px rgba(72, 202, 228, 0.3);
}

.btn-secondary:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 25px rgba(72, 202, 228, 0.4);
}

.instruction {
    text-align: center;
    color: #666;
    margin-bottom: 25px;
    font-size: 1.05em;
    line-height: 1.6;
}

.role-display {
    margin-top: 30px;
}

.role-hidden {
    display: none;
}

.word-display {
    text-align: center;
    margin-bottom: 25px;
}

.role-badge {
    display: inline-block;
    padding: 18px 36px;
    border-radius: 60px;
    font-size: 1.4em;
    font-weight: 800;
    margin-bottom: 25px;
    letter-spacing: 0.5px;
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.2);
    animation: badgePop 0.5s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

@keyframes badgePop {
    0% {
        transform: scale(0);
        opacity: 0;
    }
    100% {
        transform: scale(1);
        opacity: 1;
    }
}

.role-badge.imposter {
    background: linear-gradient(135deg, #ec407a 0%, #f5576c 100%);
    color: white;
}

.role-badge.normal {
    background: linear-gradient(135deg, #48cae4 0%, #7877c6 100%);
    color: white;
}

.secret-word {
    background: linear-gradient(135deg, #f9f9fb 0%, #e8e8f0 100%);
    padding: 25px;
    border-radius: 16px;
    margin: 20px 0;
    font-size: 1.2em;
    border-left: 5px solid #7877c6;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

.secret-word strong {
    color: #7877c6;
    font-size: 1.5em;
    font-weight: 800;
    letter-spacing: 0.5px;
}

.role-instruction {
    color: #666;
    font-style: italic;
    margin-bottom: 20px;
}

.game-info {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
    margin-bottom: 30px;
}

.info-box {
    background: #f8f9fa;
    padding: 15px;
    border-radius: 8px;
    text-align: center;
}

.info-box.imposter-count {
    background: linear-gradient(135deg, #f093fb20 0%, #f5576c20 100%);
}

.actions {
    margin-top: 30px;
    text-align: center;
}

.actions h3 {
    color: #333;
    margin-bottom: 15px;
}

.actions p {
    color: #666;
    margin-bottom: 20px;
}

.result-text {
    font-size: 1.3em;
    text-align: center;
    margin-bottom: 20px;
    color: #333;
}

.result-text strong {
    color: #f5576c;
}

.secret-word-reveal {
    text-align: center;
    font-size: 1.2em;
    background: #f8f9fa;
    padding: 20px;
    border-radius: 10px;
    margin: 20px 0 30px 0;
}

.secret-word-reveal strong {
    color: #667eea;
    font-size: 1.3em;
}

/* Word Preview with Accept/Reject */
.word-preview-container {
    margin: 25px 0;
    animation: slideIn 0.4s ease-out;
}

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

.word-preview-card {
    background: linear-gradient(135deg, #fff5f7 0%, #f0f9ff 100%);
    border: 3px solid #667eea;
    border-radius: 15px;
    padding: 25px;
    text-align: center;
    box-shadow: 0 8px 25px rgba(102, 126, 234, 0.3);
}

.preview-label {
    font-size: 0.9em;
    color: #666;
    margin-bottom: 10px;
    text-transform: uppercase;
    letter-spacing: 1px;
    font-weight: 600;
}

.preview-word {
    font-size: 2.5em;
    color: #667eea;
    margin: 15px 0;
    font-weight: bold;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.1);
    animation: pulse 1.5s ease-in-out infinite;
}

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

.preview-theme {
    font-size: 1em;
    color: #555;
    margin-bottom: 20px;
    font-style: italic;
}

.preview-theme span {
    font-weight: bold;
    color: #764ba2;
}

.preview-actions {
    display: flex;
    gap: 15px;
    margin-top: 20px;
}

.btn-reject {
    flex: 1;
    background: linear-gradient(135deg, #ff6b6b 0%, #ee5a6f 100%);
    color: white;
    padding: 15px 25px;
    border: none;
    border-radius: 10px;
    font-size: 1.1em;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
}

.btn-reject:hover {
    transform: translateY(-3px) scale(1.02);
    box-shadow: 0 8px 20px rgba(255, 107, 107, 0.4);
}

.btn-accept {
    flex: 1;
    background: linear-gradient(135deg, #51cf66 0%, #37b24d 100%);
    color: white;
    padding: 15px 25px;
    border: none;
    border-radius: 10px;
    font-size: 1.1em;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
}

.btn-accept:hover {
    transform: translateY(-3px) scale(1.02);
    box-shadow: 0 8px 20px rgba(81, 207, 102, 0.4);
}

.hidden {
    display: none;
}

/* Mode switcher button */
.mode-switcher {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 1000;
}

.mode-btn {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border: 2px solid #7877c6;
    border-radius: 12px;
    padding: 12px 20px;
    font-size: 0.9em;
    font-weight: 600;
    color: #7877c6;
    cursor: pointer;
    transition: all 0.3s;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
    display: flex;
    align-items: center;
    gap: 8px;
}

.mode-btn:hover {
    background: #7877c6;
    color: white;
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(120, 119, 198, 0.4);
}

.mode-btn::before {
    content: "🔄";
    font-size: 1.2em;
}

@media (max-width: 600px) {
    header h1 {
        font-size: 2em;
    }

    .card {
        padding: 25px;
    }

    .card h2 {
        font-size: 1.5em;
    }

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

    .mode-switcher {
        top: 10px;
        right: 10px;
    }

    .mode-btn {
        padding: 10px 15px;
        font-size: 0.85em;
    }
}
