:root {
    --bg: #212121;
    --surface: #2a2a2b;
    --surface-hover: #36373b;
    --text: #ececec;
    --muted: #919292;
    --border: #3a3a3c;
    --accent: #6ea8fe;
    --danger: #e5484d;
    color-scheme: dark;
}

* { box-sizing: border-box; }

[hidden] { display: none !important; }

html, body {
    margin: 0;
    min-height: 100%;
    background: var(--bg);
    color: var(--text);
    font-family: "Segoe UI", system-ui, -apple-system, Helvetica, Arial, sans-serif;
}

button, select, input {
    font: inherit;
    color: inherit;
}

/* --- Werkzeugleiste ------------------------------------------------------------------- */

.toolbar {
    position: fixed;
    left: 12px;
    bottom: 12px;
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    z-index: 10;
}

.toolbar.right { left: auto; right: 12px; }

.btn {
    background: var(--bg);
    color: var(--muted);
    border: none;
    padding: 9px 12px;
    border-radius: 7px;
    font-size: 15px;
    cursor: pointer;
    text-decoration: none;
    transition: background .12s, color .12s;
}

.btn:hover, .btn:focus-visible { background: var(--surface-hover); color: #fff; outline: none; }
.btn.danger:hover { background: var(--danger); }
.btn.ok { color: #7ee2a8; }

.input {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 7px;
    padding: 8px 10px;
    min-width: 260px;
    color: var(--text);
}

.input:focus { outline: 1px solid var(--accent); }

.toast {
    position: fixed;
    left: 50%;
    top: 16px;
    transform: translate(-50%, -150%);
    background: var(--surface-hover);
    color: #fff;
    padding: 8px 14px;
    border-radius: 8px;
    font-size: 14px;
    transition: transform .2s;
    z-index: 20;
}

.toast.show { transform: translate(-50%, 0); }

/* --- Bild-Seite ----------------------------------------------------------------------- */

.viewer {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 24px;
    padding: 16px 16px 72px;
}

.viewer.multiple { justify-content: flex-start; padding-top: 40px; }

.viewer img {
    max-width: 95vw;
    max-height: 85vh;
    box-shadow: 0 0 8px 2px rgba(255, 255, 255, .2);
    background: repeating-conic-gradient(#2b2b2b 0 25%, #333 0 50%) 50% / 20px 20px;
}

.viewer.multiple img { max-height: none; }

.separator {
    width: min(600px, 80vw);
    height: 1px;
    background: var(--border);
}

.loading { color: var(--muted); }

/* --- Video-Seite ---------------------------------------------------------------------- */

.player {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px 16px 72px;
}

.player video {
    max-width: 95vw;
    max-height: 85vh;
    background: #000;
    box-shadow: 0 0 8px 2px rgba(255, 255, 255, .2);
    border-radius: 4px;
}

/* --- Verlauf -------------------------------------------------------------------------- */

.page {
    max-width: 1280px;
    margin: 0 auto;
    padding: 24px 16px 96px;
}

.page h1 {
    text-align: center;
    font-size: 36px;
    font-weight: 600;
    margin: 12px 0 28px;
}

.grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 16px;
}

.card {
    position: relative;
    background: var(--surface);
    border-radius: 10px;
    overflow: hidden;
    transition: transform .12s, background .12s;
}

.card:hover { transform: translateY(-2px); background: var(--surface-hover); }

.card a { color: inherit; text-decoration: none; display: block; }

.card img {
    display: block;
    width: 100%;
    aspect-ratio: 16 / 10;
    object-fit: cover;
    background: #1b1b1b;
}

.card .info {
    display: flex;
    justify-content: space-between;
    gap: 8px;
    padding: 8px 10px;
    font-size: 13px;
}

.card .name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.card .time { color: var(--muted); white-space: nowrap; }

.card .remove {
    position: absolute;
    top: 6px;
    right: 6px;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    border: none;
    background: rgba(0, 0, 0, .55);
    color: #fff;
    cursor: pointer;
    opacity: 0;
    transition: opacity .12s;
}

.card:hover .remove, .card .remove:focus-visible { opacity: 1; }
.card .remove:hover { background: var(--danger); }

.empty {
    text-align: center;
    color: var(--muted);
    line-height: 1.6;
    margin-top: 60px;
}

.settings {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    align-items: center;
    gap: 8px;
    margin-bottom: 24px;
    color: var(--muted);
    font-size: 14px;
}

.settings select {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 7px;
    padding: 6px 8px;
}

@media (max-width: 600px) {
    .grid { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
    .input { min-width: 0; width: 70vw; }
}

/* --- Upload --------------------------------------------------------------------------- */

.upload-page { max-width: 820px; }

.login {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    color: var(--muted);
    margin-top: 40px;
}

.login .input { width: min(420px, 90vw); }
.error { color: var(--danger); margin: 0; }

.btn.primary { background: var(--surface-hover); color: #fff; }
.btn.primary:hover { background: #45464b; }

.dropzone {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 6px;
    min-height: 220px;
    border: 2px dashed var(--border);
    border-radius: 14px;
    background: var(--surface);
    color: var(--muted);
    cursor: pointer;
    text-align: center;
    padding: 24px;
    transition: border-color .12s, background .12s;
}

.dropzone strong { color: var(--text); font-size: 20px; font-weight: 600; }
.dropzone:hover, .dropzone.active { border-color: var(--accent); background: #2f3033; }

.results-bar {
    display: flex;
    justify-content: flex-end;
    gap: 4px;
    margin: 20px 0 8px;
}

.results { display: flex; flex-direction: column; gap: 10px; }

.result {
    display: flex;
    align-items: center;
    gap: 14px;
    background: var(--surface);
    border-radius: 10px;
    padding: 10px;
}

.result .thumb {
    flex: none;
    width: 64px;
    height: 64px;
    border-radius: 6px;
    overflow: hidden;
    background: #1b1b1b;
    display: grid;
    place-items: center;
    color: var(--muted);
    font-size: 22px;
}

.result .thumb img { width: 100%; height: 100%; object-fit: cover; }

.result .meta { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 6px; }
.result .name { font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.result .status { font-size: 13px; color: var(--muted); }
.result .status a { color: var(--accent); text-decoration: none; }
.result .status a:hover { text-decoration: underline; }

.result .bar { height: 4px; border-radius: 2px; background: var(--border); overflow: hidden; }
.result .bar > div { height: 100%; width: 0; background: var(--accent); transition: width .15s; }
.result.ok .bar > div { background: #46a758; }
.result.failed .bar > div { width: 100%; background: var(--danger); }
.result.failed .status { color: var(--danger); }

.switch {
    display: grid;
    grid-template-columns: auto 1fr;
    column-gap: 10px;
    align-items: center;
    margin-top: 14px;
    color: var(--text);
    font-size: 14px;
    cursor: pointer;
}

.switch input { width: 16px; height: 16px; accent-color: var(--accent); }
.switch small { grid-column: 2; color: var(--muted); font-size: 12px; }
.result .note { color: #e5b567; }
