* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    user-select: none;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    overflow: hidden;
    background: #1a1a1a;
    color: #fff;
    overscroll-behavior: none;
    -webkit-user-select: none;
    -webkit-touch-callout: none;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
}

/* Modal Dialog */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1000;
    display: none;
    align-items: flex-end;
}

.modal.open {
    display: flex;
}

.modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    z-index: -1;
}

.modal-content {
    background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
    border-radius: 24px 24px 0 0;
    padding: 40px 30px;
    width: 100%;
    max-width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    position: relative;
    animation: slideUp 0.3s ease;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
}

@keyframes slideUp {
    from {
        transform: translateY(100%);
    }
    to {
        transform: translateY(0);
    }
}

.modal-close-btn {
    position: absolute;
    top: 16px;
    right: 16px;
    background: rgba(255, 255, 255, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.4);
    color: white;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 1.2rem;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    z-index: 10;
}

.modal-close-btn:hover {
    background: rgba(255, 255, 255, 0.3);
    border-color: rgba(255, 255, 255, 0.6);
}

/* Modal responsiveness */
@media (min-width: 600px) {
    .modal {
        align-items: center;
        justify-content: center;
    }
    
    .modal-content {
        border-radius: 24px;
        max-width: 600px;
        max-height: 80vh;
    }
}

/* Screens */
.screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
    z-index: 10;
}

.screen.active {
    opacity: 1;
    pointer-events: auto;
}

.container {
    text-align: center;
    padding: 40px;
    max-width: 600px;
}


.word-selector {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 30px;
    margin: 40px 0 60px 0;
    flex-wrap: wrap;
}

.word-row {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 15px;
}


.word-btn {
    background: rgba(255, 255, 255, 0.2);
    border: 2px solid rgba(255, 255, 255, 0.5);
    color: white;
    padding: 20px 28px;
    border-radius: 12px;
    cursor: pointer;
    font-size: 6rem;
    min-width: 180px;
    min-height: 180px;
    transition: all 0.2s ease;
    backdrop-filter: blur(10px);
    display: flex;
    align-items: center;
    justify-content: center;
}

.word-btn:hover {
    background: rgba(255, 255, 255, 0.3);
    border-color: white;
    transform: scale(1.08);
}


.action-btn {
    padding: 18px 50px;
    font-size: 1.2rem;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    font-weight: 600;
    margin: 12px auto;
    display: block;
    width: 100%;
    max-width: 280px;
}

.action-btn.primary {
    background: white;
    color: #f5576c;
}

.action-btn.primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.2);
}


/* Game Screen */
#game-screen {
    background: #2a2a2a;
    overflow: hidden;
    touch-action: manipulation;
}

.game-background {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.game-content {
    transition: filter 0.3s ease;
}

.game-content.blur {
    filter: blur(8px);
    pointer-events: none;
}

.timer-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 0%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
}

.countdown {
    position: absolute;
    top: 50%;
    left: 50%;
    font-size: 20rem;
    font-weight: 900;
    color: white;
    text-shadow: 0 0 50px rgba(0, 0, 0, 0.7), 0 0 100px rgba(255, 255, 255, 0.3);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 5;
    animation: countdownPulse 1s ease-out;
    letter-spacing: -0.1em;
}

.countdown.show {
    display: flex;
}

@keyframes countdownPulse {
    0% {
        transform: translate(-50%, -50%) scale(1.3) rotate(-8deg) skewY(-5deg);
        opacity: 0;
    }
    50% {
        transform: translate(-50%, -50%) scale(1.05) rotate(2deg) skewY(2deg);
    }
    100% {
        transform: translate(-50%, -50%) scale(1) rotate(0deg) skewY(0deg);
        opacity: 1;
    }
}

/* Identity Badge */
.identity-badge {
    position: fixed;
    top: 20px;
    right: 20px;
    background: rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.3);
    padding: 12px 16px;
    border-radius: 8px;
    z-index: 100;
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 2rem;
}

.score-online {
    color: #fff;
}

.score-offline {
    color: #000000;
}

#badge-identity {
    font-weight: 600;
    color: #fff;
    min-width: 100px;
    display: flex;
    gap: 8px;
    font-size: 2rem;
}

.badge-change-btn {
    background: rgba(255, 255, 255, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.4);
    color: white;
    padding: 6px 12px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.85rem;
    transition: all 0.2s ease;
    white-space: nowrap;
}

.badge-change-btn:hover {
    background: rgba(255, 255, 255, 0.3);
    border-color: rgba(255, 255, 255, 0.6);
}

.game-content {
    position: relative;
    z-index: 20;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    cursor: crosshair;
}

.game-stats {
    display: flex;
    gap: 60px;
    margin-bottom: 40px;
    font-size: 3rem;
}

.stat {
    text-align: center;
}

.stat-value {
    font-size: 4rem;
    font-weight: 700;
    line-height: 1;
}

.stat-label {
    font-size: 1rem;
    margin-top: 10px;
    opacity: 0.8;
}

.game-instruction {
    font-size: 1.2rem;
    opacity: 0.9;
}

#game-screen.started .game-instruction {
    display: none;
}

/* Results Screen */
#results-screen {
    background: transparent;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
}

#results-screen h2 {
    font-size: 2.5rem;
    margin-bottom: 40px;
    color: white;
}

.results-display {
    display: flex;
    gap: 40px;
    margin-bottom: 40px;
    justify-content: center;
    flex-wrap: wrap;
}

.result-item {
    background: rgba(255, 255, 255, 0.15);
    backdrop-filter: blur(10px);
    padding: 30px 40px;
    border-radius: 16px;
    border: 1px solid rgba(255, 255, 255, 0.3);
    min-width: 150px;
}

.result-item.highlight {
    background: rgba(255, 255, 255, 0.25);
    border-color: rgba(255, 255, 255, 0.5);
    transform: scale(1.1);
}

.result-label {
    font-size: 1rem;
    opacity: 0.9;
    margin-bottom: 10px;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: white;
    font-weight: 600;
}

.result-value {
    font-size: 2.5rem;
    font-weight: 700;
    color: white;
}

.results-badge {
    margin-bottom: 30px;
    font-size: 2rem;
}


/* Animations */
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.screen.active {
    animation: fadeIn 0.3s ease;
}
