* {
    box-sizing: border-box;
}

html {
    -webkit-text-size-adjust: 100%;
}

body {
    margin: 0;
    font-family: Arial, Helvetica, sans-serif;
    background: #f5f5f5;
    color: #222;
}

button,
input {
    font: inherit;
}

.container {
    width: min(calc(100% - 24px), 640px);
    margin: 0 auto;
    padding: 24px 0 48px;
}


/* --------------------------------------------------
   Header
-------------------------------------------------- */

.header {
    margin-bottom: 20px;
}

.header h1 {
    margin: 0 0 6px;
    font-size: 28px;
    line-height: 1.2;
}

.header p {
    margin: 0 0 10px;
    color: #666;
    line-height: 1.4;
}

.badge {
    display: inline-block;
    padding: 5px 10px;
    border-radius: 999px;
    background: #e8e8e8;
    font-size: 13px;
    font-weight: 600;
}


/* --------------------------------------------------
   Cards
-------------------------------------------------- */

.card {
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 12px;
    padding: 16px;
    margin-bottom: 16px;
}

.result-card {
    min-width: 0;
}


/* --------------------------------------------------
   Labels
-------------------------------------------------- */

.label {
    margin: 0 0 10px;
    color: #666;
    font-size: 14px;
    font-weight: 600;
}


/* --------------------------------------------------
   Session Input
-------------------------------------------------- */

.text-input {
    width: 100%;
    min-height: 48px;
    padding: 10px 12px;

    border: 1px solid #bbb;
    border-radius: 8px;

    background: #fff;
    color: #222;

    font-size: 16px;
    line-height: 1.3;

    text-transform: uppercase;
}

.text-input::placeholder {
    color: #999;
    text-transform: none;
}

.text-input:focus {
    outline: 2px solid #222;
    outline-offset: 2px;
}

.text-input:disabled {
    background: #f1f1f1;
    color: #666;
}


/* --------------------------------------------------
   Status
-------------------------------------------------- */

.status-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;

    margin-bottom: 14px;
}

.connection-row {
    margin-top: 16px;
    margin-bottom: 0;
}

.status {
    flex-shrink: 0;

    font-size: 14px;
    font-weight: 700;
}

.status-off {
    color: #a33;
}

.status-on {
    color: #287a34;
}


/* --------------------------------------------------
   Camera / QR Reader
-------------------------------------------------- */

#reader {
    width: 100%;
    min-height: 0;

    overflow: hidden;

    border-radius: 8px;
    background: #f7f7f7;
}

/*
   html5-qrcode injects video/images inside #reader.
   Keep them responsive on mobile.
*/

#reader video,
#reader img,
#reader canvas {
    max-width: 100% !important;
}

#reader video {
    border-radius: 8px;
}

#reader__scan_region {
    min-height: 0 !important;
}

#reader__dashboard {
    padding: 8px 0 0 !important;
}


/* --------------------------------------------------
   Buttons
-------------------------------------------------- */

.actions {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;

    margin-top: 16px;
}

button {
    width: 100%;
    min-height: 48px;

    padding: 10px 16px;

    border: 1px solid #bbb;
    border-radius: 8px;

    background: #fff;
    color: #222;

    font-size: 16px;
    font-weight: 600;

    cursor: pointer;

    touch-action: manipulation;
}

button:hover:not(:disabled) {
    background: #f5f5f5;
}

button:focus-visible {
    outline: 2px solid #222;
    outline-offset: 2px;
}

button:active:not(:disabled) {
    transform: translateY(1px);
}

button:disabled {
    opacity: 0.45;
    cursor: default;
}


/* --------------------------------------------------
   Scan Result
-------------------------------------------------- */

.scan-result {
    min-height: 50px;

    padding: 12px;

    background: #f7f7f7;
    border: 1px solid #eee;
    border-radius: 8px;

    font-size: 18px;
    font-weight: 700;
    line-height: 1.4;

    overflow-wrap: anywhere;
    word-break: break-word;
}

.result-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 8px 16px;

    margin-top: 10px;

    color: #666;

    font-size: 13px;
    line-height: 1.4;
}


/* --------------------------------------------------
   Messages
-------------------------------------------------- */

.message {
    min-height: 24px;

    line-height: 1.5;

    overflow-wrap: anywhere;
}


/* --------------------------------------------------
   Mobile
-------------------------------------------------- */

@media (max-width: 420px) {
    .container {
        width: min(calc(100% - 20px), 640px);
        padding-top: 18px;
    }

    .header h1 {
        font-size: 26px;
    }

    .card {
        padding: 14px;
    }

    .actions {
        grid-template-columns: 1fr;
    }

    .status-row {
        align-items: flex-start;
    }

    .scan-result {
        font-size: 17px;
    }
}


/* --------------------------------------------------
   Very Small Screens
-------------------------------------------------- */

@media (max-width: 340px) {
    .container {
        width: calc(100% - 16px);
    }

    .header h1 {
        font-size: 24px;
    }

    .card {
        padding: 12px;
    }
}
