:root {
    color-scheme: dark;
    --bg: #101418;
    --panel: #1b232b;
    --panel-strong: #222c35;
    --text: #f2f5f7;
    --muted: #9ba8b3;
    --line: #34414d;
    --accent: #24b47e;
    --accent-hover: #2fd190;
    --danger: #ff6b6b;
    --shadow: 0 18px 48px rgba(0, 0, 0, .32);
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    min-height: 100vh;
    background: var(--bg);
    color: var(--text);
    font-family: Arial, Helvetica, sans-serif;
}

.login-page {
    display: grid;
    min-height: 100vh;
    place-items: center;
    padding: 16px;
}

.login-form {
    width: min(100%, 360px);
    padding: 18px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--panel);
    box-shadow: var(--shadow);
}

.login-title {
    margin: 0 0 16px;
    font-size: 24px;
    line-height: 1.1;
    letter-spacing: 0;
}

.login-label {
    display: block;
    margin-bottom: 8px;
    color: var(--muted);
    font-size: 14px;
}

.login-input {
    display: block;
    width: 100%;
    min-height: 46px;
    margin-bottom: 12px;
    padding: 10px 12px;
    border: 1px solid var(--line);
    border-radius: 8px;
    outline: 0;
    background: #0b0f13;
    color: var(--text);
    font: inherit;
}

.login-input:focus {
    border-color: var(--accent);
}

.login-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    min-height: 48px;
    border: 0;
    border-radius: 8px;
    background: var(--accent);
    color: #06140f;
    cursor: pointer;
    font-size: 17px;
    font-weight: 800;
}

.login-button:hover {
    background: var(--accent-hover);
}

.page {
    width: min(1040px, calc(100% - 24px));
    margin: 0 auto;
    padding: 10px 0 18px;
}

.cameras {
    display: grid;
    gap: 8px;
}

.camera {
    overflow: hidden;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--panel);
    box-shadow: var(--shadow);
}

.camera-frame {
    position: relative;
    width: 100%;
    aspect-ratio: 16 / 9;
    background: #050607;
}

.camera-frame iframe,
.camera-frame video,
.camera-frame img {
    display: block;
    width: 100%;
    height: 100%;
    border: 0;
    object-fit: contain;
    background: #050607;
}

.camera-frame video::-webkit-media-controls,
.camera-frame video::-webkit-media-controls-enclosure,
.camera-frame video::-webkit-media-controls-panel {
    display: none !important;
}

.pull-refresh {
    position: fixed;
    top: -44px;
    left: 50%;
    z-index: 20;
    width: max-content;
    max-width: calc(100% - 32px);
    padding: 9px 14px;
    border: 1px solid var(--line);
    border-radius: 999px;
    background: rgba(27, 35, 43, .96);
    color: var(--muted);
    font-size: 14px;
    line-height: 1;
    opacity: 0;
    transform: translate(-50%, 0);
    transition: opacity .16s ease, transform .16s ease;
    pointer-events: none;
}

.pull-refresh.active {
    color: var(--accent-hover);
    opacity: 1;
}

.actions {
    position: sticky;
    bottom: 0;
    margin-top: 8px;
    padding: 8px 0 0;
    background: linear-gradient(to top, var(--bg) 78%, rgba(16, 20, 24, 0));
}

.gate-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    width: 100%;
    min-height: 58px;
    border: 0;
    border-radius: 8px;
    background: var(--accent);
    color: #06140f;
    cursor: pointer;
    font-size: clamp(18px, 4vw, 22px);
    font-weight: 800;
    letter-spacing: 0;
    box-shadow: 0 14px 32px rgba(36, 180, 126, .24);
    transition: background .18s ease, transform .18s ease, opacity .18s ease;
}

.gate-button:hover {
    background: var(--accent-hover);
}

.gate-button:active {
    transform: translateY(1px);
}

.gate-button:disabled {
    cursor: wait;
    opacity: .7;
}

.message {
    min-height: 22px;
    margin-top: 10px;
    color: var(--muted);
    text-align: center;
    font-size: 14px;
}

.message.error {
    color: var(--danger);
}

.message.success {
    color: var(--accent-hover);
}

@media (max-width: 640px) {
    .page {
        width: min(100% - 16px, 1040px);
        padding-top: 8px;
    }
}
