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

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: #0a0a1a;
    color: white;
    height: 100vh;
    overflow: hidden;
    display: flex;
    justify-content: center;
    align-items: center;
}

#app {
    width: 100%;
    max-width: 480px;
    height: 100vh;
    max-height: 800px;
    background: linear-gradient(145deg, #1a1a2e, #16213e);
    border-radius: 20px;
    position: relative;
    overflow: hidden;
    box-shadow: 0 20px 60px rgba(0,0,0,0.8);
}

.screen {
    display: none;
    width: 100%;
    height: 100%;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.screen.active {
    display: flex;
}

/* Menu Screen */
.logo {
    font-size: 72px;
    margin-bottom: -5px;
    animation: pulse 2s infinite;
}

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

.subtitle {
    font-size: 20px;
    font-weight: 300;
    color: #aaa;
    margin-bottom: 30px;
    letter-spacing: 2px;
}

.menu-box {
    background: rgba(255,255,255,0.05);
    backdrop-filter: blur(10px);
    padding: 30px;
    border-radius: 20px;
    width: 100%;
    max-width: 320px;
    border: 1px solid rgba(255,255,255,0.1);
}

.menu-box input {
    width: 100%;
    padding: 14px;
    border-radius: 12px;
    border: 2px solid rgba(255,255,255,0.1);
    background: rgba(255,255,255,0.08);
    color: white;
    font-size: 16px;
    text-align: center;
    margin-bottom: 15px;
    transition: border-color 0.3s;
}

.menu-box input:focus {
    outline: none;
    border-color: #e94560;
}

.btn-group {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.btn {
    padding: 14px;
    border: none;
    border-radius: 12px;
    font-size: 18px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    color: white;
}

.btn.primary {
    background: linear-gradient(135deg, #e94560, #c23152);
}

.btn.primary:hover {
    transform: scale(1.02);
    box-shadow: 0 8px 25px rgba(233, 69, 96, 0.4);
}

.btn.secondary {
    background: linear-gradient(135deg, #0f3460, #1a4a7a);
}

.btn.secondary:hover {
    transform: scale(1.02);
    box-shadow: 0 8px 25px rgba(15, 52, 96, 0.4);
}

.divider {
    text-align: center;
    color: #666;
    font-size: 14px;
    padding: 5px 0;
}

.join-row {
    display: flex;
    gap: 10px;
}

.join-row input {
    flex: 1;
    margin-bottom: 0;
}

.join-row .btn {
    flex: 0 0 80px;
}

.status-text {
    text-align: center;
    margin-top: 15px;
    color: #888;
    font-size: 14px;
    min-height: 24px;
}

/* Game Screen */
#gameHeader {
    display: flex;
    justify-content: space-between;
    width: 100%;
    padding: 10px 15px;
    background: rgba(0,0,0,0.3);
    border-radius: 12px;
    font-size: 14px;
    font-weight: 500;
}

#timerDisplay {
    color: #ffd700;
    font-size: 20px;
    font-weight: 700;
}

#gameArea {
    flex: 1;
    width: 100%;
    margin: 10px 0;
    border-radius: 16px;
    background: #1a2a3a;
    position: relative;
    overflow: hidden;
    border: 2px solid rgba(255,255,255,0.1);
}

#gameCanvasWrapper {
    width: 100%;
    height: 100%;
    position: relative;
}

#gameCanvas {
    width: 100%;
    height: 100%;
    display: block;
}

#playerContainer {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
}

.player-dot {
    position: absolute;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    border: 2px solid rgba(255,255,255,0.6);
    transform: translate(-50%, -50%);
    transition: all 0.1s;
    pointer-events: none;
    box-shadow: 0 0 20px rgba(255,255,255,0.2);
}

.player-dot.me {
    border: 3px solid #ffd700;
    box-shadow: 0 0 30px rgba(255, 215, 0, 0.3);
}

.player-dot.hider {
    border-color: #00ff88;
}

.player-dot.seeker {
    border-color: #ff4466;
}

.player-label {
    position: absolute;
    top: -22px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 10px;
    color: white;
    text-shadow: 0 2px 8px rgba(0,0,0,0.8);
    white-space: nowrap;
    background: rgba(0,0,0,0.5);
    padding: 2px 8px;
    border-radius: 8px;
}

#gameStatus {
    text-align: center;
    padding: 8px;
    font-size: 14px;
    color: #aaa;
    background: rgba(0,0,0,0.3);
    border-radius: 8px;
    margin-top: 5px;
}

#controls {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
    width: 100%;
    max-width: 250px;
    margin: 10px auto;
}

#controls button {
    padding: 15px;
    border: none;
    border-radius: 14px;
    font-size: 24px;
    background: rgba(255,255,255,0.1);
    color: white;
    cursor: pointer;
    transition: all 0.15s;
    backdrop-filter: blur(5px);
    border: 1px solid rgba(255,255,255,0.05);
}

#controls button:active {
    transform: scale(0.92);
    background: rgba(255,255,255,0.2);
}

#controls button:nth-child(1) { grid-column: 2; }
#controls button:nth-child(2) { grid-column: 1; grid-row: 2; }
#controls button:nth-child(3) { grid-column: 2; grid-row: 2; }
#controls button:nth-child(4) { grid-column: 3; grid-row: 2; }

#colorIndicator {
    text-align: center;
    font-size: 12px;
    color: #aaa;
    margin-top: 4px;
}

/* Result Screen */
.result-box {
    text-align: center;
    background: rgba(255,255,255,0.05);
    padding: 40px;
    border-radius: 24px;
    border: 1px solid rgba(255,255,255,0.1);
    backdrop-filter: blur(10px);
}

#resultEmoji {
    font-size: 72px;
    margin-bottom: 10px;
}

#resultTitle {
    font-size: 32px;
    font-weight: 700;
    margin-bottom: 5px;
}

#resultMessage {
    font-size: 18px;
    color: #aaa;
    margin-bottom: 25px;
}

/* Responsive */
@media (max-width: 480px) {
    #app {
        border-radius: 0;
        max-height: 100vh;
    }
    .logo { font-size: 56px; }
}

@media (min-width: 768px) {
    #controls button:hover {
        background: rgba(255,255,255,0.2);
    }
}