:root {
    color-scheme: dark;
    font-family: Arial, Helvetica, sans-serif;
    --brand-yellow: rgb(255, 208, 20);
    --panel: rgba(0, 0, 0, 0.66);
    --panel-border: rgba(255, 255, 255, 0.17);
}

* {
    box-sizing: border-box;
}

html,
body {
    width: 100%;
    height: 100%;
    margin: 0;
    overflow: hidden;
    background: #000;
}

body,
button {
    font: inherit;
}

button {
    color: #fff;
}

.player {
    position: relative;
    width: 100%;
    height: 100%;
    min-height: 280px;
    overflow: hidden;
    background: #000;
    user-select: none;
}

.viewport {
    position: absolute;
    inset: 0;
    overflow: hidden;
    touch-action: none;
    cursor: grab;
}

.viewport.dragging {
    cursor: grabbing;
}

.media-layer {
    position: absolute;
    left: 50%;
    top: 50%;
    width: 100%;
    height: 100%;
    transform:
        translate(-50%, -50%)
        translate(var(--pan-x, 0px), var(--pan-y, 0px))
        scale(var(--zoom, 1));
    transform-origin: center center;
    will-change: transform;
}

video,
.privacy-effects,
.overlay-layer {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
}

video {
    object-fit: fill;
    background: #000;
}

.privacy-effects {
    z-index: 1;
    pointer-events: none;
    overflow: hidden;
}

.privacy-effect-canvas {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    transform: translateZ(0);
}

.privacy-effect-canvas.pixel-effect {
    image-rendering: pixelated;
    image-rendering: crisp-edges;
}

.privacy-effect-canvas.blur-effect {
    transform: translateZ(0);
}

.overlay-layer {
    z-index: 2;
    overflow: visible;
    pointer-events: none;
}

.overlay-layer.editing {
    pointer-events: auto;
}

.privacy-polygon {
    fill: #000;
    stroke: transparent;
    vector-effect: non-scaling-stroke;
}

.overlay-layer.editing .privacy-polygon {
    stroke: var(--brand-yellow);
    stroke-width: 2px;
    cursor: pointer;
}

.overlay-layer .disabled-overlay {
    opacity: 0.35;
}

.polygon-handle {
    fill: var(--brand-yellow);
    stroke: #111;
    stroke-width: 3px;
    vector-effect: non-scaling-stroke;
    cursor: move;
}

.chrome {
    transition: opacity 220ms ease, transform 220ms ease;
}

.player.chrome-hidden .topbar {
    opacity: 0;
    transform: translateY(-14px);
    pointer-events: none;
}

.player.chrome-hidden .controls {
    opacity: 0;
    transform: translate(-50%, 14px);
    pointer-events: none;
}

.topbar {
    position: absolute;
    z-index: 20;
    top: 0;
    left: 0;
    right: 0;
    display: flex;
    justify-content: space-between;
    gap: 20px;
    align-items: flex-start;
    padding:
        max(14px, env(safe-area-inset-top))
        max(18px, env(safe-area-inset-right))
        24px
        max(18px, env(safe-area-inset-left));
    color: #fff;
    background: linear-gradient(to bottom, rgba(0, 0, 0, 0.76), rgba(0, 0, 0, 0));
    pointer-events: none;
}

.brand-block {
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 0;
}

.logo {
    width: 86px;
    height: auto;
    max-height: 54px;
    object-fit: contain;
    filter: drop-shadow(0 2px 6px rgba(0, 0, 0, 0.85));
}

.live-line {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-shadow: 0 1px 4px #000;
}

.live-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: #df3030;
    box-shadow: 0 0 10px rgba(223, 48, 48, 0.95);
}

.location-label {
    margin-top: 5px;
    font-size: 14px;
    font-weight: 600;
    text-shadow: 0 1px 4px #000;
}

.status-block {
    text-align: right;
    text-shadow: 0 1px 4px #000;
}

.clock {
    font-size: 14px;
    font-weight: 600;
}

.status {
    margin-top: 5px;
    font-size: 12px;
    opacity: 0.86;
}

.message-layer {
    position: absolute;
    z-index: 15;
    inset: 0;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 12px;
    padding: 24px;
    text-align: center;
    color: #fff;
    background: rgba(0, 0, 0, 0.74);
}

.message-layer span {
    max-width: 480px;
    font-size: 14px;
    opacity: 0.82;
}

.hidden {
    display: none;
}

.spinner {
    width: 44px;
    height: 44px;
    border: 4px solid rgba(255, 255, 255, 0.24);
    border-top-color: #fff;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

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

.controls {
    position: absolute;
    z-index: 20;
    left: 50%;
    bottom: max(16px, env(safe-area-inset-bottom));
    transform: translateX(-50%);
    display: flex;
    align-items: center;
    gap: 8px;
    max-width: calc(100% - 24px);
    padding: 8px;
    border: 1px solid var(--panel-border);
    border-radius: 12px;
    background: var(--panel);
    backdrop-filter: blur(10px);
}

.controls button,
.primary-button {
    min-height: 40px;
    padding: 8px 13px;
    border: 1px solid var(--panel-border);
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.11);
    cursor: pointer;
}

.controls button:hover {
    background: rgba(255, 255, 255, 0.2);
}

.controls button:active,
.primary-button:active {
    transform: translateY(1px);
}

.icon-button {
    min-width: 42px;
    font-size: 21px;
    line-height: 1;
}

.zoom-value {
    min-width: 62px;
    text-align: center;
    font-size: 13px;
}

.primary-button {
    border: 0;
    color: #111;
    background: var(--brand-yellow);
    font-weight: 700;
}

@media (max-width: 640px) {
    .topbar {
        padding-left: 12px;
        padding-right: 12px;
    }

    .logo {
        width: 66px;
    }

    .location-label {
        font-size: 12px;
    }

    .status-block {
        display: none;
    }

    .controls {
        width: calc(100% - 18px);
        justify-content: center;
    }

    .controls button {
        padding: 7px 10px;
        font-size: 13px;
    }

    #zoom-reset {
        display: none;
    }
}


.admin-login {
    position: absolute;
    z-index: 25;
    right: 14px;
    bottom: 16px;
    min-width: 42px;
    height: 42px;
    padding: 0 14px;
    border: 1px solid var(--panel-border);
    border-radius: 50%;
    background: var(--panel);
    cursor: pointer;
}

.editor-panel {
    position: absolute;
    z-index: 40;
    top: 12px;
    right: 12px;
    width: min(360px, calc(100% - 24px));
    max-height: calc(100% - 24px);
    overflow: auto;
    padding: 14px;
    border: 1px solid var(--panel-border);
    border-radius: 12px;
    background: rgba(18, 18, 18, 0.96);
    box-shadow: 0 12px 40px rgba(0,0,0,.5);
    user-select: text;
}

.editor-title,
.editor-actions,
.dialog-actions,
.editor-inline {
    display: flex;
    align-items: center;
    gap: 8px;
}

.editor-title {
    justify-content: space-between;
    margin-bottom: 12px;
}

.editor-title button {
    width: 34px;
    height: 34px;
    font-size: 22px;
}

.editor-actions {
    flex-wrap: wrap;
    margin: 10px 0;
}

.editor-panel button,
.file-button,
.password-dialog button {
    min-height: 36px;
    padding: 7px 10px;
    border: 1px solid var(--panel-border);
    border-radius: 7px;
    background: rgba(255,255,255,.1);
    color: #fff;
    cursor: pointer;
}

.editor-panel button:disabled {
    opacity: .45;
    cursor: default;
}

.editor-field {
    display: grid;
    gap: 5px;
    margin: 10px 0;
    font-size: 13px;
}

.editor-field input[type="text"],
.password-dialog input,
#polygon-list {
    width: 100%;
    padding: 8px;
    border: 1px solid var(--panel-border);
    border-radius: 6px;
    color: #fff;
    background: #222;
}

.editor-inline {
    grid-template-columns: auto 1fr auto;
}

.editor-check {
    display: flex;
    gap: 8px;
    align-items: center;
    margin: 10px 0;
}

#polygon-list {
    min-height: 110px;
}

.file-button input {
    display: none;
}

.editor-help,
.editor-status {
    font-size: 12px;
    line-height: 1.45;
    opacity: .8;
}

.editor-status {
    min-height: 18px;
    color: #9ee493;
}

.editor-status.error,
.password-error {
    color: #ff8b8b;
}

.password-dialog {
    width: min(360px, calc(100% - 30px));
    border: 1px solid var(--panel-border);
    border-radius: 12px;
    color: #fff;
    background: #181818;
}

.password-dialog::backdrop {
    background: rgba(0,0,0,.72);
}

.password-dialog form,
.password-dialog label {
    display: grid;
    gap: 10px;
}

.password-dialog h2 {
    margin-top: 0;
}

.dialog-actions {
    justify-content: flex-end;
    margin-top: 14px;
}

.editor-open .controls,
.editor-open .topbar,
.editor-open .admin-login {
    opacity: .25;
    pointer-events: none;
}

.viewport.editor-interaction {
    cursor: crosshair;
}

@media (max-width: 640px) {
    .admin-login { bottom: 70px; }
    .editor-panel { inset: 8px; width: auto; max-height: calc(100% - 16px); }
}

.privacy-mode-blur,
.privacy-mode-pixelate { fill: transparent; }
.overlay-layer.editing .privacy-mode-blur { fill: rgba(80, 160, 255, 0.16); }
.overlay-layer.editing .privacy-mode-pixelate { fill: rgba(255, 140, 60, 0.16); }
.editor-field select { width: 100%; min-height: 38px; margin-top: 5px; }


/* v0.6.2 Startbildschirm und Pufferanzeige */
.splash-screen {
    position: absolute;
    z-index: 18;
    inset: 0;
    display: grid;
    place-items: center;
    overflow: hidden;
    color: #fff;
    background: #101010;
    opacity: 1;
    transition: opacity 500ms ease, visibility 500ms ease;
}
.splash-screen.fade-out { opacity: 0; visibility: hidden; pointer-events: none; }
.splash-backdrop {
    position: absolute;
    inset: 0;
    background-image: radial-gradient(circle at 50% 35%, #38434a 0%, #161a1d 48%, #080808 100%);
    background-position: center;
    background-size: cover;
    transform: scale(1.02);
}
.splash-content {
    position: relative;
    width: min(620px, calc(100% - 36px));
    padding: 34px 28px;
    text-align: center;
    border: 1px solid rgba(255,255,255,.16);
    border-radius: 18px;
    background: rgba(0,0,0,.52);
    backdrop-filter: blur(12px);
    box-shadow: 0 20px 70px rgba(0,0,0,.45);
}
.splash-logo { width: min(210px, 60%); max-height: 95px; object-fit: contain; }
.splash-content h1 { margin: 18px 0 8px; font-size: clamp(25px, 4vw, 42px); }
.splash-content p { margin: 0 auto 16px; max-width: 480px; line-height: 1.5; opacity: .88; }
.splash-link { display: inline-block; margin: 2px 0 18px; padding: 9px 14px; border-radius: 8px; color: #111; background: var(--brand-yellow); font-weight: 700; text-decoration: none; }
.splash-progress { display: flex; justify-content: center; align-items: center; gap: 14px; margin-top: 18px; text-align: left; }
.splash-progress strong, .splash-progress span { display: block; }
.splash-progress span { margin-top: 4px; font-size: 13px; opacity: .72; }

.mini-spinner { width: 20px; height: 20px; border: 3px solid rgba(255,255,255,.25); border-top-color: #fff; border-radius: 50%; animation: spin .75s linear infinite; }
@media (max-width: 640px) {
    .splash-content { padding: 25px 18px; }
    .splash-progress { align-items: center; }
}
