:root {
    --bg: #0e1116;
    --panel: #161b22;
    --panel-2: #1c2230;
    --line: #262d3a;
    --text: #e6edf3;
    --muted: #8b96a5;
    --accent: #ff4500;
    --accent-2: #ff7a3d;
    --ok: #3fb950;
    --warn: #d29922;
    --err: #f85149;
    --radius: 12px;
}

* { box-sizing: border-box; }

html, body {
    margin: 0;
    padding: 0;
    background: var(--bg);
    color: var(--text);
    font: 15px/1.5 "Segoe UI", system-ui, -apple-system, sans-serif;
}

a { color: var(--accent-2); }

.topbar {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 14px 22px;
    background: linear-gradient(180deg, #171d26, #12171f);
    border-bottom: 1px solid var(--line);
    position: sticky;
    top: 0;
    z-index: 50;
}

.logo {
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 700;
    font-size: 17px;
    letter-spacing: .2px;
}

.logo .mark {
    width: 30px;
    height: 30px;
    border-radius: 9px;
    background: linear-gradient(135deg, var(--accent), #ff9248);
    display: grid;
    place-items: center;
    font-size: 15px;
}

.topbar .spacer { flex: 1; }

.topbar .hint { color: var(--muted); font-size: 13px; }

.wrap {
    max-width: 1420px;
    margin: 0 auto;
    padding: 22px;
    display: grid;
    grid-template-columns: minmax(0, 1fr) 380px;
    gap: 22px;
    align-items: start;
}

/*
 * Op een staand beeldscherm is het venster smal maar heel hoog. Ging de
 * pagina daar naar een kolom, dan werd het telefoonvoorbeeld net zo breed
 * als de pagina en dus ruim 1600 pixels hoog: een enorm zwart vlak waar de
 * rest onder verdween. Vandaar een smallere voorbeeldkolom in plaats van
 * meteen stapelen, en pas stapelen als het echt niet meer past.
 */
@media (max-width: 1180px) {
    .wrap { grid-template-columns: minmax(0, 1fr) 310px; gap: 18px; }
}

@media (max-width: 900px) {
    .wrap { grid-template-columns: 1fr; }
    .side {
        order: -1;
        position: static;   /* meeplakken heeft geen zin boven de inhoud */
    }
    /* Nooit breder dan een echte telefoon, anders vult het het hele scherm. */
    .phone-shell { max-width: 340px; margin: 0 auto; }
}

.card {
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    margin-bottom: 18px;
    overflow: hidden;
}

.card > h2 {
    margin: 0;
    padding: 13px 18px;
    font-size: 14px;
    font-weight: 600;
    letter-spacing: .3px;
    text-transform: uppercase;
    color: var(--muted);
    border-bottom: 1px solid var(--line);
    background: #131922;
    display: flex;
    align-items: center;
    gap: 10px;
}

.card > h2 .num {
    width: 21px; height: 21px;
    border-radius: 50%;
    background: var(--accent);
    color: #fff;
    display: grid; place-items: center;
    font-size: 12px;
    text-transform: none;
}

.card .body { padding: 18px; }

label.field { display: block; margin-bottom: 15px; }
label.field > span.lbl {
    display: block;
    font-size: 13px;
    font-weight: 600;
    margin-bottom: 6px;
    color: #c9d4e0;
}
label.field > span.help {
    display: block;
    font-size: 12px;
    color: var(--muted);
    margin-top: 5px;
}

input[type=text], input[type=number], input[type=password], select, textarea {
    width: 100%;
    background: #0d1117;
    border: 1px solid var(--line);
    color: var(--text);
    border-radius: 9px;
    padding: 10px 12px;
    font: inherit;
    outline: none;
}

input:focus, select:focus, textarea:focus {
    border-color: #3d4a5f;
    box-shadow: 0 0 0 3px rgba(255, 69, 0, .12);
}

textarea { resize: vertical; min-height: 220px; line-height: 1.6; font-size: 14px; }

.row { display: flex; gap: 12px; }
.row > * { flex: 1; min-width: 0; }

.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.grid3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 12px; }

@media (max-width: 620px) {
    .grid2, .grid3 { grid-template-columns: 1fr; }
}

.btn {
    appearance: none;
    border: 1px solid var(--line);
    background: var(--panel-2);
    color: var(--text);
    padding: 10px 16px;
    border-radius: 9px;
    font: inherit;
    font-weight: 600;
    cursor: pointer;
    white-space: nowrap;
}
.btn:hover { background: #232b3a; }
.btn:disabled { opacity: .5; cursor: not-allowed; }

.btn.primary {
    background: linear-gradient(180deg, var(--accent-2), var(--accent));
    border-color: #c93800;
    color: #fff;
}
.btn.primary:hover { filter: brightness(1.07); }
.btn.big { width: 100%; padding: 15px; font-size: 16px; }
.btn.small { padding: 7px 12px; font-size: 13px; }

.inline { display: flex; gap: 10px; align-items: center; }

.switch { display: flex; align-items: center; gap: 10px; cursor: pointer; user-select: none; }
.switch input { appearance: none; width: 42px; height: 24px; border-radius: 12px; background: #2b3444; position: relative; cursor: pointer; transition: background .15s; flex: none; }
.switch input::after { content: ''; position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; border-radius: 50%; background: #8b96a5; transition: .15s; }
.switch input:checked { background: rgba(255,69,0,.35); }
.switch input:checked::after { left: 21px; background: var(--accent); }

input[type=range] { width: 100%; accent-color: var(--accent); background: transparent; }

.note {
    font-size: 13px;
    padding: 10px 13px;
    border-radius: 9px;
    background: #12202c;
    border: 1px solid #1d3448;
    color: #a9c4d8;
}
.note.warn { background: #251d0c; border-color: #46360f; color: #e0c078; }
.note.err  { background: #2a1416; border-color: #4d1f22; color: #ff9d97; }
.note.ok   { background: #10261a; border-color: #1c4429; color: #86d99a; }
.note + .note { margin-top: 8px; }

.pill {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: #0d1117;
    border: 1px solid var(--line);
    border-radius: 999px;
    padding: 4px 11px;
    font-size: 12px;
    color: var(--muted);
}

/* ---------------- telefoonvoorbeeld ---------------- */

.side { position: sticky; top: 78px; }

.phone-shell {
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 16px;
}

.phone {
    width: 100%;
    aspect-ratio: 9 / 16;
    border-radius: 22px;
    overflow: hidden;
    position: relative;
    background: #000;
    border: 1px solid #2b3342;
}

.stage {
    position: absolute;
    top: 0; left: 0;
    width: 1080px;
    height: 1920px;
    transform-origin: top left;
}

.stage .bgimg {
    position: absolute;
    inset: 0;
    width: 100%; height: 100%;
    object-fit: cover;
    background: linear-gradient(160deg, #2b3a55, #101725 60%, #1d1526);
}

.stage .dim { position: absolute; inset: 0; background: #000; opacity: 0; }

.stage .cap {
    position: absolute;
    left: 90px; right: 90px;
    text-align: center;
    font-family: "Arial Black", "Arial Bold", Impact, sans-serif;
    color: #fff;
    line-height: 1.14;
    transform: translateY(-50%);
    text-shadow:
        0 0 12px rgba(0,0,0,.55),
        -4px -4px 0 #000, 4px -4px 0 #000, -4px 4px 0 #000, 4px 4px 0 #000,
        0 -5px 0 #000, 0 5px 0 #000, -5px 0 0 #000, 5px 0 0 #000;
}

.stage .cap .hl { color: #ffe600; }

/* Reddit-kaart, zelfde maten als de PHP-versie */
.rcard {
    position: absolute;
    left: 60px;
    width: 960px;
    top: 50%;
    transform: translateY(-50%) translateY(-90px);
    background: #fff;
    color: #1a1a1b;
    border-radius: 22px;
    padding: 44px;
    box-shadow: 0 18px 44px rgba(0,0,0,.45);
    font-family: "Segoe UI", system-ui, sans-serif;
}
.rcard.dark { background: #1a1a1b; color: #f2f3f5; }

.rcard .head { display: flex; align-items: center; gap: 18px; }
.rcard .av {
    width: 60px; height: 60px; border-radius: 50%;
    background: #ff4500; color: #fff;
    display: grid; place-items: center;
    font-size: 30px; font-weight: 700; flex: none;
}
.rcard .who { font-size: 27px; font-weight: 700; }
.rcard .who em { font-style: normal; font-weight: 400; color: #787c7e; font-size: 24px; }
.rcard.dark .who em { color: #9ca3af; }
.rcard .badge {
    margin-left: auto; background: #ff4500; color: #fff;
    border-radius: 19px; padding: 6px 15px; font-size: 25px; font-weight: 700;
}
.rcard .ttl { font-size: 46px; font-weight: 700; line-height: 1.3; margin: 30px 0 20px; word-break: break-word; }
.rcard .foot { display: flex; align-items: center; gap: 16px; font-size: 28px; font-weight: 700; }
.rcard .foot .up { color: #ff4500; font-size: 34px; }
.rcard .foot .cm { color: #65676b; font-size: 30px; }
.rcard.dark .foot .cm { color: #d7dadc; }

.phone video { position: absolute; inset: 0; width: 100%; height: 100%; background: #000; }

.progress {
    height: 8px;
    border-radius: 999px;
    background: #0d1117;
    overflow: hidden;
    border: 1px solid var(--line);
    margin: 12px 0 8px;
}
.progress > div {
    height: 100%;
    width: 0;
    background: linear-gradient(90deg, var(--accent), #ffb066);
    transition: width .35s ease;
}

.stagelabel { font-size: 13px; color: var(--muted); min-height: 20px; }

.parts { display: flex; flex-direction: column; gap: 10px; margin-top: 12px; }
.part {
    display: flex; align-items: center; gap: 11px;
    background: #0d1117; border: 1px solid var(--line);
    border-radius: 10px; padding: 9px 11px;
}
.part img { width: 34px; height: 60px; object-fit: cover; border-radius: 5px; background: #000; flex: none; }
.part .meta { flex: 1; min-width: 0; font-size: 13px; }
.part .meta b { display: block; }
.part .meta span { color: var(--muted); font-size: 12px; }

table.hist { width: 100%; border-collapse: collapse; font-size: 13px; }
table.hist th, table.hist td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--line); }
table.hist th { color: var(--muted); font-weight: 600; font-size: 12px; text-transform: uppercase; }
table.hist tr:last-child td { border-bottom: 0; }

.state { font-size: 12px; padding: 2px 8px; border-radius: 999px; border: 1px solid; }
.state.done { color: #86d99a; border-color: #1c4429; background: #10261a; }
.state.error { color: #ff9d97; border-color: #4d1f22; background: #2a1416; }
.state.running, .state.queued { color: #e0c078; border-color: #46360f; background: #251d0c; }

/* Kort oplichten zodat je ziet dat er iets is veranderd. */
@keyframes flitsen {
    0%   { box-shadow: 0 0 0 0 rgba(63, 185, 80, .55); }
    100% { box-shadow: 0 0 0 14px rgba(63, 185, 80, 0); }
}
.flits { animation: flitsen 1.1s ease-out 2; border-radius: 11px; }

/* ---------------- eerder gebruikte achtergronden ---------------- */

.bg-lijst {
    display: flex;
    gap: 9px;
    margin-top: 12px;
    overflow-x: auto;
    padding-bottom: 4px;
}

.bg-tegel {
    position: relative;
    flex: none;
    width: 132px;
    background: #0d1117;
    border: 1px solid var(--line);
    border-radius: 10px;
    padding: 0;
    overflow: hidden;
    cursor: pointer;
    text-align: left;
    font: inherit;
    color: var(--text);
}
.bg-tegel:hover { border-color: #3d4a5f; }
.bg-tegel.aan { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }

.bg-tegel img {
    width: 100%;
    height: 74px;
    object-fit: cover;
    display: block;
    background: #000;
}
.bg-tegel .bg-tekst { padding: 7px 9px 9px; }
.bg-tegel .bg-titel {
    font-size: 12px;
    font-weight: 600;
    line-height: 1.35;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    margin-bottom: 3px;
}
.bg-tegel .bg-duur { font-size: 11px; color: var(--muted); }

.bg-weg {
    position: absolute;
    top: 5px; right: 5px;
    width: 22px; height: 22px;
    border-radius: 50%;
    border: 0;
    background: rgba(10, 13, 18, .82);
    color: #cfd8e3;
    font-size: 14px;
    line-height: 1;
    cursor: pointer;
    display: none;
}
.bg-tegel:hover .bg-weg { display: block; }
.bg-weg:hover { background: var(--err); color: #fff; }

/* ---------------- publiceren ---------------- */

.pub-rij {
    display: flex;
    align-items: center;
    gap: 12px;
    background: #0d1117;
    border: 1px solid var(--line);
    border-radius: 10px;
    padding: 11px 13px;
}
.pub-rij + .pub-rij { margin-top: 8px; }

.pub-foto {
    width: 34px; height: 34px; border-radius: 50%;
    background: #2b3444; flex: none; object-fit: cover;
}

.pub-naam { font-weight: 600; font-size: 14px; }
.pub-naam span {
    display: block;
    font-weight: 400;
    font-size: 12px;
    color: var(--muted);
}

/* ---------------- TikTok ---------------- */

.tt-account {
    display: flex;
    align-items: center;
    gap: 12px;
    background: #0d1117;
    border: 1px solid var(--line);
    border-radius: 10px;
    padding: 11px 13px;
}
.tt-account img {
    width: 40px; height: 40px; border-radius: 50%;
    background: #2b3444; flex: none; object-fit: cover;
}
.tt-account .naam { font-weight: 600; }
.tt-account .naam span { display: block; font-weight: 400; font-size: 12px; color: var(--muted); }

.overlay {
    position: fixed;
    inset: 0;
    background: rgba(3, 6, 10, .72);
    display: grid;
    place-items: center;
    z-index: 100;
    padding: 20px;
}

.dialoog {
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 14px;
    width: 100%;
    max-width: 720px;
    max-height: 92vh;
    overflow: auto;
    box-shadow: 0 24px 60px rgba(0, 0, 0, .55);
}
.dialoog > header {
    padding: 16px 20px;
    border-bottom: 1px solid var(--line);
    display: flex;
    align-items: center;
    gap: 12px;
}
.dialoog > header h3 { margin: 0; font-size: 16px; }
.dialoog > .inhoud { padding: 20px; }
.dialoog > footer {
    padding: 16px 20px;
    border-top: 1px solid var(--line);
    display: flex;
    gap: 10px;
    justify-content: flex-end;
    align-items: center;
}

.dialoog .kolommen { display: grid; grid-template-columns: 190px 1fr; gap: 20px; }
@media (max-width: 620px) { .dialoog .kolommen { grid-template-columns: 1fr; } }

.dialoog video {
    width: 100%;
    aspect-ratio: 9 / 16;
    border-radius: 12px;
    background: #000;
    border: 1px solid #2b3342;
}

.login {
    max-width: 360px;
    margin: 14vh auto;
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 26px;
}
.login h1 { margin: 0 0 6px; font-size: 20px; }
.login p { color: var(--muted); font-size: 13px; margin: 0 0 18px; }

.spin {
    width: 14px; height: 14px; flex: none;
    border: 2px solid rgba(255,255,255,.25);
    border-top-color: #fff;
    border-radius: 50%;
    animation: sp .7s linear infinite;
    display: inline-block;
}
@keyframes sp { to { transform: rotate(360deg); } }

.hidden { display: none !important; }
