/* ============================================================
   БАЗА
   ============================================================ */
* {
    box-sizing: border-box;
}

html,
body {
    width: 100%;
    height: 100%;
    margin: 0;
    padding: 0;
}

body {
    background: #000;
    color: #fff;
    font-family: Arial, sans-serif;
    overflow-x: auto;
    overflow-y: auto;
}

/* ============================================================
   КОНТЕЙНЕР
   ============================================================ */
.container {
    width: 100%;
    min-width: 1200px;
    position: relative;
    padding: 12px;
}

/* ============================================================
   БОКОВЫЕ ПАНЕЛИ
   ============================================================ */
.left-panel,
.right-panel {
    position: fixed;
    top: 12px;
    width: 220px;
    max-height: calc(100vh - 24px);
    overflow-y: auto;
    background: #2f3b46;
    padding: 14px;
    border-radius: 18px;
    box-shadow: 0 10px 25px rgba(0,0,0,0.4);
    display: flex;
    flex-direction: column;
    gap: 10px;
    z-index: 100;
    border: 2px solid #1f2a33;
}

.left-panel {
    left: 12px;
}

.right-panel {
    right: 12px;
}

.panel-separator {
    width: 100%;
    height: 2px;
    background: #738291;
    margin: 6px 0 10px;
    box-shadow: 0 2px 6px rgba(0,0,0,0.6);
}

/* ============================================================
   ЦЕНТРАЛЬНАЯ ОБЛАСТЬ
   ============================================================ */
.main-content {
    margin-left: 250px;
    margin-right: 250px;
    padding: 20px;
    background: #111;
    border: 2px solid #333;
    border-radius: 16px;
    overflow-x: auto;
    min-height: calc(100vh - 24px);
}

/* Контейнер приборов */
.panel-row {
    display: flex;
    gap: 30px;
    flex-wrap: wrap;
    justify-content: center;
}

/* ============================================================
   МАНОМЕТРЫ
   ============================================================ */
.gauge-wrapper {
    width: 380px;
    background: #3a4c5e;
    padding: 25px 30px 30px 30px;
    border-radius: 70px 70px 50px 50px;
    box-shadow: 0 25px 35px rgba(0, 0, 0, 0.6), inset 0 1px 4px rgba(255, 255, 255, 0.3);
    border-bottom: 8px solid #1f2f3a;
    display: flex;
    flex-direction: column;
    align-items: center;
    transition: transform 0.2s ease;
}

.gauge-wrapper:hover {
    transform: translateY(-5px);
}

/* SVG */
svg {
    display: block;
    width: 100%;
    height: auto;
    filter: drop-shadow(0 15px 20px rgba(0, 0, 0, 0.5));
}

/* LCD дисплей */
.lcd-display {
    margin-top: 20px;
    width: 180px;
    padding: 10px 15px;
    background: linear-gradient(180deg, #d7e8a1 0%, #c4d68a 100%);
    border: 4px solid #3a3a3a;
    border-radius: 12px;
    text-align: center;
}

.lcd-display span {
    font-family: "Courier New", monospace;
    font-size: 36px;
    font-weight: 700;
    color: #1a1a1a;
}

/* Панель управления */
.control-panel {
    margin-top: 15px;
    background: #314553;
    padding: 12px 15px;
    border-radius: 40px;
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 100%;
}

.control-panel label {
    color: #ecf9ff;
    font-weight: 700;
    margin-bottom: 8px;
    font-size: 14px;
}

.control-panel input[type="range"] {
    width: 100%;
    max-width: 220px;
}

/* Блок погрешности */
.accuracy-box {
    margin-top: 15px;
    background: #2f3b46;
    padding: 12px 15px;
    border-radius: 18px;
    box-shadow: 0 8px 20px rgba(0,0,0,0.4);
    width: 100%;
}

.accuracy-box .row {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    margin-bottom: 8px;
    gap: 10px;
}

.accuracy-box .label {
    color: #ffe484;
    font-size: 14px;
    font-weight: 700;
    text-shadow: 0 2px 6px #000;
}

.accuracy-box .value {
    color: #1beb4f;
    font-size: 16px;
    font-weight: 900;
    text-shadow: 0 3px 6px #000;
}

/* ============================================================
   КНОПКИ
   ============================================================ */
.pretty-btn,
.anim-btn,
.back-btn {
    padding: 11px 12px;
    font-size: 15px;
    font-weight: 700;
    color: #e9f3ff;
    background: linear-gradient(180deg, #5f7fa0 0%, #4a6a82 100%);
    border: 2px solid #1f2f3a;
    border-radius: 12px;
    cursor: pointer;
    box-shadow: 0 4px 10px rgba(0,0,0,0.4), inset 0 1px 3px rgba(255,255,255,0.3);
    transition: 0.2s ease;
    width: 100%;
    min-height: 42px;
}

.pretty-btn:hover,
.anim-btn:hover,
.back-btn:hover {
    background: linear-gradient(180deg, #6f8fb3 0%, #557a94 100%);
    transform: translateY(-2px);
}

.back-btn {
    background: #064523;
    color: #0f0;
    border: 1px solid #0f0;
    box-shadow: 0 0 8px #0f0;
}

.back-btn:hover {
    background: #0a6a36;
    box-shadow: 0 0 12px #0f0;
}

.reset-btn {
    display: block;
    margin: 0 auto;
    width: 100%;
}

/* ============================================================
   ТАЙМЕР
   ============================================================ */
#timerDisplay {
    font-size: 30px;
    font-weight: bold;
    color: #c9f508;
    margin-bottom: 4px;
    text-shadow: 0 0 10px rgba(80,120,160,0.7);
    text-align: center;
    width: 100%;
    background: #1c242d;
    border: 2px solid #0a0f14;
    border-radius: 10px;
    padding: 10px 6px;
    box-shadow: inset 0 0 10px rgba(0,0,0,0.6);
}

.timer-buttons {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
}

.timer-buttons button {
    padding: 10px 8px;
    font-size: 16px;
    border-radius: 8px;
    border: 2px solid #3f4a55;
    background: #4d5c6b;
    color: #e5eef9;
    cursor: pointer;
    transition: 0.2s;
    min-width: 0;
}

.timer-buttons button:hover {
    background: #5f7388;
}

/* ============================================================
   МОДАЛЬНОЕ ОКНО
   ============================================================ */
.modal {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.7);
    justify-content: center;
    align-items: center;
    z-index: 999;
}

.modal-content {
    background: #111;
    padding: 25px 30px;
    border-radius: 20px;
    width: 450px;
    max-width: 90%;
    max-height: 85vh;
    overflow-y: auto;
    color: #fff;
    border: 2px solid #0f0;
    box-shadow: 0 0 25px #0f0;
}

.modal-content h2 {
    text-align: center;
    margin-bottom: 20px;
    color: #c9f508;
}

.formula-block {
    background: #1c242d;
    padding: 10px;
    border-radius: 8px;
    margin-bottom: 20px;
    font-family: Consolas, monospace;
    color: #c9f508;
}

.close-btn {
    width: 100%;
    padding: 12px;
    background: #4e6a82;
    border: none;
    border-radius: 10px;
    color: #fff;
    font-size: 16px;
    cursor: pointer;
    margin-top: 10px;
}

.close-btn:hover {
    background: #6f8aa3;
}

/* ============================================================
   АДАПТИВ ДЛЯ РАЗНЫХ РАЗМЕРОВ ЭКРАНА
   ============================================================ */

/* Для экранов 1700px и меньше */
@media (max-width: 1700px) {
    .container {
        min-width: 1500px;
    }
    
    .left-panel,
    .right-panel {
        width: 200px;
    }
    
    .main-content {
        margin-left: 230px;
        margin-right: 230px;
    }
}

/* Для экранов 1500px и меньше */
@media (max-width: 1500px) {
    .container {
        min-width: 1300px;
    }
    
    .left-panel,
    .right-panel {
        width: 180px;
        padding: 10px;
    }
    
    .main-content {
        margin-left: 210px;
        margin-right: 210px;
    }
    
    .gauge-wrapper {
        width: 340px;
        padding: 20px 25px 25px 25px;
    }
    
    .lcd-display span {
        font-size: 32px;
    }
}

/* Для экранов 1300px и меньше */
@media (max-width: 1300px) {
    .container {
        min-width: 1100px;
    }
    
    .left-panel,
    .right-panel {
        width: 160px;
        padding: 8px;
    }
    
    .main-content {
        margin-left: 190px;
        margin-right: 190px;
    }
    
    .pretty-btn,
    .anim-btn,
    .back-btn {
        padding: 8px 10px;
        font-size: 13px;
    }
    
    #timerDisplay {
        font-size: 24px;
        padding: 8px 4px;
    }
    
    .gauge-wrapper {
        width: 300px;
        padding: 15px 20px 20px 20px;
    }
    
    .lcd-display {
        width: 150px;
    }
    
    .lcd-display span {
        font-size: 28px;
    }
}

/* Для экранов 1100px и меньше */
@media (max-width: 1100px) {
    .container {
        min-width: 1000px;
    }
    
    .left-panel,
    .right-panel {
        width: 140px;
        padding: 6px;
        top: 8px;
    }
    
    .left-panel {
        left: 8px;
    }
    
    .right-panel {
        right: 8px;
    }
    
    .main-content {
        margin-left: 165px;
        margin-right: 165px;
    }
    
    .pretty-btn,
    .anim-btn,
    .back-btn {
        padding: 6px 8px;
        font-size: 12px;
        min-height: 36px;
    }
    
    #timerDisplay {
        font-size: 20px;
        padding: 6px 4px;
    }
    
    .gauge-wrapper {
        width: 280px;
    }
    
    .panel-row {
        gap: 20px;
    }
}

/* Для экранов 900px и меньше - панели становятся сверху и снизу */
@media (max-width: 900px) {
    body {
        overflow-x: auto;
    }
    
    .container {
        min-width: auto;
        padding: 80px 12px 12px 12px;
    }
    
    .left-panel {
        position: fixed;
        top: 8px;
        left: 8px;
        right: 8px;
        width: auto;
        max-height: 70px;
        overflow-y: visible;
        flex-direction: row;
        flex-wrap: wrap;
        align-items: center;
        justify-content: center;
        z-index: 200;
        gap: 6px;
    }
    
    .right-panel {
        position: fixed;
        bottom: 8px;
        left: 8px;
        right: 8px;
        top: auto;
        width: auto;
        max-height: 70px;
        overflow-y: visible;
        flex-direction: row;
        flex-wrap: wrap;
        align-items: center;
        justify-content: center;
        z-index: 200;
        gap: 6px;
    }
    
    .main-content {
        margin-left: 0;
        margin-right: 0;
        margin-top: 0;
        margin-bottom: 90px;
        padding: 15px;
    }
    
    .panel-separator {
        display: none;
    }
    
    .left-panel button,
    .right-panel button {
        padding: 5px 10px;
        font-size: 11px;
        white-space: nowrap;
        width: auto;
        min-width: 70px;
    }
    
    #timerDisplay {
        font-size: 18px;
        padding: 4px 8px;
        width: auto;
        min-width: 100px;
    }
    
    .timer-buttons {
        display: flex;
        gap: 5px;
        width: auto;
    }
    
    .timer-buttons button {
        padding: 5px 10px;
        font-size: 12px;
    }
    
    .panel-row {
        gap: 15px;
    }
    
    .gauge-wrapper {
        width: 260px;
    }
}

/* Для мобильных устройств */
@media (max-width: 600px) {
    .container {
        padding: 90px 8px 8px 8px;
    }
    
    .left-panel {
        max-height: 80px;
        gap: 5px;
    }
    
    .right-panel {
        max-height: 80px;
        gap: 5px;
    }
    
    .main-content {
        margin-bottom: 100px;
        padding: 10px;
    }
    
    .left-panel button,
    .right-panel button {
        padding: 4px 8px;
        font-size: 10px;
        min-width: 60px;
    }
    
    #timerDisplay {
        font-size: 14px;
        padding: 3px 6px;
        min-width: 80px;
    }
    
    .panel-row {
        gap: 10px;
    }
    
    .gauge-wrapper {
        width: 100%;
        max-width: 280px;
    }
    
    .lcd-display span {
        font-size: 24px;
    }
    
    .accuracy-box .label,
    .accuracy-box .value {
        font-size: 12px;
    }
}

/* ============================================================
   АНИМАЦИИ
   ============================================================ */
.data-update {
    animation: dataPulse 0.6s ease-out;
}

@keyframes dataPulse {
    0% {
        transform: scale(1);
        box-shadow: 0 0 6px rgba(255,255,255,0.2);
    }
    50% {
        transform: scale(1.05);
        box-shadow: 0 0 18px rgba(255,255,255,0.45);
    }
    100% {
        transform: scale(1);
        box-shadow: 0 0 6px rgba(255,255,255,0.2);
    }
}

/* ============================================================
   СКРОЛЛБАР
   ============================================================ */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: #1c242d;
    border-radius: 10px;
}

::-webkit-scrollbar-thumb {
    background: #4a6a82;
    border-radius: 10px;
}

::-webkit-scrollbar-thumb:hover {
    background: #6f8fb3;
}


/* Скрываем значения погрешности */
.hide-values .value {
    display: none;

}

/* Стили для значений (жирный шрифт) */
.value {
    font-weight: 600 !important;
    font-size: 14px !important;
    color: #1beb4f !important;
    /* text-shadow: 0 2px 4px rgba(0,0,0,0.5) !important; */
}


/* Стили для кнопки переключения */
#toggleValues.show-values {
    background: #E53935 !important;
    color: #fff !important;
}

#toggleValues.hide-values {
    background: #4CAF50 !important;
    color: #fff !important;
}

/* ============================================================
   КИПиА ЯМАЛ — подпись конкурсного тренажёра
   ============================================================ */
.contest-note {
    margin: 2px 0 4px;
    padding: 8px 10px;
    border: 1px solid #52697d;
    border-radius: 10px;
    background: #202a33;
    color: #b8c7d6;
    font-size: 11px;
    line-height: 1.4;
    text-align: center;
}

@media (max-width: 900px) {
    .contest-note {
        display: none;
    }
}
