/* Модальне вікно VNC — на весь вікно браузера (viewport) */
.vnc-modal {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 10050;
    flex-direction: column;
    align-items: stretch;
    justify-content: stretch;
    padding: 0;
    box-sizing: border-box;
}

.vnc-modal.is-open {
    display: flex;
}

.vnc-modal__backdrop {
    position: absolute;
    inset: 0;
    background: rgba(15, 23, 42, 0.55);
    cursor: pointer;
}

.vnc-modal__panel {
    position: relative;
    z-index: 1;
    flex: 1 1 auto;
    display: flex;
    flex-direction: column;
    min-height: 0;
    width: 100%;
    max-width: 100%;
    height: 100%;
    max-height: 100%;
    box-sizing: border-box;
    padding-top: env(safe-area-inset-top, 0);
    padding-right: env(safe-area-inset-right, 0);
    padding-bottom: env(safe-area-inset-bottom, 0);
    padding-left: env(safe-area-inset-left, 0);
    background: var(--card-bg, #fff);
    color: var(--text-color, #1a1a1a);
    border-radius: 0;
    box-shadow: none;
    overflow: hidden;
}

.vnc-modal__head {
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 0;
    padding: 6px 10px 8px;
    border-bottom: 1px solid rgba(0, 0, 0, 0.08);
}

.vnc-modal__head-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    min-height: 0;
}

.vnc-modal__head h4 {
    margin: 0;
    font-size: clamp(0.9rem, 2.2vw, 1rem);
    font-weight: 600;
    line-height: 1.25;
}

.vnc-modal__close {
    flex-shrink: 0;
    min-width: 44px;
    min-height: 44px;
    padding: 0 8px;
    font-size: 1.25rem;
    line-height: 1;
}

@media (min-width: 768px) {
    .vnc-modal__close {
        min-width: 36px;
        min-height: 36px;
    }
}

.vnc-modal__status {
    flex-shrink: 0;
    margin: 0;
    padding: 4px 0 0;
    font-size: 0.8125rem;
    line-height: 1.3;
    color: #555;
    min-height: 0;
}

.vnc-modal__status:empty {
    display: none;
    padding: 0;
}

.vnc-modal__hint {
    flex-shrink: 0;
    margin: 4px 0 0;
    padding: 5px 8px;
    font-size: 0.75rem;
    line-height: 1.35;
    color: #6b5b00;
    background: rgba(234, 179, 8, 0.12);
    border-left: 3px solid #ca8a04;
    border-radius: 4px;
}

.vnc-modal__screen {
    flex: 1 1 auto;
    min-height: 0;
    min-width: 0;
    background: #0f172a;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: auto;
    touch-action: manipulation;
}

/* Чіткіше масштабований текст у консолі (піксельна сітка); auto — згладжування за замовчуванням */
.vnc-modal__screen canvas {
    max-width: 100%;
    height: auto;
    display: block;
    image-rendering: -webkit-optimize-contrast;
    image-rendering: crisp-edges;
}

@supports (image-rendering: pixelated) {
    .vnc-modal__screen canvas {
        image-rendering: pixelated;
    }
}

.vnc-modal__foot {
    flex-shrink: 0;
    padding: 6px 10px;
    border-top: 1px solid rgba(0, 0, 0, 0.08);
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    align-items: center;
}

@media (prefers-reduced-motion: reduce) {
    .vnc-modal__backdrop {
        transition: none;
    }
}
