:root {
    --red: #e30613;
    --red-soft: #fae8e9;

    --ink: #171918;
    --muted: #767a75;

    --bg: #e7e9e6;
    --panel: #f1f2ef;
    --white: #ffffff;

    --line: #ccd0ca;
    --green: #2b7951;

    --radius: 14px;
}


* {
    box-sizing: border-box;
}


html,
body {
    margin: 0;
    min-height: 100%;
}


body {
    min-height: 100vh;

    font-family:
        -apple-system,
        BlinkMacSystemFont,
        "Segoe UI",
        Arial,
        sans-serif;

    color: var(--ink);

    background: var(--bg);
}


button {
    font: inherit;
    color: inherit;
}


/* ==========================================================
   HEADER
   ========================================================== */

.header {
    height: 66px;

    display: flex;
    align-items: center;
    justify-content: space-between;

    padding: 0 22px;

    background: #f0f1ee;

    border-bottom:
        1px solid
        var(--line);
}


.brand {
    display: flex;
    align-items: center;

    gap: 20px;
}


.logo {
    display: block;

    width: 205px;
    height: 38px;

    object-fit: contain;
    object-position: left center;
}


.divider {
    width: 1px;
    height: 32px;

    background: #c6cac4;
}


.title {
    font-size: 15px;
    font-weight: 650;
}


.live-status {
    display: flex;
    align-items: center;

    gap: 7px;

    padding: 7px 11px;

    border:
        1px solid
        var(--line);

    border-radius: 99px;

    color: var(--muted);

    font-size: 10px;
}


.live-dot {
    width: 7px;
    height: 7px;

    display: inline-block;

    border-radius: 50%;

    background: var(--green);
}


/* ==========================================================
   LAYOUT
   ========================================================== */

main {
    width: 100%;

    padding:
        18px 20px 24px;
}


.stage {
    width: 100%;

    display: grid;

    grid-template-columns:
        minmax(0, 1fr)
        210px;

    gap: 16px;

    align-items: start;
}


/* ==========================================================
   VIDEO
   ========================================================== */

.video-card {
    position: relative;

    width: 100%;

    aspect-ratio: 16 / 9;

    overflow: hidden;

    border-radius: var(--radius);

    background: #151817;

    box-shadow:
        0 8px 28px
        rgba(20, 28, 20, .08);
}


.viewport {
    position: absolute;
    inset: 0;

    overflow: hidden;
}


#video {
    display: block;

    width: 100%;
    height: 100%;

    object-fit: contain;

    background: #151817;

    transform:
        scale(var(--zoom, 1));

    transform-origin:
        center center;

    transition:
        transform .14s ease;
}


.video-message {
    position: absolute;

    inset: 0;

    z-index: 5;

    display: flex;
    flex-direction: column;

    justify-content: center;
    align-items: center;

    gap: 14px;

    background: #151817;

    color: #e8ebe6;

    font-size: 12px;
}


.video-message[hidden] {
    display: none;
}


.spinner {
    width: 25px;
    height: 25px;

    border:
        2px solid
        rgba(255, 255, 255, .15);

    border-top-color:
        var(--red);

    border-radius: 50%;

    animation:
        spin .9s linear infinite;
}


@keyframes spin {
    to {
        transform:
            rotate(360deg);
    }
}


.live-badge {
    position: absolute;

    top: 13px;
    left: 13px;

    z-index: 20;

    display: flex;
    align-items: center;

    gap: 6px;

    padding: 7px 9px;

    border-radius: 7px;

    color: #f5f5f3;

    background:
        rgba(24, 28, 25, .74);

    backdrop-filter:
        blur(10px);

    font-size: 9px;
    font-weight: 750;

    letter-spacing: .7px;
}


.live-badge .live-dot {
    background: var(--red);
}


.video-actions {
    position: absolute;

    top: 13px;
    right: 13px;

    z-index: 20;

    display: flex;

    gap: 6px;
}


.video-button {
    width: 36px;
    height: 36px;

    display: grid;
    place-items: center;

    padding: 0;

    border:
        1px solid
        rgba(255, 255, 255, .20);

    border-radius: 8px;

    background:
        rgba(24, 28, 25, .74);

    color: white;

    cursor: pointer;

    font-size: 16px;
}


.video-button:hover {
    background: var(--red);
}


.zoom-indicator {
    position: absolute;

    left: 13px;
    bottom: 13px;

    z-index: 20;

    padding: 7px 9px;

    border-radius: 7px;

    color: white;

    background:
        rgba(24, 28, 25, .74);

    font-size: 10px;
}


/* ==========================================================
   CONTROLS
   ========================================================== */

.controls {
    padding: 16px;

    background: var(--panel);

    border:
        1px solid
        #c9cdc6;

    border-radius: var(--radius);

    box-shadow:
        0 8px 28px
        rgba(20, 28, 20, .05);
}


.control-title {
    display: flex;
    align-items: center;

    gap: 8px;

    font-size: 13px;
    font-weight: 650;
}


.control-icon {
    color: var(--red);
}


.description {
    margin:
        7px 0 15px;

    color: var(--muted);

    font-size: 10px;

    line-height: 1.45;
}


/* ==========================================================
   PTZ
   ========================================================== */

.pad {
    display: grid;

    width: 172px;
    height: 172px;

    margin:
        0 auto 17px;

    grid-template-columns:
        repeat(3, 1fr);

    grid-template-rows:
        repeat(3, 1fr);

    gap: 5px;
}


.pad button {
    display: grid;
    place-items: center;

    padding: 0;

    border:
        1px solid
        #d2d6cf;

    border-radius: 11px;

    background: #f9faf7;

    cursor: pointer;

    font-size: 20px;

    user-select: none;

    touch-action: none;

    transition:
        color .1s,
        border-color .1s,
        background .1s,
        transform .08s;
}


.pad button:hover {
    color: var(--red);

    border-color:
        #d9a3a6;
}


.pad button:active,
.pad button.active {
    color: white;

    background: var(--red);

    border-color: var(--red);

    transform:
        scale(.94);
}


.pad .up {
    grid-column: 2;
    grid-row: 1;
}


.pad .left {
    grid-column: 1;
    grid-row: 2;
}


.pad .stop {
    grid-column: 2;
    grid-row: 2;

    color: var(--red);

    background: var(--red-soft);

    border-color: #e8c4c7;
}


.pad .stop:hover {
    color: white;

    background: var(--red);
}


.pad .right {
    grid-column: 3;
    grid-row: 2;
}


.pad .down {
    grid-column: 2;
    grid-row: 3;
}


/* ==========================================================
   ZOOM
   ========================================================== */

.zoom-section {
    padding-top: 13px;

    border-top:
        1px solid
        var(--line);
}


.zoom-heading {
    display: flex;
    justify-content: space-between;
    align-items: center;

    margin-bottom: 9px;

    color: var(--muted);

    font-size: 10px;
}


.zoom-heading strong {
    color: var(--ink);

    font-weight: 600;
}


.zoom-controls {
    display: grid;

    grid-template-columns:
        34px
        1fr
        34px;

    gap: 5px;
}


.zoom-controls button {
    height: 34px;

    border:
        1px solid
        #d2d6cf;

    border-radius: 7px;

    background: #f9faf7;

    cursor: pointer;

    font-size: 11px;
}


.zoom-controls button:hover {
    color: var(--red);
}


/* ==========================================================
   KEYBOARD
   ========================================================== */

.shortcuts {
    display: flex;
    flex-wrap: wrap;

    align-items: center;

    gap: 3px;

    margin-top: 15px;

    padding-top: 13px;

    border-top:
        1px solid
        var(--line);

    color: var(--muted);

    font-size: 9px;
}


kbd {
    width: 19px;
    height: 21px;

    display: grid;
    place-items: center;

    border:
        1px solid
        var(--line);

    border-radius: 4px;

    background: #f9faf7;

    color: var(--ink);

    font:
        9px
        inherit;
}


/* ==========================================================
   FULLSCREEN
   ========================================================== */

.stage:fullscreen {
    position: relative;

    display: block;

    width: 100vw;
    height: 100vh;

    background: #111412;
}


.stage:fullscreen .video-card {
    position: absolute;

    inset: 0;

    width: 100%;
    height: 100%;

    aspect-ratio: auto;

    border-radius: 0;

    box-shadow: none;
}


.stage:fullscreen #video {
    object-fit: contain;
}


.stage:fullscreen .controls {
    position: absolute;

    right: 20px;
    bottom: 20px;

    z-index: 100;

    width: 188px;

    padding: 13px;

    color: #f4f6f0;

    background:
        rgba(27, 34, 28, .88);

    border:
        1px solid
        rgba(255, 255, 255, .18);

    backdrop-filter:
        blur(14px);

    box-shadow:
        0 8px 30px
        rgba(0, 0, 0, .3);
}


.stage:fullscreen .description,
.stage:fullscreen .zoom-section,
.stage:fullscreen .shortcuts {
    display: none;
}


.stage:fullscreen .pad {
    width: 154px;
    height: 154px;

    margin:
        12px auto 0;
}


.stage:fullscreen .pad button {
    color: white;

    background:
        rgba(255, 255, 255, .08);

    border-color:
        rgba(255, 255, 255, .15);
}


.stage:fullscreen .pad .stop {
    color: #ff6570;

    background:
        rgba(227, 6, 19, .15);
}


.stage:fullscreen .pad button.active {
    color: white;

    background: var(--red);

    border-color: var(--red);
}


/* ==========================================================
   RESPONSIVE
   ========================================================== */

@media (max-width: 850px) {

    .header {
        padding:
            0 14px;
    }

    .logo {
        width:
            175px;
    }

    .divider {
        display:
            none;
    }

    .title {
        font-size:
            13px;
    }

    main {
        padding:
            14px;
    }

    .stage {
        grid-template-columns:
            1fr;
    }

    .controls {
        width:
            100%;
    }
}
