* { box-sizing: border-box; }

html, body {
    height: 100%;
    margin: 0;
    background: #000;
    color: #e5e7eb;
    font-family: system-ui, "Segoe UI", Roboto, Arial, sans-serif;
    overflow: hidden;
    -webkit-user-select: none;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
}

#stage { position: fixed; inset: 0; background: #000; overflow: hidden; }

/* Positions and sizes are set by layout() in vnc.js. */
.scr { position: absolute; display: none; }
.scr.has-frame { display: block; }
.scr.offline { opacity: 0.45; }
#scr-francis { z-index: 1; }
#mask { position: absolute; z-index: 2; display: none; background: rgb(23, 28, 35); }
#scr-kaplan { z-index: 3; }

body.pip-hidden #mask,
body.pip-hidden #scr-kaplan { display: none !important; }

body.control .scr { cursor: crosshair; }

.flash {
    position: absolute;
    z-index: 5;
    width: 22px;
    height: 22px;
    margin: -11px 0 0 -11px;
    border: 2px solid rgb(234, 88, 12);
    border-radius: 50%;
    pointer-events: none;
    animation: flash 0.6s ease-out forwards;
}
@keyframes flash {
    from { transform: scale(0.4); opacity: 1; }
    to { transform: scale(1.6); opacity: 0; }
}

/* Small control strip in the top-left corner (the black margin on wide displays). */
#bar {
    position: fixed;
    top: 8px;
    left: 8px;
    z-index: 10;
    display: flex;
    flex-direction: column;
    gap: 6px;
    width: 112px;
    opacity: 0.55;
}
#bar:hover, #bar:focus-within { opacity: 1; }

#bar button, #status {
    width: 100%;
    padding: 8px 6px;
    border: 1px solid rgb(55, 65, 81);
    border-radius: 6px;
    background: rgb(23, 28, 35);
    color: #e5e7eb;
    font: inherit;
    font-size: 12px;
    text-align: center;
}
#bar button { cursor: pointer; min-height: 40px; }
#bar button.active { border-color: rgb(234, 88, 12); background: rgb(124, 45, 18); color: #fff; }

#status { display: flex; align-items: center; gap: 6px; text-align: left; }
#dot { flex: none; width: 8px; height: 8px; border-radius: 50%; background: rgb(234, 179, 8); }
#dot.ok { background: rgb(34, 197, 94); }
#dot.bad { background: rgb(239, 68, 68); }

#login {
    position: fixed;
    inset: 0;
    z-index: 20;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #000;
}
#login[hidden] { display: none; }

.login-box {
    width: min(92vw, 340px);
    padding: 24px;
    border: 1px solid rgb(55, 65, 81);
    border-radius: 10px;
    background: rgb(23, 28, 35);
}
.login-box h1 { margin: 0 0 8px; font-size: 18px; }
.login-box p { margin: 0 0 16px; font-size: 14px; color: #9ca3af; }
.login-box p.error { color: rgb(248, 113, 113); }
.login-box input, .login-box button {
    width: 100%;
    padding: 12px;
    border-radius: 6px;
    font: inherit;
    font-size: 16px;
}
.login-box input { margin-bottom: 10px; border: 1px solid rgb(75, 85, 99); background: #000; color: #fff; }
.login-box button { border: 0; background: rgb(37, 99, 235); color: #fff; cursor: pointer; }
