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

body {
    font-family: 'Arial', sans-serif;
    background: #0a0e27;
    color: #fff;
    overflow-x: hidden;
    min-height: 100vh;
    -webkit-tap-highlight-color: transparent;
    position: relative;
    overflow-y: auto;
}

body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 200%;
    height: 200%;
    background:
        radial-gradient(circle at 20% 30%, rgba(138, 43, 226, 0.15) 0%, transparent 50%),
        radial-gradient(circle at 80% 70%, rgba(0, 128, 255, 0.15) 0%, transparent 50%),
        radial-gradient(circle at 50% 50%, rgba(255, 0, 128, 0.1) 0%, transparent 60%);
    animation: nebula 30s ease-in-out infinite;
    z-index: 0;
    pointer-events: none;
}

@keyframes nebula {
    0%, 100% {
        transform: translate(0, 0) rotate(0deg);
    }
    33% {
        transform: translate(-10%, -10%) rotate(120deg);
    }
    66% {
        transform: translate(-5%, -15%) rotate(240deg);
    }
}

/* Starfield Background */
.stars,
.stars2,
.stars3 {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 200vh;
    pointer-events: none;
}

.stars {
    background-image:
        radial-gradient(2px 2px at 20px 30px, white, transparent),
        radial-gradient(2px 2px at 60px 70px, white, transparent),
        radial-gradient(1px 1px at 50px 50px, white, transparent),
        radial-gradient(1px 1px at 130px 80px, white, transparent),
        radial-gradient(2px 2px at 90px 10px, white, transparent),
        radial-gradient(1px 1px at 10px 90px, white, transparent),
        radial-gradient(2px 2px at 150px 40px, white, transparent),
        radial-gradient(1px 1px at 180px 120px, white, transparent),
        radial-gradient(2px 2px at 30px 150px, white, transparent),
        radial-gradient(1px 1px at 100px 140px, white, transparent);
    background-size: 200px 200px;
    background-repeat: repeat;
    animation: animateStars 20s linear infinite;
    opacity: 0.8;
}

.stars2 {
    background-image:
        radial-gradient(1px 1px at 40px 60px, white, transparent),
        radial-gradient(2px 2px at 110px 30px, white, transparent),
        radial-gradient(1px 1px at 170px 90px, white, transparent),
        radial-gradient(2px 2px at 70px 140px, white, transparent),
        radial-gradient(1px 1px at 25px 110px, white, transparent),
        radial-gradient(2px 2px at 140px 20px, white, transparent),
        radial-gradient(1px 1px at 15px 170px, white, transparent),
        radial-gradient(2px 2px at 190px 150px, white, transparent);
    background-size: 200px 200px;
    background-repeat: repeat;
    animation: animateStars 30s linear infinite;
    opacity: 0.6;
}

.stars3 {
    background-image:
        radial-gradient(1px 1px at 80px 20px, white, transparent),
        radial-gradient(2px 2px at 160px 100px, white, transparent),
        radial-gradient(1px 1px at 5px 50px, white, transparent),
        radial-gradient(2px 2px at 120px 160px, white, transparent),
        radial-gradient(1px 1px at 45px 85px, white, transparent),
        radial-gradient(2px 2px at 175px 45px, white, transparent),
        radial-gradient(1px 1px at 95px 125px, white, transparent);
    background-size: 200px 200px;
    background-repeat: repeat;
    animation: animateStars 40s linear infinite;
    opacity: 0.5;
}

@keyframes animateStars {
    from {
        transform: translateY(0);
    }
    to {
        transform: translateY(200px);
    }
}

/* Screen Management */
.screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100vh;
    display: flex;
    justify-content: center;
    align-items: flex-start;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.5s ease, visibility 0.5s ease;
    z-index: 1;
    overflow-y: auto;
    overflow-x: hidden;
    -webkit-overflow-scrolling: touch;
}

.screen.active {
    opacity: 1;
    visibility: visible;
}

.container {
    width: 90%;
    max-width: 500px;
    padding: 40px 20px;
    text-align: center;
    position: relative;
    z-index: 2;
    margin-top: auto;
    margin-bottom: auto;
    flex-shrink: 0;
}

/* Title Screen */
.logo {
    margin-bottom: 50px;
}

.glitch {
    font-size: 3rem;
    font-weight: bold;
    color: #ff4757;
    text-shadow:
        0 0 10px #ff4757,
        0 0 20px #ff4757,
        0 0 30px #ff4757;
    animation: glitch 2s infinite;
    position: relative;
    letter-spacing: 3px;
}

@keyframes glitch {
    0%, 90%, 100% {
        transform: translate(0);
    }
    92% {
        transform: translate(-2px, 2px);
    }
    94% {
        transform: translate(2px, -2px);
    }
    96% {
        transform: translate(-2px, -2px);
    }
    98% {
        transform: translate(2px, 2px);
    }
}

.subtitle {
    font-size: 1.5rem;
    color: #5ed3f3;
    text-shadow:
        0 0 10px #5ed3f3,
        0 0 20px #5ed3f3;
    margin-top: 10px;
    letter-spacing: 2px;
}

.timestamp {
    margin-top: 40px;
    font-size: 0.85rem;
    color: rgba(255, 255, 255, 0.4);
    font-style: italic;
    letter-spacing: 0.5px;
}

/* Screen Title */
.screen-title {
    font-size: 2rem;
    color: #fff;
    margin-bottom: 30px;
    text-shadow:
        0 0 10px rgba(255, 255, 255, 0.5),
        0 0 20px rgba(255, 255, 255, 0.3);
    letter-spacing: 2px;
}

/* Buttons */
.btn {
    width: 100%;
    max-width: 300px;
    padding: 15px 30px;
    font-size: 1.2rem;
    font-weight: bold;
    border: none;
    border-radius: 50px;
    cursor: pointer;
    transition: all 0.3s ease;
    margin: 10px auto;
    display: block;
    letter-spacing: 1px;
    text-transform: uppercase;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
}

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

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

.btn-secondary {
    background: linear-gradient(135deg, #434343 0%, #000000 100%);
    color: #fff;
}

.btn-secondary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(67, 67, 67, 0.4);
}

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

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

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

.pulse {
    animation: pulse 2s infinite;
}

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

/* Input Groups */
.input-group {
    margin: 25px 0;
    background: rgba(255, 255, 255, 0.05);
    padding: 20px;
    border-radius: 15px;
    border: 2px solid rgba(255, 255, 255, 0.1);
}

.input-group label {
    display: block;
    font-size: 1.1rem;
    margin-bottom: 15px;
    color: #5ed3f3;
    text-shadow: 0 0 10px rgba(94, 211, 243, 0.5);
}

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

.btn-small {
    width: 50px;
    height: 50px;
    font-size: 1.5rem;
    font-weight: bold;
    border: none;
    border-radius: 50%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #fff;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.3);
}

.btn-small:hover {
    transform: scale(1.1);
    box-shadow: 0 0 20px rgba(102, 126, 234, 0.5);
}

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

.input-controls input {
    width: 100px;
    height: 50px;
    font-size: 1.5rem;
    font-weight: bold;
    text-align: center;
    border: 2px solid #667eea;
    border-radius: 10px;
    background: rgba(0, 0, 0, 0.3);
    color: #fff;
    box-shadow:
        inset 0 2px 5px rgba(0, 0, 0, 0.3),
        0 0 15px rgba(102, 126, 234, 0.3);
}

.input-controls input:focus {
    outline: none;
    border-color: #5ed3f3;
    box-shadow:
        inset 0 2px 5px rgba(0, 0, 0, 0.3),
        0 0 20px rgba(94, 211, 243, 0.5);
}

.range-label {
    display: block;
    margin-top: 10px;
    font-size: 0.9rem;
    color: rgba(255, 255, 255, 0.5);
}

/* Special Roles Section */
.special-roles-section {
    margin: 25px 0;
    background: rgba(0, 0, 0, 0.3);
    padding: 20px;
    border-radius: 15px;
    border: 2px solid rgba(255, 255, 255, 0.1);
}

.section-title {
    font-size: 1.3rem;
    margin-bottom: 20px;
    color: #f1c40f;
    text-shadow: 0 0 10px rgba(241, 196, 15, 0.5);
    text-align: center;
    letter-spacing: 2px;
}

.role-toggles {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.toggle-group {
    background: rgba(255, 255, 255, 0.05);
    padding: 12px;
    border-radius: 10px;
    transition: all 0.3s ease;
}

.toggle-group:hover {
    background: rgba(255, 255, 255, 0.08);
}

.count-control {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 15px;
    margin-top: 10px;
    padding: 8px;
    opacity: 0.3;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.toggle-group:has(input[type="checkbox"]:checked) .count-control {
    opacity: 1;
    pointer-events: all;
}

.count-btn {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: 2px solid rgba(255, 255, 255, 0.3);
    background: rgba(255, 255, 255, 0.1);
    color: white;
    font-size: 1.2rem;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.count-btn:hover {
    background: rgba(255, 255, 255, 0.2);
    border-color: rgba(255, 255, 255, 0.5);
    transform: scale(1.1);
}

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

.count-display {
    display: flex;
    flex-direction: column;
    align-items: center;
    min-width: 80px;
}

.count-number {
    font-size: 1.5rem;
    font-weight: bold;
    color: #fff;
    text-shadow: 0 0 10px rgba(255, 255, 255, 0.5);
}

.count-label {
    font-size: 0.75rem;
    color: rgba(255, 255, 255, 0.6);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-top: 2px;
}

.toggle-label {
    display: flex;
    align-items: center;
    justify-content: space-between;
    cursor: pointer;
    font-size: 1.1rem;
    position: relative;
    user-select: none;
}

.toggle-label.crew-label {
    color: #5ed3f3;
}

.toggle-label.imposter-label {
    color: #ff4757;
}

.role-emoji {
    margin-right: 10px;
    font-size: 1.3rem;
}

.toggle-label input[type="checkbox"] {
    position: absolute;
    opacity: 0;
    cursor: pointer;
}

.toggle-switch {
    position: relative;
    width: 50px;
    height: 26px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 13px;
    transition: background 0.3s ease;
    border: 2px solid rgba(255, 255, 255, 0.3);
}

.toggle-switch::after {
    content: '';
    position: absolute;
    top: 2px;
    left: 2px;
    width: 18px;
    height: 18px;
    background: white;
    border-radius: 50%;
    transition: transform 0.3s ease;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.3);
}

.toggle-label input[type="checkbox"]:checked ~ .toggle-switch {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-color: #667eea;
}

.toggle-label input[type="checkbox"]:checked ~ .toggle-switch::after {
    transform: translateX(24px);
}

.toggle-label.crew-label input[type="checkbox"]:checked ~ .toggle-switch {
    background: linear-gradient(135deg, #2980b9 0%, #3498db 100%);
    border-color: #5ed3f3;
}

.toggle-label.imposter-label input[type="checkbox"]:checked ~ .toggle-switch {
    background: linear-gradient(135deg, #c0392b 0%, #e74c3c 100%);
    border-color: #ff4757;
}

/* Info Box */
.info-box {
    background: rgba(0, 0, 0, 0.3);
    padding: 20px;
    border-radius: 15px;
    margin: 25px 0;
    border: 2px solid rgba(255, 255, 255, 0.1);
}

.info-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin: 10px 0;
    font-size: 1.2rem;
}

.info-item .label {
    color: rgba(255, 255, 255, 0.7);
}

.info-item .value {
    font-weight: bold;
    font-size: 1.5rem;
}

.blue {
    color: #5ed3f3;
    text-shadow: 0 0 10px rgba(94, 211, 243, 0.5);
}

.red {
    color: #ff4757;
    text-shadow: 0 0 10px rgba(255, 71, 87, 0.5);
}

/* Role Cards */
.role-card {
    width: 100%;
    max-width: 350px;
    margin: 30px auto;
    padding: 40px 20px;
    border-radius: 20px;
    min-height: 300px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    transition: all 0.5s ease;
    cursor: pointer;
}

.hidden-role {
    background: linear-gradient(135deg, #2c3e50 0%, #34495e 100%);
    border: 3px solid #7f8c8d;
    box-shadow:
        0 10px 30px rgba(0, 0, 0, 0.5),
        inset 0 0 30px rgba(0, 0, 0, 0.3);
}

.hidden-role:hover {
    transform: scale(1.05);
    box-shadow:
        0 15px 40px rgba(0, 0, 0, 0.6),
        inset 0 0 40px rgba(0, 0, 0, 0.4);
}

.revealed-role {
    animation: revealCard 0.5s ease forwards;
}

.revealed-role.crewmate {
    background: linear-gradient(135deg, #2980b9 0%, #3498db 100%);
    border: 3px solid #5ed3f3;
    box-shadow:
        0 10px 30px rgba(94, 211, 243, 0.4),
        0 0 40px rgba(94, 211, 243, 0.3),
        inset 0 0 30px rgba(94, 211, 243, 0.2);
}

.revealed-role.imposter {
    background: linear-gradient(135deg, #c0392b 0%, #e74c3c 100%);
    border: 3px solid #ff4757;
    box-shadow:
        0 10px 30px rgba(255, 71, 87, 0.4),
        0 0 40px rgba(255, 71, 87, 0.3),
        inset 0 0 30px rgba(255, 71, 87, 0.2);
}

.revealed-role.engineer {
    background: linear-gradient(135deg, #f39c12 0%, #e67e22 100%);
    border: 3px solid #f1c40f;
    box-shadow:
        0 10px 30px rgba(241, 196, 15, 0.4),
        0 0 40px rgba(241, 196, 15, 0.3),
        inset 0 0 30px rgba(241, 196, 15, 0.2);
}

.revealed-role.scientist {
    background: linear-gradient(135deg, #16a085 0%, #1abc9c 100%);
    border: 3px solid #2ecc71;
    box-shadow:
        0 10px 30px rgba(46, 204, 113, 0.4),
        0 0 40px rgba(46, 204, 113, 0.3),
        inset 0 0 30px rgba(46, 204, 113, 0.2);
}

.revealed-role.guardian {
    background: linear-gradient(135deg, #9b59b6 0%, #8e44ad 100%);
    border: 3px solid #e74cdb;
    box-shadow:
        0 10px 30px rgba(231, 76, 219, 0.4),
        0 0 40px rgba(231, 76, 219, 0.3),
        inset 0 0 30px rgba(231, 76, 219, 0.2);
}

.revealed-role.shapeshifter {
    background: linear-gradient(135deg, #7f0000 0%, #b30000 100%);
    border: 3px solid #ff1744;
    box-shadow:
        0 10px 30px rgba(255, 23, 68, 0.5),
        0 0 50px rgba(255, 23, 68, 0.4),
        inset 0 0 30px rgba(255, 23, 68, 0.3);
    animation: shapeshifterPulse 2s ease-in-out infinite;
}

.revealed-role.saboteur {
    background: linear-gradient(135deg, #b71c1c 0%, #d32f2f 100%);
    border: 3px solid #ffeb3b;
    box-shadow:
        0 10px 30px rgba(255, 235, 59, 0.4),
        0 0 40px rgba(255, 235, 59, 0.3),
        inset 0 0 30px rgba(255, 235, 59, 0.2);
}

@keyframes shapeshifterPulse {
    0%, 100% {
        box-shadow:
            0 10px 30px rgba(255, 23, 68, 0.5),
            0 0 50px rgba(255, 23, 68, 0.4),
            inset 0 0 30px rgba(255, 23, 68, 0.3);
    }
    50% {
        box-shadow:
            0 15px 40px rgba(255, 23, 68, 0.6),
            0 0 70px rgba(255, 23, 68, 0.5),
            inset 0 0 40px rgba(255, 23, 68, 0.4);
    }
}

@keyframes revealCard {
    0% {
        transform: rotateY(90deg) scale(0.8);
        opacity: 0;
    }
    100% {
        transform: rotateY(0) scale(1);
        opacity: 1;
    }
}

.card-content {
    text-align: center;
}

.team-badge {
    display: inline-block;
    padding: 8px 20px;
    border-radius: 20px;
    font-size: 0.9rem;
    font-weight: bold;
    margin-bottom: 15px;
    letter-spacing: 1px;
    text-transform: uppercase;
    animation: badgeFadeIn 0.5s ease 0.3s backwards;
}

.team-badge.crew-team {
    background: rgba(94, 211, 243, 0.3);
    border: 2px solid #5ed3f3;
    color: #5ed3f3;
    text-shadow: 0 0 10px rgba(94, 211, 243, 0.5);
}

.team-badge.imposter-team {
    background: rgba(255, 71, 87, 0.3);
    border: 2px solid #ff4757;
    color: #ff4757;
    text-shadow: 0 0 10px rgba(255, 71, 87, 0.5);
}

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

.instruction {
    font-size: 1.2rem;
    margin-bottom: 20px;
    color: rgba(255, 255, 255, 0.7);
}

.mystery-icon {
    font-size: 6rem;
    color: rgba(255, 255, 255, 0.3);
    animation: float 3s ease-in-out infinite;
}

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

.role-name {
    font-size: 2rem;
    font-weight: bold;
    margin-bottom: 20px;
    text-transform: uppercase;
    letter-spacing: 2px;
    text-shadow:
        0 0 10px rgba(255, 255, 255, 0.5),
        0 0 20px rgba(255, 255, 255, 0.3);
}

.role-icon {
    font-size: 5rem;
    margin: 20px 0;
    animation: bounce 1s ease;
}

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

.role-description {
    font-size: 1.1rem;
    color: rgba(255, 255, 255, 0.9);
    margin-top: 15px;
}

/* Results Screen */
.results-box {
    background: rgba(0, 0, 0, 0.3);
    padding: 30px;
    border-radius: 20px;
    margin: 30px 0;
    border: 2px solid rgba(255, 255, 255, 0.1);
}

.results-message {
    font-size: 1.5rem;
    margin-bottom: 10px;
    color: #5ed3f3;
    text-shadow: 0 0 10px rgba(94, 211, 243, 0.5);
}

.results-submessage {
    font-size: 1.1rem;
    color: rgba(255, 255, 255, 0.7);
    margin-bottom: 30px;
}

.stats {
    display: flex;
    justify-content: space-around;
    gap: 20px;
    flex-wrap: wrap;
}

.stat-item {
    flex: 1;
    min-width: 120px;
    padding: 20px;
    border-radius: 15px;
    background: rgba(0, 0, 0, 0.3);
}

.crewmate-stat {
    border: 2px solid #5ed3f3;
    box-shadow: 0 0 20px rgba(94, 211, 243, 0.3);
}

.imposter-stat {
    border: 2px solid #ff4757;
    box-shadow: 0 0 20px rgba(255, 71, 87, 0.3);
}

.stat-icon {
    font-size: 2.5rem;
    display: block;
    margin-bottom: 10px;
}

.stat-value {
    font-size: 2rem;
    font-weight: bold;
    display: block;
    margin-bottom: 5px;
}

.stat-label {
    font-size: 1rem;
    color: rgba(255, 255, 255, 0.7);
    display: block;
}

/* Mobile Optimizations */
@media (max-width: 480px) {
    .glitch {
        font-size: 2.5rem;
    }

    .subtitle {
        font-size: 1.2rem;
    }

    .screen-title {
        font-size: 1.5rem;
    }

    .btn {
        font-size: 1rem;
        padding: 12px 25px;
    }

    .role-card {
        min-height: 250px;
        padding: 30px 15px;
    }

    .role-icon {
        font-size: 4rem;
    }

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

    .stats {
        flex-direction: column;
    }

    .stat-item {
        min-width: 100%;
    }
}

/* Touch Feedback */
@media (hover: none) {
    .btn:active {
        transform: scale(0.95);
    }

    .btn-small:active {
        transform: scale(0.9);
    }

    .role-card:active {
        transform: scale(0.98);
    }
}
