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

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 50%, #0f3460 100%);
    min-height: 100vh;
    overflow: hidden;
    color: #fff;
}

/* Menu Styles */
.menu {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 20px;
}

.menu.hidden {
    display: none !important;
}

.menu-title {
    font-size: 2.5rem;
    font-weight: bold;
    text-shadow: 0 0 20px #e94560, 0 0 40px #e94560;
    margin-bottom: 20px;
    animation: pulse 2s ease-in-out infinite;
}

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

.menu-content {
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    border-radius: 15px;
    padding: 20px 30px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(255, 255, 255, 0.1);
    max-width: 95vw;
}

/* Game Settings - горизонтальное расположение */
.game-settings {
    display: flex;
    justify-content: center;
    gap: 30px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.opponents-selector {
    text-align: center;
}

.laps-selector {
    text-align: center;
}

.opponents-selector label,
.laps-selector label {
    display: block;
    font-size: 1rem;
    margin-bottom: 8px;
    color: #e0e0e0;
}

.opponents-selector,
.laps-selector {
    margin-bottom: 0;
}

.counter-control {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 20px;
}

.counter-btn {
    width: 40px;
    height: 40px;
    font-size: 1.5rem;
    font-weight: bold;
    border: none;
    border-radius: 8px;
    background: linear-gradient(145deg, #e94560, #c73e54);
    color: #fff;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 4px 15px rgba(233, 69, 96, 0.4);
}

.counter-btn:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 20px rgba(233, 69, 96, 0.6);
}

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

.counter-value {
    font-size: 1.8rem;
    font-weight: bold;
    min-width: 40px;
    text-align: center;
    color: #e94560;
    text-shadow: 0 0 10px rgba(233, 69, 96, 0.5);
}

/* Color Selector */
.color-selector {
    text-align: center;
    margin-bottom: 20px;
}

.color-selector label {
    display: block;
    font-size: 1rem;
    margin-bottom: 10px;
    color: #e0e0e0;
}

.color-options {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 8px;
    max-width: 320px;
    margin: 0 auto;
}

.color-option {
    width: 40px;
    height: 40px;
    border-radius: 8px;
    cursor: pointer;
    border: 2px solid rgba(255, 255, 255, 0.3);
    transition: all 0.2s ease;
    position: relative;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.3);
}

.color-option:hover {
    transform: scale(1.1);
    border-color: rgba(255, 255, 255, 0.6);
}

.color-option.selected {
    border-color: #4ecca3;
    box-shadow: 0 0 15px rgba(78, 204, 163, 0.6);
    transform: scale(1.15);
}

.color-option.disabled {
    opacity: 0.3;
    cursor: not-allowed;
    filter: grayscale(80%);
}

.color-option.disabled::after {
    content: '✕';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 1.5rem;
    color: #fff;
    text-shadow: 0 0 5px #000;
}

.start-btn {
    display: block;
    width: 100%;
    padding: 12px 30px;
    font-size: 1.2rem;
    font-weight: bold;
    border: none;
    border-radius: 12px;
    background: linear-gradient(145deg, #4ecca3, #3db892);
    color: #1a1a2e;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 6px 20px rgba(78, 204, 163, 0.4);
    margin-bottom: 20px;
}

.start-btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 30px rgba(78, 204, 163, 0.6);
}

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

.controls-info {
    background: rgba(0, 0, 0, 0.2);
    border-radius: 12px;
    padding: 15px;
}

.controls-info h3 {
    text-align: center;
    margin-bottom: 10px;
    color: #4ecca3;
    font-size: 1.1rem;
}

.control-grid {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.control-row {
    display: flex;
    align-items: center;
    gap: 15px;
}

.control-keys {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    width: 45px;
}

.key {
    display: inline-block;
    width: 35px;
    height: 35px;
    line-height: 35px;
    text-align: center;
    background: rgba(78, 204, 163, 0.2);
    border: 2px solid #4ecca3;
    border-radius: 6px;
    font-weight: bold;
    color: #4ecca3;
    font-size: 1rem;
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.3);
}

.key-desc {
    font-size: 0.75rem;
    color: #e0e0e0;
    text-align: center;
    white-space: nowrap;
}

/* Game Container */
.game-container {
    width: 100vw;
    height: 100vh;
    position: relative;
}

.game-container.hidden {
    display: none;
}

#game-canvas-container {
    width: 100%;
    height: 100%;
}

/* Mini-map */
.minimap-container {
    position: fixed;
    bottom: 5px;
    left: 5px;
    width: 200px;
    height: 150px;
    background: rgba(0, 0, 0, 0.7);
    border-radius: 4px;
    z-index: 1000;
    pointer-events: none;
    transition: all 0.2s ease;
}

.minimap-container.hidden {
    display: none;
}

#minimap-canvas {
    width: 100%;
    height: 100%;
    display: block;
}

/* UI Overlay */
.ui-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    padding: 20px;
    display: flex;
    gap: 30px;
    align-items: flex-start;
    pointer-events: none;
    z-index: 100;
}

.health-bar {
    display: flex;
    align-items: center;
    gap: 10px;
    background: rgba(0, 0, 0, 0.7);
    padding: 8px 15px;
    border-radius: 10px;
    backdrop-filter: blur(5px);
}

.health-label {
    font-weight: bold;
    font-size: 0.85rem;
    color: #e0e0e0;
}

.health-container {
    width: 60px;
    height: 10px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 5px;
    overflow: hidden;
    border: 2px solid rgba(255, 255, 255, 0.2);
}

.health-fill {
    height: 100%;
    width: 100%;
    background: linear-gradient(90deg, #4ecca3, #2ecc71);
    transition: background 0.3s ease, transform 0.3s ease;
    border-radius: 3px;
    transform-origin: left;
    transform: scaleX(1);
}

.health-fill.low {
    background: linear-gradient(90deg, #e94560, #c73e54);
}

.health-fill.medium {
    background: linear-gradient(90deg, #f39c12, #e67e22);
}

.health-text {
    font-weight: bold;
    font-size: 0.9rem;
    min-width: 40px;
    text-align: right;
}

.position-display,
.laps-display {
    background: rgba(0, 0, 0, 0.7);
    padding: 8px 15px;
    border-radius: 10px;
    font-size: 0.9rem;
    font-weight: bold;
    backdrop-filter: blur(5px);
}

.position-display {
    color: #4ecca3;
}

.laps-display {
    color: #f39c12;
}

/* Weapons Display */
.weapons-display {
    display: flex;
    gap: 6px;
    align-items: center;
    background: rgba(0, 0, 0, 0.7);
    padding: 4px 10px;
    border-radius: 8px;
    backdrop-filter: blur(5px);
}

.weapons-display.hidden {
    display: none;
}

.weapon-slot {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    padding: 3px 6px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 6px;
    border: 2px solid rgba(255, 255, 255, 0.2);
    transition: all 0.2s ease;
    position: relative;
}

.weapon-slot.small {
    padding: 2px 4px;
    gap: 1px;
}

.weapon-slot.available {
    border-color: #4ecca3;
    box-shadow: 0 0 8px rgba(78, 204, 163, 0.4);
}

.weapon-slot.on-cooldown {
    border-color: #e94560;
    opacity: 0.6;
}

.weapon-key {
    font-size: 0.6rem;
    font-weight: bold;
    color: #f39c12;
    background: rgba(0, 0, 0, 0.5);
    padding: 1px 4px;
    border-radius: 3px;
}

.weapon-icon {
    font-size: 0.9rem;
}

/* Индикатор перезарядки */
.weapon-cooldown {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: rgba(233, 69, 96, 0.8);
    border-radius: 0 0 4px 4px;
    transform-origin: left;
    transform: scaleX(0);
    transition: transform 0.1s linear;
}

.weapon-cooldown.active {
    transform: scaleX(1);
}

/* Weapon controls in menu */
.weapon-control-row {
    margin-top: 10px;
    justify-content: center;
}

.weapon-key-small {
    width: 30px !important;
    height: 30px !important;
    line-height: 26px !important;
    font-size: 0.9rem !important;
    border-color: #f39c12 !important;
    color: #f39c12 !important;
}

/* Game Over Screen */
.game-over {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.9);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 200;
}

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

#game-over-title {
    font-size: 3.5rem;
    margin-bottom: 30px;
    text-shadow: 0 0 20px #e94560;
}

.game-over-stats {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 20px;
    padding: 30px 50px;
    margin-bottom: 30px;
    text-align: center;
}

.game-over-stats p {
    font-size: 1.5rem;
    margin: 10px 0;
}

.restart-btn,
.menu-btn {
    padding: 15px 40px;
    font-size: 1.3rem;
    font-weight: bold;
    border: none;
    border-radius: 12px;
    cursor: pointer;
    margin: 10px;
    transition: all 0.3s ease;
}

.restart-btn {
    background: linear-gradient(145deg, #4ecca3, #3db892);
    color: #1a1a2e;
}

.menu-btn {
    background: linear-gradient(145deg, #5a5a7a, #4a4a6a);
    color: #fff;
}

.restart-btn:hover,
.menu-btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.4);
}

/* Traffic Light */
#traffic-light {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 150;
    pointer-events: none;
}

.traffic-light-container {
    background: #2a2a2a;
    padding: 20px;
    border-radius: 20px;
    display: flex;
    flex-direction: column;
    gap: 15px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
    border: 4px solid #4a4a4a;
}

.traffic-light {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    background: #3a3a3a;
    transition: all 0.3s ease;
}

.traffic-light.red {
    background: #ff0000;
    box-shadow: 0 0 40px #ff0000;
}

.traffic-light.yellow {
    background: #ffff00;
    box-shadow: 0 0 40px #ffff00;
}

.traffic-light.green {
    background: #00ff00;
    box-shadow: 0 0 40px #00ff00;
}

.traffic-light.off {
    background: #3a3a3a;
    box-shadow: none;
}

/* Responsive */
@media (max-width: 768px) {
    body {
        overflow: auto;
    }

    .menu {
        padding: 10px;
        justify-content: flex-start;
        min-height: 100vh;
        padding-top: 20px;
    }

    .menu-title {
        font-size: 1.8rem;
        margin-bottom: 15px;
    }

    .menu-content {
        padding: 15px 20px;
        width: 100%;
        max-width: 100vw;
    }

    .game-settings {
        gap: 20px;
        margin-bottom: 15px;
    }

    .counter-btn {
        width: 35px;
        height: 35px;
        font-size: 1.3rem;
    }

    .counter-value {
        font-size: 1.5rem;
        min-width: 35px;
    }

    .opponents-selector label,
    .laps-selector label,
    .color-selector label {
        font-size: 0.9rem;
        margin-bottom: 6px;
    }

    .color-options {
        gap: 6px;
        max-width: 280px;
    }

    .color-option {
        width: 35px;
        height: 35px;
    }

    .start-btn {
        padding: 10px 20px;
        font-size: 1.1rem;
        margin-bottom: 15px;
    }

    .controls-info {
        padding: 10px;
    }

    .controls-info h3 {
        font-size: 1rem;
        margin-bottom: 8px;
    }

    .control-grid {
        gap: 6px;
    }

    .control-row {
        gap: 10px;
    }

    .control-keys {
        width: 40px;
        gap: 2px;
    }

    .key {
        width: 32px;
        height: 32px;
        line-height: 32px;
        font-size: 0.9rem;
    }

    .key-desc {
        font-size: 0.7rem;
    }

    .weapon-key-small {
        width: 28px !important;
        height: 28px !important;
        line-height: 24px !important;
        font-size: 0.8rem !important;
    }

    .ui-overlay {
        flex-direction: column;
        gap: 8px;
        padding: 10px;
    }

    .health-container {
        width: 100px;
    }

    .health-label,
    .position-display,
    .laps-display {
        font-size: 0.75rem;
    }

    /* Мини-карта переопределяется в mobile-controls */

    #game-over-title {
        font-size: 2rem;
    }

    .game-over-stats {
        padding: 20px 30px;
    }

    .game-over-stats p {
        font-size: 1.1rem;
    }

    .restart-btn,
    .menu-btn {
        padding: 12px 30px;
        font-size: 1.1rem;
    }
}

/* Очень маленькие экраны */
@media (max-width: 400px) {
    .menu-title {
        font-size: 1.5rem;
    }

    .game-settings {
        flex-direction: column;
        gap: 10px;
        align-items: center;
    }

    .color-options {
        max-width: 240px;
        gap: 5px;
    }

    .color-option {
        width: 30px;
        height: 30px;
    }

    .control-keys {
        width: 35px;
    }

    .key {
        width: 28px;
        height: 28px;
        line-height: 28px;
        font-size: 0.8rem;
    }

    .key-desc {
        font-size: 0.65rem;
    }
}

/* ========================================
   MULTIPLAYER MENU STYLES
   ======================================== */

.multiplayer-menu {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 20px;
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 50%, #0f3460 100%);
}

.multiplayer-menu.hidden {
    display: none !important;
}

.multiplayer-content {
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    border-radius: 15px;
    padding: 20px 30px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(255, 255, 255, 0.1);
    max-width: 500px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
}

.multiplayer-title {
    font-size: 2rem;
    font-weight: bold;
    text-align: center;
    text-shadow: 0 0 20px #4ecca3, 0 0 40px #4ecca3;
    margin-bottom: 25px;
    color: #4ecca3;
}

.mp-step {
    animation: fadeIn 0.3s ease;
}

.mp-step.hidden {
    display: none !important;
}

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

/* Форма никнейма */
.mp-form-group {
    margin-bottom: 20px;
}

.mp-form-group label {
    display: block;
    font-size: 1.1rem;
    margin-bottom: 10px;
    color: #e0e0e0;
    text-align: center;
}

.mp-input {
    width: 100%;
    padding: 12px 15px;
    font-size: 1.1rem;
    border: 2px solid rgba(78, 204, 163, 0.3);
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
    outline: none;
    transition: all 0.2s ease;
}

.mp-input:focus {
    border-color: #4ecca3;
    background: rgba(255, 255, 255, 0.15);
    box-shadow: 0 0 15px rgba(78, 204, 163, 0.3);
}

.mp-input::placeholder {
    color: rgba(255, 255, 255, 0.5);
}

.mp-btn-primary {
    display: block;
    width: 100%;
    padding: 14px 30px;
    font-size: 1.2rem;
    font-weight: bold;
    border: none;
    border-radius: 12px;
    background: linear-gradient(145deg, #4ecca3, #3db892);
    color: #1a1a2e;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 6px 20px rgba(78, 204, 163, 0.4);
}

.mp-btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 30px rgba(78, 204, 163, 0.6);
}

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

/* URL комнаты */
.mp-room-url {
    margin-bottom: 20px;
}

/* Мини-карта трассы */
.mp-track-preview {
    margin-bottom: 20px;
    text-align: center;
}

.mp-track-preview {
    display: flex;
    flex-direction: column;
    align-items: center;
    margin-bottom: 15px;
}

.mp-track-preview label {
    font-size: 0.9rem;
    margin-bottom: 8px;
    color: #e0e0e0;
}

.mp-track-canvas-container {
    display: block;
    border: 2px solid rgba(78, 204, 163, 0.3);
    border-radius: 8px;
    background: rgba(26, 26, 46, 0.5);
    margin-bottom: 10px;
}

#mp-track-canvas {
    display: block;
}

.mp-btn-secondary {
    display: block;
    padding: 8px 16px;
    font-size: 0.85rem;
    font-weight: bold;
    border: none;
    border-radius: 8px;
    background: linear-gradient(145deg, #6c757d, #5a6268);
    color: #fff;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 3px 10px rgba(108, 117, 125, 0.4);
}

.mp-btn-secondary:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(108, 117, 125, 0.6);
}

.mp-btn-secondary.hidden {
    display: none !important;
}

.mp-room-url label {
    display: block;
    font-size: 1rem;
    margin-bottom: 8px;
    color: #e0e0e0;
}

.mp-url-container {
    display: flex;
    gap: 8px;
}

.mp-url-input {
    flex: 1;
    padding: 10px 12px;
    font-size: 0.95rem;
    border: 2px solid rgba(78, 204, 163, 0.3);
    border-radius: 8px;
    background: rgba(0, 0, 0, 0.3);
    color: #4ecca3;
    font-family: 'Courier New', monospace;
    outline: none;
}

.mp-btn-copy {
    padding: 10px 15px;
    font-size: 1.2rem;
    border: none;
    border-radius: 8px;
    background: linear-gradient(145deg, #5a5a7a, #4a4a6a);
    color: #fff;
    cursor: pointer;
    transition: all 0.2s ease;
}

.mp-btn-copy:hover {
    background: linear-gradient(145deg, #6a6a8a, #5a5a7a);
    transform: scale(1.05);
}

.mp-copy-hint {
    display: block;
    text-align: center;
    color: #4ecca3;
    font-size: 0.9rem;
    margin-top: 5px;
    animation: fadeInOut 1.5s ease;
}

.mp-copy-hint.hidden {
    display: none;
}

@keyframes fadeInOut {
    0%, 100% { opacity: 0; }
    50% { opacity: 1; }
}

/* Выбор цвета в мультиплеере */
.mp-color-selector {
    margin-bottom: 20px;
}

.mp-color-selector label {
    display: block;
    font-size: 1rem;
    margin-bottom: 10px;
    color: #e0e0e0;
    text-align: center;
}

/* Секция ботов */
.mp-bots-section {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 15px;
    margin-bottom: 20px;
    padding: 15px;
    background: rgba(0, 0, 0, 0.2);
    border-radius: 10px;
}

.mp-bots-section label {
    font-size: 1rem;
    color: #e0e0e0;
}

.mp-bots-section.hidden {
    display: none;
}

/* Выбор количества кругов */
.mp-laps-section {
    margin-bottom: 15px;
    text-align: center;
}

.mp-laps-section label {
    display: block;
    font-size: 0.9rem;
    margin-bottom: 8px;
    color: #e0e0e0;
}

.mp-laps-section.hidden {
    display: none;
}

/* Список комнат */
.mp-rooms-list-section {
    margin-bottom: 20px;
}

.mp-rooms-list-section label {
    display: block;
    font-size: 0.9rem;
    margin-bottom: 10px;
    color: #e0e0e0;
    text-align: center;
}

.mp-rooms-list {
    max-height: 250px;
    overflow-y: auto;
    background: rgba(0, 0, 0, 0.2);
    border-radius: 8px;
    padding: 10px;
    margin-bottom: 15px;
}

.mp-room-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px;
    background: rgba(78, 204, 163, 0.1);
    border: 1px solid rgba(78, 204, 163, 0.3);
    border-radius: 8px;
    margin-bottom: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.mp-room-item:hover {
    background: rgba(78, 204, 163, 0.2);
    border-color: rgba(78, 204, 163, 0.5);
    transform: translateX(5px);
}

.mp-room-info {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.mp-room-hash {
    font-size: 0.9rem;
    color: #4ecca3;
    font-weight: bold;
}

.mp-room-players {
    font-size: 0.8rem;
    color: #aaa;
}

.mp-room-race-started {
    font-size: 0.85rem;
    color: #e94560;
    font-weight: bold;
    animation: pulse 1.5s ease-in-out infinite;
}

.mp-room-join-btn {
    padding: 8px 16px;
    font-size: 0.85rem;
    font-weight: bold;
    border: none;
    border-radius: 6px;
    background: linear-gradient(145deg, #4ecca3, #3db892);
    color: #1a1a2e;
    cursor: pointer;
    transition: all 0.2s ease;
}

.mp-room-join-btn:hover {
    transform: scale(1.05);
    box-shadow: 0 4px 15px rgba(78, 204, 163, 0.4);
}

.mp-room-join-btn:disabled {
    background: linear-gradient(145deg, #e94560, #c73e54);
    color: #fff;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
    opacity: 0.7;
}

.mp-room-loading {
    text-align: center;
    color: #888;
    padding: 20px;
}

.mp-rooms-actions {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

/* Список игроков */
.mp-players-list-section {
    margin-bottom: 15px;
}

.mp-players-list-section label {
    display: block;
    font-size: 0.9rem;
    margin-bottom: 8px;
    color: #e0e0e0;
    text-align: center;
}

.mp-players-list {
    max-height: 150px;
    overflow-y: auto;
    background: rgba(0, 0, 0, 0.2);
    border-radius: 8px;
    padding: 8px;
}

.mp-player-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 8px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 6px;
    margin-bottom: 6px;
    transition: all 0.2s ease;
}

.mp-player-item:last-child {
    margin-bottom: 0;
}

.mp-player-item.host {
    background: rgba(78, 204, 163, 0.2);
    border: 1px solid rgba(78, 204, 163, 0.4);
}

.mp-player-color {
    width: 18px;
    height: 18px;
    border-radius: 4px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    flex-shrink: 0;
}

.mp-player-name {
    flex: 1;
    font-size: 0.85rem;
    color: #e0e0e0;
}

.mp-player-status {
    font-size: 1rem;
    flex-shrink: 0;
}

.mp-player-name {
    flex: 1;
    font-size: 1rem;
    color: #fff;
}

.mp-player-status {
    font-size: 1.2rem;
}

.mp-player-item.ready .mp-player-status {
    color: #4ecca3;
}

.mp-player-item.not-ready .mp-player-status {
    color: #e94560;
}

/* Кнопка ГОТОВ */
.mp-btn-ready {
    display: block;
    width: 100%;
    padding: 10px 20px;
    font-size: 1rem;
    font-weight: bold;
    border: none;
    border-radius: 10px;
    background: linear-gradient(145deg, #f39c12, #e67e22);
    color: #fff;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(243, 156, 18, 0.4);
    margin-bottom: 8px;
}

.mp-btn-ready:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(243, 156, 18, 0.6);
}

.mp-btn-ready.ready {
    background: linear-gradient(145deg, #27ae60, #229954);
    box-shadow: 0 4px 15px rgba(39, 174, 96, 0.4);
}

.mp-btn-ready:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

/* Кнопка запуска гонки */
.mp-btn-start-race {
    display: block;
    width: 100%;
    padding: 10px 20px;
    font-size: 1rem;
    font-weight: bold;
    border: none;
    border-radius: 10px;
    background: linear-gradient(145deg, #4ecca3, #3db892);
    color: #1a1a2e;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(78, 204, 163, 0.4);
    margin-bottom: 8px;
    animation: pulse 1.5s ease-in-out infinite;
}

.mp-btn-start-race:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 30px rgba(78, 204, 163, 0.6);
}

.mp-btn-start-race.hidden {
    display: none !important;
}

/* Кнопка отмены */
.mp-btn-cancel {
    display: block;
    width: 100%;
    padding: 10px 20px;
    font-size: 0.95rem;
    font-weight: bold;
    border: none;
    border-radius: 10px;
    background: linear-gradient(145deg, #5a5a7a, #4a4a6a);
    color: #fff;
    cursor: pointer;
    transition: all 0.3s ease;
}

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

/* Экран отсчёта */
.mp-countdown-step {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 300px;
}

.mp-countdown-value {
    font-size: 8rem;
    font-weight: bold;
    color: #4ecca3;
    text-shadow: 0 0 30px #4ecca3, 0 0 60px #4ecca3;
    animation: countdownPulse 1s ease-in-out;
}

@keyframes countdownPulse {
    0% {
        transform: scale(0.5);
        opacity: 0;
    }
    50% {
        transform: scale(1.2);
        opacity: 1;
    }
    100% {
        transform: scale(1);
        opacity: 1;
    }
}

/* Кнопка мультиплеера в главном меню */
.multiplayer-btn {
    display: block;
    width: 100%;
    padding: 12px 30px;
    font-size: 1.2rem;
    font-weight: bold;
    border: none;
    border-radius: 12px;
    background: linear-gradient(145deg, #5a5a7a, #4a4a6a);
    color: #fff;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 6px 20px rgba(90, 90, 122, 0.4);
    margin-bottom: 20px;
}

.multiplayer-btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 30px rgba(90, 90, 122, 0.6);
    background: linear-gradient(145deg, #6a6a8a, #5a5a7a);
}

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

/* Адаптив для мультиплеера */
@media (max-width: 768px) {
    .multiplayer-content {
        padding: 20px 25px;
    }

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

    .mp-input {
        font-size: 1rem;
        padding: 10px 12px;
    }

    .mp-btn-primary,
    .mp-btn-ready,
    .mp-btn-start-race,
    .mp-btn-cancel {
        padding: 12px 20px;
        font-size: 1.1rem;
    }

    .mp-url-input {
        font-size: 0.85rem;
    }

    .mp-btn-copy {
        padding: 10px 12px;
        font-size: 1rem;
    }

    .mp-countdown-value {
        font-size: 5rem;
    }
}

/* ========================================
   MOBILE CONTROLS
   ======================================== */

.mobile-controls {
    position: fixed;
    bottom: 10px;
    left: 0;
    right: 0;
    display: none;
    justify-content: space-between;
    align-items: flex-end;
    padding: 0 10px;
    pointer-events: none;
    z-index: 1001;
}

.mobile-controls.hidden {
    display: none;
}

.mobile-controls-left {
    display: flex;
    flex-direction: row;
    gap: 15px;
    pointer-events: auto;
    align-items: flex-end;
}

.mobile-controls-weapons {
    display: flex;
    flex-direction: row;
    gap: 10px;
    pointer-events: auto;
    align-items: flex-end;
    position: fixed;
    bottom: 10px;
    left: 50%;
    transform: translateX(-50%);
}

.mobile-controls-right {
    display: flex;
    flex-direction: row;
    gap: 15px;
    pointer-events: auto;
    align-items: flex-end;
}

.mobile-btn {
    width: 70px;
    height: 70px;
    border: none;
    border-radius: 50%;
    background: rgba(128, 128, 128, 0.4);
    color: #cccccc;
    font-size: 2rem;
    font-weight: bold;
    cursor: pointer;
    backdrop-filter: blur(5px);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.4);
    border: 2px solid rgba(150, 150, 150, 0.5);
    transition: all 0.1s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
}

.mobile-btn:active,
.mobile-btn.pressed {
    background: rgba(128, 128, 128, 0.7);
    transform: scale(0.95);
    box-shadow: 0 1px 5px rgba(128, 128, 128, 0.5);
}

.mobile-btn-gas {
    background: rgba(128, 128, 128, 0.5);
}

.mobile-btn-brake {
    background: rgba(128, 128, 128, 0.5);
}

.mobile-btn-left,
.mobile-btn-right {
    background: rgba(128, 128, 128, 0.5);
}

.mobile-btn-weapon {
    width: 50px;
    height: 50px;
    font-size: 1.5rem;
    background: rgba(128, 128, 128, 0.4);
}

.mobile-btn-weapon:active,
.mobile-btn-weapon.pressed {
    background: rgba(128, 128, 128, 0.7);
}

/* Мини-карта для мобильных */
@media (max-width: 768px) {
    .mobile-controls {
        display: flex !important;
        bottom: 5px;
        padding: 0 5px;
    }

    .mobile-controls-weapons {
        position: fixed;
        bottom: 85px;
        left: 50%;
        transform: translateX(-50%);
        gap: 8px;
        z-index: 1002;
    }

    .mobile-btn {
        width: 70px;
        height: 70px;
        font-size: 2rem;
    }

    .mobile-btn-weapon {
        width: 50px;
        height: 50px;
        font-size: 1.5rem;
    }

    .mobile-controls-left {
        gap: 15px;
        position: fixed;
        bottom: 5px;
        left: 5px;
        z-index: 1002;
    }

    .mobile-controls-right {
        gap: 15px;
        position: fixed;
        bottom: 5px;
        right: 5px;
        z-index: 1002;
    }

    /* Уменьшаем мини-карту в 2 раза */
    .minimap-container {
        width: 100px !important;
        height: 75px !important;
        bottom: 5px !important;
        left: 50% !important;
        transform: translateX(-50%) !important;
    }
}

/* Горизонтальная ориентация */
@media (max-width: 768px) and (orientation: landscape) {
    .mobile-controls {
        display: flex !important;
        bottom: 5px;
        padding: 0 5px;
    }

    .mobile-controls-weapons {
        position: fixed;
        bottom: 75px;
        left: 50%;
        transform: translateX(-50%);
        gap: 6px;
        z-index: 1002;
    }

    .mobile-btn {
        width: 60px;
        height: 60px;
        font-size: 1.5rem;
    }

    .mobile-btn-weapon {
        width: 45px;
        height: 45px;
        font-size: 1.3rem;
    }

    .mobile-controls-left {
        gap: 10px;
        position: fixed;
        bottom: 5px;
        left: 5px;
        z-index: 1002;
    }

    .mobile-controls-right {
        gap: 10px;
        position: fixed;
        bottom: 5px;
        right: 5px;
        z-index: 1002;
    }

    /* Мини-карта в ландшафте */
    .minimap-container {
        width: 100px !important;
        height: 75px !important;
        bottom: 5px !important;
        left: 50% !important;
        transform: translateX(-50%) !important;
    }
}

/* Очень маленькие экраны */
@media (max-width: 400px) {
    .mobile-controls {
        display: flex !important;
        padding: 0 3px;
    }

    .mobile-controls-weapons {
        position: fixed;
        bottom: 80px;
        left: 50%;
        transform: translateX(-50%);
        gap: 6px;
        z-index: 1002;
    }

    .mobile-btn {
        width: 60px;
        height: 60px;
        font-size: 1.5rem;
    }

    .mobile-btn-weapon {
        width: 45px;
        height: 45px;
        font-size: 1.3rem;
    }

    .mobile-controls-left {
        gap: 10px;
        position: fixed;
        bottom: 5px;
        left: 5px;
        z-index: 1002;
    }

    .mobile-controls-right {
        gap: 10px;
        position: fixed;
        bottom: 5px;
        right: 5px;
        z-index: 1002;
    }

    /* Мини-карта */
    .minimap-container {
        width: 90px !important;
        height: 68px !important;
        bottom: 5px !important;
        left: 50% !important;
        transform: translateX(-50%) !important;
    }
}

/* Горизонтальная ориентация на очень маленьких экранах */
@media (max-width: 400px) and (orientation: landscape) {
    .mobile-controls {
        display: flex !important;
    }

    .mobile-controls-weapons {
        position: fixed;
        bottom: 70px;
        left: 50%;
        transform: translateX(-50%);
        gap: 6px;
        z-index: 1002;
    }

    .mobile-btn {
        width: 55px;
        height: 55px;
        font-size: 1.3rem;
    }

    .mobile-btn-weapon {
        width: 40px;
        height: 40px;
        font-size: 1.1rem;
    }

    .mobile-controls-left {
        gap: 8px;
        position: fixed;
        bottom: 5px;
        left: 5px;
        z-index: 1002;
    }

    .mobile-controls-right {
        gap: 8px;
        position: fixed;
        bottom: 5px;
        right: 5px;
        z-index: 1002;
    }

    /* Мини-карта */
    .minimap-container {
        width: 90px !important;
        height: 68px !important;
        bottom: 5px !important;
        left: 50% !important;
        transform: translateX(-50%) !important;
    }
}
