#reader {
    width: 100vw; height: 100vh;
    object-fit: cover;
    position: absolute;
    top: 0; left: 0;
    z-index: 1;
    background: #000;
}

/* Viewfinder: rounded aperture, everything outside it dimmed */
#scanbox {
    position: absolute;
    top: 40%; left: 50%;
    width: 80vw; height: 40vh;
    max-width: 400px; max-height: 300px;
    border: 2px solid rgba(255, 255, 255, 0.85);
    border-radius: 16px;
    transform: translate(-50%, -50%);
    z-index: 2;
    box-sizing: border-box;
    box-shadow: 0 0 0 200vmax rgba(17, 24, 39, 0.45);
    transition: border-color 0.25s ease, box-shadow 0.25s ease;
}

#scanbox.flash-success {
    border-color: #2CC2A5;
    box-shadow:
        0 0 0 200vmax rgba(17, 24, 39, 0.45),
        0 0 24px 6px rgba(44, 194, 165, 0.85);
}

#scanbox_title {
    position: absolute;
    top: calc(100% + 16px);
    bottom: auto;
    left: 50%;
    transform: translateX(-50%);
    width: auto;
    white-space: nowrap;
    background: rgba(255, 255, 255, 0.94);
    color: #194787;
    font-size: 13px;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    text-align: center;
    padding: 9px 20px;
    border-radius: 999px;
    box-shadow: 0 4px 14px rgba(17, 24, 39, 0.25);
    display: block;
}

#scanbox_title:empty {
    display: none;
}
