html,
body {
    height: 100vh;
    overflow: hidden;
    /* Prevent scrolling */
}

body {
    margin: 0;
    font-family: Segoe UI, sans-serif;
    background: linear-gradient(135deg, #0f2027, #203a43, #2c5364);
    display: flex;
    flex-direction: column;
}

.page {
    /* Flex grow to fill the available space in main */
    flex: 1;
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow-y: auto;
}


.card {
    background: #fff;
    padding: 30px;
    border-radius: 20px;
    width: 380px;
    text-align: center;
    box-shadow: 0 20px 40px rgba(0, 0, 0, .2);
    /* Robust centering in flex container */
    margin: auto;
}

.subtitle {
    color: #666;
    margin-bottom: 15px;
}

#startBtn,
#stopBtn {
    padding: 10px 20px;
    border: none;
    border-radius: 10px;
    background: #2c5364;
    color: white;
    cursor: pointer;
}

#reader {
    margin-top: 15px;
    height: 260px;
    border: 3px solid #2c5364;
    border-radius: 16px;
    position: relative;
    overflow: hidden;
}

.viewfinder {
    position: absolute;
    inset: 20px;
    border: 2px solid rgba(44, 83, 100, .7);
    border-radius: 12px;
}

.scan-line {
    position: absolute;
    left: 20px;
    right: 20px;
    height: 3px;
    background: linear-gradient(90deg, transparent, #2c5364, transparent);
    animation: scan 2s linear infinite;
}

@keyframes scan {
    from {
        top: 20px;
    }

    to {
        top: calc(100% - 20px);
    }
}

.status {
    margin-top: 10px;
    font-size: 14px;
}

.status.error {
    color: red;
}

.result-card {
    padding: 40px;
    border-radius: 20px;
    text-align: center;
    color: white;
    width: 360px;
    animation: pop 0.5s ease;
}

.result-card.ok {
    background: linear-gradient(135deg, #0f766e, #14b8a6);
}

.result-card.fail {
    background: linear-gradient(135deg, #7f1d1d, #dc2626);
}

.icon {
    font-size: 72px;
    margin-bottom: 10px;
}

.details {
    margin-top: 15px;
    font-size: 14px;
    opacity: 0.9;
}

@keyframes pop {
    from {
        transform: scale(0.85);
        opacity: 0;
    }

    to {
        transform: scale(1);
        opacity: 1;
    }
}

:root {
    --bg-header: rgba(15, 47, 58, 0.85);
    --text-primary: #ffffff;
    --header-height: 56px;
}

.app-header {
    position: relative;
    top: 0;
    z-index: 1000;
    min-height: var(--header-height);
    padding-inline: env(safe-area-inset-left) env(safe-area-inset-right);
    background: var(--bg-header);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    box-shadow: 0 1px 0 rgba(255, 255, 255, 0.06);
}


.header-inner {
    max-width: 1200px;
    height: 100%;
    margin-inline: auto;
    padding: 0 16px;
    display: flex;
    align-items: center;
    gap: 12px;
}

.logo {
    height: 32px;
    width: auto;
    flex-shrink: 0;
}

.title {
    font-size: clamp(1rem, 2.5vw, 1.25rem);
    font-weight: 600;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

@media (min-width: 768px) {
    .logo {
        height: 36px;
    }

    .header-inner {
        padding: 0 24px;
    }
}

