* {
    box-sizing: border-box;
}

html, body {
    margin: 0;
    padding: 0;
    background: #0a0a0f;
    color: #eee;
    font-family: system-ui, -apple-system, "Segoe UI", sans-serif;
    height: 100%;
}

    /* ============ LIVE LAYOUT ============ */
    body.live .grid {
        display: grid;
        grid-template-columns: 1fr 1fr 300px;
        grid-template-rows: 100vh;
        gap: 12px;
        padding: 12px;
        height: 100vh;
    }

.panel {
    background: #15151c;
    border-radius: 14px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    border: 1px solid #1f1f2a;
}

    .panel header {
        padding: 12px 16px;
        font-size: 12px;
        letter-spacing: 2px;
        text-transform: uppercase;
        color: #7a7a8c;
        border-bottom: 1px solid #1f1f2a;
        display: flex;
        justify-content: space-between;
        align-items: center;
    }

        .panel header .progress {
            color: #ffb347;
            font-weight: 600;
            letter-spacing: 0;
            text-transform: none;
            font-size: 13px;
        }

.panel-body {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 16px;
    gap: 10px;
    min-height: 0;
}

.canvas-wrap {
    position: relative;
    width: 100%;
    max-width: 480px;
    aspect-ratio: 1 / 1;
    display: flex;
    align-items: center;
    justify-content: center;
}

    .canvas-wrap canvas {
        max-width: 100%;
        max-height: 100%;
        display: block;
        border-radius: 10px;
        image-rendering: pixelated;
        background: #050508;
    }

/* Pixel-grid overlay op analyse-paneel */
.grid-overlay {
    position: absolute;
    inset: 0;
    pointer-events: none;
    border-radius: 10px;
    background-image: linear-gradient(to right, rgba(255,255,255,0.045) 1px, transparent 1px), linear-gradient(to bottom, rgba(255,255,255,0.045) 1px, transparent 1px);
    background-size: 24px 24px;
}

.canvas-message {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    color: #4a4a5a;
    pointer-events: none;
    text-align: center;
    padding: 20px;
    animation: pulse 2.4s ease-in-out infinite;
}

    .canvas-message.hidden {
        display: none;
    }

@keyframes pulse {
    0%, 100% {
        opacity: 0.4;
    }

    50% {
        opacity: 1;
    }
}

.caption {
    font-size: 12px;
    color: #555;
    font-family: ui-monospace, "Courier New", monospace;
    word-break: break-all;
    text-align: center;
    max-width: 100%;
}

/* ============ STATS PANEEL ============ */
.panel-stats ul {
    list-style: none;
    margin: 0;
    padding: 8px 16px;
    flex: 1;
    overflow-y: auto;
}

.panel-stats li {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 10px;
    padding: 10px 0;
    border-bottom: 1px solid #1f1f2a;
    font-size: 13px;
}

    .panel-stats li span {
        color: #888;
    }

    .panel-stats li b {
        color: #ffb347;
        font-variant-numeric: tabular-nums;
        font-weight: 600;
    }

.upload-hint {
    padding: 14px 16px;
    font-size: 12px;
    color: #777;
    border-top: 1px solid #1f1f2a;
    text-align: center;
}

    .upload-hint code {
        background: #1f1f2a;
        padding: 2px 6px;
        border-radius: 4px;
        color: #ffb347;
        font-size: 11px;
    }

/* ============ UPLOAD PAGINA ============ */
body.upload-page {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    background: radial-gradient(circle at top, #1a1a24 0%, #0a0a0f 60%);
}

.upload-card {
    width: 100%;
    max-width: 460px;
    background: #15151c;
    border-radius: 20px;
    padding: 28px 24px;
    border: 1px solid #1f1f2a;
    box-shadow: 0 20px 60px rgba(0,0,0,0.5);
}

    .upload-card h1 {
        margin: 0 0 6px;
        font-size: 26px;
        text-align: center;
    }

    .upload-card > p {
        margin: 0 0 22px;
        text-align: center;
        color: #888;
        font-size: 14px;
    }

.upload-zone {
    display: block;
    border: 2px dashed #2a2a3a;
    border-radius: 14px;
    padding: 32px 16px;
    text-align: center;
    cursor: pointer;
    transition: border-color .2s, background .2s;
    color: #777;
    font-size: 14px;
    position: relative;
    overflow: hidden;
    min-height: 160px;
    display: flex;
    align-items: center;
    justify-content: center;
}

    .upload-zone:hover,
    .upload-zone.dragover {
        border-color: #ffb347;
        background: rgba(255, 179, 71, 0.05);
        color: #ccc;
    }

    .upload-zone input {
        display: none;
    }

    .upload-zone img {
        max-width: 100%;
        max-height: 240px;
        border-radius: 10px;
        display: block;
    }

    .upload-zone.has-preview .upload-zone-text {
        display: none;
    }

#submit-btn {
    width: 100%;
    margin-top: 18px;
    padding: 14px;
    border: none;
    border-radius: 12px;
    background: linear-gradient(135deg, #ffb347, #ff7a45);
    color: #1a0f00;
    font-weight: 700;
    font-size: 16px;
    cursor: pointer;
    transition: transform .1s, opacity .2s;
}

    #submit-btn:hover:not(:disabled) {
        transform: translateY(-1px);
    }

    #submit-btn:disabled {
        opacity: 0.4;
        cursor: not-allowed;
    }

.upload-status {
    margin-top: 16px;
    text-align: center;
    font-size: 14px;
    min-height: 20px;
    color: #88ff88;
}

    .upload-status.error {
        color: #ff7a7a;
    }

/* Responsive: op kleine schermen stapelen */
@media (max-width: 900px) {
    body.live .grid {
        grid-template-columns: 1fr;
        grid-template-rows: auto;
        height: auto;
    }

    body.live {
        height: auto;
    }

    .panel {
        min-height: 320px;
    }
}

/* ============ BATCH PAGINA ============ */
.batch-field {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    margin-bottom: 14px;
    font-size: 14px;
    color: #aaa;
}

    .batch-field select {
        background: #1f1f2a;
        color: #eee;
        border: 1px solid #2a2a3a;
        border-radius: 8px;
        padding: 8px 12px;
        font-size: 14px;
        min-width: 220px;
        cursor: pointer;
    }

#batch-start {
    width: 100%;
    margin-top: 6px;
    padding: 14px;
    border: none;
    border-radius: 12px;
    background: linear-gradient(135deg, #6ec1ff, #4a7aff);
    color: #06101f;
    font-weight: 700;
    font-size: 16px;
    cursor: pointer;
    transition: transform .1s, opacity .2s;
}

    #batch-start:hover:not(:disabled) {
        transform: translateY(-1px);
    }

    #batch-start:disabled {
        opacity: 0.4;
        cursor: not-allowed;
    }

.batch-progress {
    margin-top: 18px;
}

.batch-bar {
    width: 100%;
    height: 10px;
    background: #1f1f2a;
    border-radius: 6px;
    overflow: hidden;
}

.batch-bar-fill {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, #6ec1ff, #4a7aff);
    transition: width .2s ease;
}

.batch-status {
    margin-top: 8px;
    font-size: 13px;
    color: #888;
    text-align: center;
}

.batch-history {
    margin-top: 28px;
    border-top: 1px solid #1f1f2a;
    padding-top: 18px;
}

    .batch-history h3 {
        margin: 0 0 10px;
        font-size: 13px;
        letter-spacing: 1px;
        text-transform: uppercase;
        color: #666;
    }

    .batch-history ul {
        list-style: none;
        margin: 0;
        padding: 0;
        font-size: 13px;
        color: #888;
    }

    .batch-history li {
        padding: 6px 0;
        border-bottom: 1px solid #1a1a22;
        font-family: ui-monospace, "Courier New", monospace;
    }

/* ============ TERUG-LINK (stream/upload/batch) ============ */
.back-home {
    position: fixed;
    top: 14px;
    left: 14px;
    padding: 8px 14px;
    background: rgba(255,255,255,0.08);
    border: 1px solid rgba(255,255,255,0.12);
    border-radius: 999px;
    color: #ddd;
    text-decoration: none;
    font-size: 13px;
    font-weight: 600;
    z-index: 100;
    backdrop-filter: blur(8px);
    transition: background .2s, transform .1s;
}

    .back-home:hover {
        background: rgba(255,255,255,0.16);
        transform: translateY(-1px);
    }

.back-link {
    margin-top: 18px;
    text-align: center;
    font-size: 13px;
}

    .back-link a {
        color: #ffb347;
        text-decoration: none;
    }

        .back-link a:hover {
            text-decoration: underline;
        }

.upload-hint a {
    color: #ffb347;
    text-decoration: none;
}

    .upload-hint a:hover {
        text-decoration: underline;
    }

.canvas-wrap {
    position: relative; /* Zorgt dat de SVG er netjes overheen valt */
}

.kai-face {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none; /* Zorgt dat je er doorheen kunt klikken */
    z-index: 10; /* Zorgt dat hij bovenop de blokjes ligt */
}