* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    font-family: 'Poppins', sans-serif;
    user-select: none;
    -webkit-user-select: none;
    -webkit-tap-highlight-color: transparent;
}

body {
    background-color: #0b0f19;
    color: #ffffff;
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    overflow: hidden;
    padding: 1rem;
    transition: background-color 0.25s ease;
}

/* Subtle dark ambiance during reveal to prevent face illumination in dark spaces */
body.revealing {
    background-color: #080b12 !important;
}

/* Sizing Container */
.screen-container {
    width: 100%;
    max-width: 680px;
    height: 540px;
    background: rgba(22, 31, 48, 0.7);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 24px;
    position: relative;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    padding: 1.5rem 2rem;
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.5);
    transition: background 0.25s ease, border-color 0.25s ease, box-shadow 0.25s ease;
}

body.revealing .screen-container {
    background: #080b12 !important;
    border-color: rgba(255, 255, 255, 0.05) !important;
    box-shadow: none !important;
}

@media (max-width: 600px) {
    .screen-container {
        max-width: 360px;
        height: 590px;
        padding: 1.25rem;
    }
}

/* Setup Card */
.setup-card {
    background: rgba(30, 41, 59, 0.7);
    backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 20px;
    padding: 1.8rem 2rem;
    width: 100%;
    max-width: 540px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.5);
    animation: zoomIn 0.35s ease-out;
}

@media (max-width: 600px) {
    .setup-card {
        max-width: 360px;
        padding: 1.25rem;
    }
}

.setup-card h1 {
    text-align: center;
    font-size: 1.6rem;
    margin-bottom: 1.2rem;
    background: linear-gradient(to right, #38bdf8, #818cf8);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

label {
    display: block;
    margin-top: 0.9rem;
    font-size: 0.85rem;
    font-weight: 600;
    color: #cbd5e1;
}

select, input {
    width: 100%;
    padding: 0.75rem 0.9rem;
    margin-top: 0.3rem;
    border-radius: 10px;
    border: 1px solid rgba(255, 255, 255, 0.15);
    background: #0f172a;
    color: #fff;
    font-size: 0.9rem;
    outline: none;
}

select:focus, input:focus {
    border-color: #6366f1;
}

/* Modal for Player Names */
.modal-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(11, 15, 25, 0.85);
    backdrop-filter: blur(8px);
    justify-content: center;
    align-items: center;
    z-index: 100;
    padding: 1rem;
}

.modal-overlay.active {
    display: flex;
}

.modal-card {
    background: #1e293b;
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 20px;
    padding: 1.5rem 1.8rem;
    width: 100%;
    max-width: 440px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.6);
    animation: zoomIn 0.3s ease;
}

.modal-card h2 {
    font-size: 1.3rem;
    margin-bottom: 0.8rem;
    text-align: center;
    color: #38bdf8;
}

.player-inputs-container {
    max-height: 220px;
    overflow-y: auto;
    padding-right: 4px;
    margin: 0.8rem 0;
}

.player-inputs-container input {
    margin-bottom: 0.5rem;
}

/* Pass Screen */
.pass-screen {
    text-align: center;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    height: 100%;
    animation: fadeIn 0.4s ease-out;
}

.avatar {
    width: 70px;
    height: 70px;
    border-radius: 50%;
    background: linear-gradient(135deg, #6366f1, #ec4899);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2.2rem;
    margin-bottom: 0.8rem;
    box-shadow: 0 8px 20px rgba(99, 102, 241, 0.4);
    animation: pulse 2s infinite ease-in-out;
}

.player-turn {
    font-size: 1.6rem;
    font-weight: 800;
    margin-bottom: 0.2rem;
}

.instruction {
    color: #94a3b8;
    font-size: 0.9rem;
    line-height: 1.5;
    max-width: 300px;
}

.instruction span {
    color: #38bdf8;
    font-weight: 700;
}

/* Curtain Trigger Card */
.curtain-card {
    position: absolute;
    left: 1.5rem;
    right: 1.5rem;
    bottom: 1.2rem;
    background: linear-gradient(180deg, #1e293b, #0f172a);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 18px;
    padding: 1rem;
    text-align: center;
    box-shadow: 0 -8px 30px rgba(0, 0, 0, 0.6);
    touch-action: none;
    cursor: pointer;
    transition: transform 0.25s cubic-bezier(0.2, 0.8, 0.2, 1);
    z-index: 10;
}

.curtain-card.hidden {
    display: none !important;
}

.swipe-icon {
    font-size: 1.4rem;
    animation: bounceUp 1.5s infinite;
}

.curtain-card h3 {
    font-size: 1rem;
    margin-top: 0.2rem;
}

.curtain-card p {
    font-size: 0.75rem;
    color: #94a3b8;
}

/* Secret Content Display (Anti-Glare / Face-Safe Balanced) */
.secret-content {
    display: none;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
    height: 100%;
    width: 100%;
    padding: 0.5rem;
    animation: zoomIn 0.3s ease;
    z-index: 5;
}

body.revealing .secret-content {
    display: flex;
}

.secret-category {
    font-size: 0.85rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 2px;
    color: #64748b;
    margin-bottom: 0.8rem;
}

.secret-word {
    font-size: 1.85rem;
    font-weight: 600;
    line-height: 1.25;
    word-break: break-word;
    letter-spacing: 0.5px;
}

.secret-word.crew {
    color: #38bdf8;
}

.secret-word.impostor {
    color: #fb7185;
}

.hint-box {
    margin-top: 0.8rem;
    font-size: 0.9rem;
    font-weight: 500;
}

.impostor-hint-badge {
    background: rgba(251, 113, 133, 0.08);
    border: 1px dashed rgba(251, 113, 133, 0.3);
    color: #f43f5e;
    padding: 0.35rem 0.9rem;
    border-radius: 8px;
    display: inline-block;
}

/* Final Game Over Screen */
.game-over-screen {
    display: none;
    flex-direction: column;
    justify-content: flex-start;
    align-items: center;
    text-align: center;
    height: 100%;
    position: relative;
    padding-top: 4.8rem;
}

.timer-badge {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(1.6);
    background: linear-gradient(135deg, #e11d48, #be123c);
    color: white;
    font-size: 1.4rem;
    font-weight: 900;
    padding: 0.5rem 1.6rem;
    border-radius: 50px;
    box-shadow: 0 10px 30px rgba(225, 29, 72, 0.5);
    z-index: 20;
}

.timer-badge.fly-top {
    animation: flyToTop 0.8s cubic-bezier(0.2, 0.8, 0.2, 1) forwards;
}

.game-over-body {
    opacity: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    height: 100%;
    padding-bottom: 0.5rem;
}

.game-over-body.show {
    animation: fadeIn 0.6s ease forwards;
}

.starter-banner {
    background: rgba(99, 102, 241, 0.15);
    border: 1px solid rgba(99, 102, 241, 0.4);
    border-radius: 12px;
    padding: 0.6rem 1.4rem;
    margin-bottom: 0.6rem;
    font-size: 1.05rem;
    font-weight: 600;
    color: #cbd5e1;
}

.starter-name {
    font-weight: 800;
    color: #38bdf8;
}

.game-over-body h2 {
    font-size: 1.35rem;
    margin-bottom: 0.3rem;
}

.game-over-body p {
    color: #94a3b8;
    font-size: 0.85rem;
    max-width: 340px;
    line-height: 1.4;
    margin-bottom: 0.6rem;
}

/* Stop Early Button */
.btn-stop-early {
    background: rgba(225, 29, 72, 0.18);
    border: 1px solid rgba(225, 29, 72, 0.4);
    color: #fb7185;
    padding: 0.45rem 1.2rem;
    border-radius: 10px;
    font-size: 0.85rem;
    font-weight: 700;
    cursor: pointer;
    margin-bottom: 0.8rem;
    transition: all 0.2s ease;
}

.btn-stop-early:hover {
    background: rgba(225, 29, 72, 0.3);
}

.btn-stop-early:active {
    transform: scale(0.95);
}

.btn-stop-early.hidden {
    display: none;
}

/* 3D Flip Card Reveal */
.flip-card-container {
    background-color: transparent;
    width: 250px;
    height: 85px;
    perspective: 1000px;
    margin-bottom: 0.8rem;
    cursor: pointer;
    animation: zoomIn 0.35s ease-out;
}

.flip-card-container.hidden {
    display: none;
}

.flip-card-inner {
    position: relative;
    width: 100%;
    height: 100%;
    text-align: center;
    transition: transform 0.6s cubic-bezier(0.4, 0.2, 0.2, 1);
    transform-style: preserve-3d;
}

.flip-card-inner.flipped {
    transform: rotateY(180deg);
}

.flip-card-front, .flip-card-back {
    position: absolute;
    width: 100%;
    height: 100%;
    -webkit-backface-visibility: hidden;
    backface-visibility: hidden;
    border-radius: 14px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    box-shadow: 0 8px 24px rgba(0,0,0,0.4);
}

.flip-card-front {
    background: linear-gradient(135deg, #1e293b, #0f172a);
    border: 2px dashed rgba(255, 255, 255, 0.2);
    color: #f8fafc;
    font-size: 0.85rem;
}

.flip-card-back {
    background: linear-gradient(135deg, #ef4444, #991b1b);
    color: white;
    transform: rotateY(180deg);
    padding: 0.5rem;
}

.impostor-title {
    font-size: 0.75rem;
    letter-spacing: 1px;
    font-weight: 700;
}

.impostor-reveal-text {
    font-size: 1.15rem;
    font-weight: 900;
    margin-top: 0.2rem;
}

.end-actions {
    display: flex;
    gap: 0.8rem;
    width: 100%;
    margin-top: auto;
}

.btn-action {
    width: 100%;
    padding: 0.75rem;
    border-radius: 12px;
    border: none;
    font-size: 0.9rem;
    font-weight: 700;
    cursor: pointer;
    transition: transform 0.2s;
}

.btn-primary {
    background: linear-gradient(135deg, #6366f1, #a855f7);
    color: white;
}

.btn-secondary {
    background: #334155;
    color: #cbd5e1;
    margin-top: 0.5rem;
}

.btn-hide {
    background: #0f172a;
    color: #ffffff;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.btn-action:active {
    transform: scale(0.97);
}

.back-link {
    display: block;
    text-align: center;
    margin-top: 0.8rem;
    color: #94a3b8;
    text-decoration: none;
    font-size: 0.8rem;
}

@keyframes flyToTop {
    0% {
        top: 50%;
        left: 50%;
        transform: translate(-50%, -50%) scale(1.6);
    }
    100% {
        top: 1.2rem;
        left: 50%;
        transform: translate(-50%, 0) scale(1);
    }
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes zoomIn {
    from { opacity: 0; transform: scale(0.92); }
    to { opacity: 1; transform: scale(1); }
}

@keyframes bounceUp {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-5px); }
}

@keyframes pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.05); }
}