html {
    padding: env(safe-area-inset);
}

body {
    color: #282828;
    font-family: Helvetica, serif;
    font-size: 13px;
    text-align: center;
    margin: 0;
    overflow: hidden;
    height: 100%;
    width: 100%;
    background: #F9C80E;
    background-repeat: no-repeat;
    background-position: center;
}

.unselectable {
    -webkit-touch-callout: none;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
}

.invisible {
    visibility: hidden;
}

.cloud {
    background-color: rgba(0,0,0,0.7);
    padding: 5px;
    border-radius: 5px;
}

#game-label {
    display: block;
    position: absolute;

    font-family: 'Orbitron', sans-serif;
    font-size: 20px;
    padding-top: 10px;
}

.top-label {
    transform: translateX(-50%);
    top: 0; /* Центрируем по горизонтали */
    left: 50%;
}

.center-label {
    transform: translateX(-50%) translateY(-50%);
    top: 50%; /* Центрируем по горизонтали */
    left: 50%;
}


#game-ui {
    position: fixed;
    top: 0;
    left: 50%; /* Центрируем по горизонтали */
    transform: translateX(-50%); /* Точное центрирование */
    padding: 40px 0;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 10px;
    pointer-events: none;
    font-family: 'Orbitron', sans-serif;
    z-index: 100;
    width: auto; /* Ширина по содержимому */
    max-width: 100%; /* Не выходит за границы экрана */
    box-sizing: border-box;
}

#left-panel {
    order: 1; /* Левая панель первой в потоке */
}

#right-panel {
    order: 3; /* Правая панель третьей */
}

#turn-container {
    order: 2; /* Счетчик хода посередине */
    min-width: 120px;
    flex-shrink: 0;
    display: block;
    justify-content: center;
}

/* Остальные стили остаются без изменений */
.health-container {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

#left-panel .health-container {
    align-items: flex-start;
    margin-right: 20px;
}

#right-panel .health-container {
    align-items: flex-end;
    margin-left: 20px;
}

.robot-name {
    color: white;
    font-weight: 700;
    font-size: 16px;
    letter-spacing: 1.5px;
    text-shadow: 0 2px 4px rgba(0,0,0,0.5);
}

.health-bar {
    height: 16px;
    width: 180px;
    background: rgba(50, 50, 50, 0.8);
    border-radius: 10px;
    overflow: hidden;
    position: relative;
    box-shadow: 0 2px 8px rgba(0,0,0,0.3);
}

.health-fill {
    height: 100%;
    background: linear-gradient(90deg, #FF5E62 0%, #FF2400 100%);
    border-radius: 10px;
    transition: width 0.4s ease-out;
}

#right-panel .health-fill {
    background: linear-gradient(90deg, #90ee90 0%, #65a765 100%);
}

.health-value {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    color: white;
    font-size: 11px;
    font-weight: bold;
    padding: 0 8px;
    text-shadow: 0 1px 3px rgba(0,0,0,0.8);
}

#left-panel .health-value {
    left: 0;
}

#right-panel .health-value {
    left: 0;
}

#turn-counter {
    background: rgba(0,0,0,0.7);
    color: #aaa;
    padding: 6px 16px;
    border-radius: 20px;
    font-weight: 700;
    font-size: 14px;
    letter-spacing: 1px;
    border: 1px solid rgba(249,200,14,0.3);
    box-shadow: 0 4px 12px rgba(0,0,0,0.2);
}
.dron_label {
    font-weight: bold;
    color: #F9C80E;
    background-color: rgba(0,0,0,0.7);
    padding: 5px;
    border-radius: 5px;
}

#modal-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    pointer-events: none;
}

.modal {
    display: none;
    background-color: rgba(0, 0, 0, 0.8);
    border: 2px solid #444;
    border-radius: 10px;
    padding: 20px;
    max-width: 500px;
    width: 90%;
    box-shadow: 0 0 20px rgba(255, 100, 0, 0.5);
    pointer-events: all;
    animation: fadeIn 0.3s ease-out;
}

.modal-content {
    color: white;
    font-family: 'Arial', sans-serif;
    text-align: center;
}

.modal h2 {
    color: #FFAA00;
    margin-top: 0;
    font-size: 2em;
    text-shadow: 0 0 5px rgba(255, 100, 0, 0.7);
}

.modal p {
    font-size: 1.2em;
    margin-bottom: 20px;
}

.modal-btn {
    background: linear-gradient(to bottom, #FF6600, #CC4400);
    border: none;
    color: white;
    padding: 12px 25px;
    margin: 10px 5px;
    border-radius: 5px;
    font-size: 1.1em;
    cursor: pointer;
    transition: all 0.3s;
}

.modal-btn:hover {
    background: linear-gradient(to bottom, #FF8822, #DD6622);
    transform: scale(1.05);
}

.modal-btn.secondary {
    background: linear-gradient(to bottom, #444, #222);
}

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

.language-selector {
    margin: 15px 0;
    text-align: center;
    flex: 1;
}

.language-selector label {
    display: block;
    margin-bottom: 8px;
    font-size: 1.1em;
    color: #FFAA00;
}

.language-dropdown {
    background: rgba(0, 0, 0, 0.7);
    color: white;
    border: 1px solid #444;
    border-radius: 5px;
    padding: 8px 15px;
    font-size: 1em;
    width: 200px;
    cursor: pointer;
    transition: all 0.3s;
}

.language-dropdown:hover {
    border-color: #FF6600;
    box-shadow: 0 0 5px rgba(255, 100, 0, 0.5);
}

.language-dropdown option {
    background: #222;
}

.settings-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin: 15px 0;
    gap: 20px;
}

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

.sound-toggle input[type="checkbox"] {
    appearance: none;
    width: 18px;
    height: 18px;
    border: 2px solid #FF6600;
    border-radius: 4px;
    background-color: rgba(0, 0, 0, 0.5);
    cursor: pointer;
    position: relative;
    transition: all 0.2s;
}

.sound-toggle input[type="checkbox"]:checked {
    background-color: #FF6600;
}

.sound-toggle input[type="checkbox"]:checked::after {
    content: "✓";
    position: absolute;
    color: white;
    font-size: 12px;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
}

.sound-toggle label {
    cursor: pointer;
    font-size: 1em;
    color: #FFAA00;
    transition: color 0.2s;
}

.sound-toggle:hover label {
    color: #FF6600;
}

@media only screen and (max-width: 576px) {
    .health-bar {
        width: 80px;
    }
    #game-label {
        font-size: 10px;
    }

    .settings-row {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }

    .language-selector,
    .sound-toggle {
        width: 100%;
    }
}
