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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: linear-gradient(135deg, #0f0c29, #302b63, #24243e);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    color: #fff;
}

.container {
    width: 100%;
    max-width: 620px;
    padding: 20px;
}

.game-header {
    text-align: center;
    margin-bottom: 20px;
}

.game-header h1 {
    font-size: 2.2rem;
    margin-bottom: 5px;
}

.subtitle {
    color: #a0a0cc;
    font-size: 0.95rem;
}

.screen {
    display: block;
}

.screen.hidden {
    display: none;
}

.card {
    background: rgba(255, 255, 255, 0.08);
    backdrop-filter: blur(10px);
    border-radius: 20px;
    padding: 30px;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.card h2 {
    margin-bottom: 20px;
    font-size: 1.5rem;
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    color: #c0c0e0;
    font-size: 0.95rem;
}

.player-input {
    width: 100%;
    padding: 12px 16px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
    font-size: 1rem;
    outline: none;
    transition: border-color 0.3s;
}

.player-input:focus {
    border-color: #6c63ff;
}

.player-input::placeholder {
    color: rgba(255, 255, 255, 0.4);
}

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

.btn {
    padding: 12px 24px;
    border: none;
    border-radius: 10px;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.3s;
    font-weight: 600;
    flex: 1;
}

.btn-primary {
    background: linear-gradient(135deg, #6c63ff, #4834d4);
    color: #fff;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(108, 99, 255, 0.4);
}

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

.btn-secondary {
    background: rgba(255, 255, 255, 0.1);
    color: #c0c0e0;
    border: 1px solid rgba(255, 255, 255, 0.15);
}

.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.15);
}

.btn-small {
    padding: 6px 14px;
    font-size: 0.8rem;
    border-radius: 6px;
    background: rgba(255, 255, 255, 0.1);
    color: #c0c0e0;
    border: 1px solid rgba(255, 255, 255, 0.15);
    cursor: pointer;
    flex: none;
}

.btn-small:hover {
    background: rgba(255, 255, 255, 0.2);
}

.error-message {
    color: #ff6b6b;
    font-size: 0.9rem;
    margin-top: 10px;
    padding: 8px 12px;
    background: rgba(255, 107, 107, 0.1);
    border-radius: 8px;
    border: 1px solid rgba(255, 107, 107, 0.2);
}

.error-message.hidden {
    display: none;
}

.room-code-display {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 20px;
    padding: 15px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.room-code-label {
    color: #a0a0cc;
    font-size: 0.85rem;
}

.room-code {
    font-size: 1.6rem;
    font-weight: 800;
    letter-spacing: 6px;
    color: #ffd700;
    flex: 1;
    text-align: center;
}

.player-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.player-list-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 10px;
    border: 1px solid rgba(255, 255, 255, 0.08);
}

.player-list-item .player-icon {
    font-size: 1.2rem;
}

.player-list-item .player-name {
    flex: 1;
    font-size: 1rem;
}

.player-list-item .host-badge {
    font-size: 0.75rem;
    padding: 2px 8px;
    background: rgba(255, 215, 0, 0.2);
    color: #ffd700;
    border-radius: 4px;
}

.lobby-status {
    text-align: center;
    color: #a0a0cc;
    font-size: 0.9rem;
    margin-top: 15px;
    margin-bottom: 15px;
}

.leave-btn {
    background: rgba(255, 107, 107, 0.15);
    color: #ff6b6b;
    border: 1px solid rgba(255, 107, 107, 0.25);
}

.leave-btn:hover {
    background: rgba(255, 107, 107, 0.25);
}

.game-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
    padding: 15px 20px;
    background: rgba(255, 255, 255, 0.08);
    border-radius: 15px;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.range-display {
    display: flex;
    align-items: center;
    gap: 8px;
}

.range-label {
    color: #a0a0cc;
    font-size: 0.8rem;
    margin-right: 3px;
}

.range-number {
    font-size: 1.5rem;
    font-weight: 700;
    color: #6c63ff;
}

.range-separator {
    color: #a0a0cc;
    font-size: 1.1rem;
}

.current-player {
    text-align: right;
}

.player-name-highlight {
    font-size: 1.2rem;
    font-weight: 700;
    color: #ffd700;
}

.turn-label {
    color: #a0a0cc;
    font-size: 0.85rem;
}

.grid-container {
    display: grid;
    grid-template-columns: repeat(10, 1fr);
    gap: 4px;
    margin-bottom: 15px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 12px;
    padding: 8px;
    border: 1px solid rgba(255, 255, 255, 0.08);
}

.grid-cell {
    aspect-ratio: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.85rem;
    font-weight: 600;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s;
    user-select: none;
}

.grid-cell.active {
    background: rgba(108, 99, 255, 0.25);
    border: 1px solid rgba(108, 99, 255, 0.4);
    color: #fff;
}

.grid-cell.active:hover {
    background: rgba(108, 99, 255, 0.45);
    transform: scale(1.08);
    border-color: #6c63ff;
}

.grid-cell.active:active {
    transform: scale(0.95);
}

.grid-cell.eliminated {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.05);
    color: transparent;
    cursor: default;
    pointer-events: none;
    animation: fadeOutCell 0.6s ease forwards;
}

@keyframes fadeOutCell {
    0% {
        opacity: 1;
        transform: scale(1);
        color: #fff;
        background: rgba(108, 99, 255, 0.25);
        border-color: rgba(108, 99, 255, 0.4);
    }
    50% {
        opacity: 0.5;
        transform: scale(0.9);
        color: rgba(255, 255, 255, 0.5);
    }
    100% {
        opacity: 0;
        transform: scale(0.5);
        color: transparent;
        background: rgba(255, 255, 255, 0.03);
        border-color: rgba(255, 255, 255, 0.05);
    }
}

.grid-cell.bomb {
    background: rgba(255, 107, 107, 0.35);
    border: 2px solid #ff6b6b;
    color: #ff6b6b;
    animation: bombPulse 0.5s ease infinite alternate;
    cursor: default;
    pointer-events: none;
}

.grid-cell.outside-range {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.05);
    color: rgba(255, 255, 255, 0.15);
    cursor: default;
    pointer-events: none;
}

@keyframes bombPulse {
    from {
        box-shadow: 0 0 5px rgba(255, 107, 107, 0.3);
    }
    to {
        box-shadow: 0 0 15px rgba(255, 107, 107, 0.6);
    }
}

.game-over-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    animation: fadeIn 0.3s ease;
}

.game-over-overlay.hidden {
    display: none;
}

.game-over-card {
    background: linear-gradient(135deg, #1a1a2e, #16213e);
    border-radius: 20px;
    padding: 40px;
    text-align: center;
    border: 1px solid rgba(255, 255, 255, 0.1);
    animation: scaleIn 0.3s ease;
    max-width: 400px;
    width: 90%;
}

.bomb-icon {
    font-size: 4rem;
    margin-bottom: 15px;
    animation: shake 0.5s ease infinite;
}

@keyframes shake {
    0%, 100% { transform: rotate(0deg); }
    25% { transform: rotate(-10deg); }
    75% { transform: rotate(10deg); }
}

.game-over-card h2 {
    font-size: 1.5rem;
    margin-bottom: 10px;
    color: #ff6b6b;
}

.bomb-reveal {
    color: #a0a0cc;
    font-size: 1rem;
    margin-bottom: 25px;
}

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

@keyframes scaleIn {
    from {
        opacity: 0;
        transform: scale(0.8);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

@media (max-width: 480px) {
    .container {
        padding: 12px;
    }

    .game-header h1 {
        font-size: 1.8rem;
    }

    .game-info {
        flex-direction: column;
        gap: 10px;
        text-align: center;
    }

    .current-player {
        text-align: center;
    }

    .grid-container {
        gap: 3px;
        padding: 5px;
    }

    .grid-cell {
        font-size: 0.7rem;
    }

    .btn-group {
        flex-direction: column;
    }
}
