*,
*::before,
*::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}


:root {
    --paper: #f2eee7;
    --paper-dark: #e7e0d6;
    --ink: #252321;
    --brown: #9b6739;
    --muted: #706b64;
    --line: rgba(37,35,33,.16);
    --error: #8d3d35;
}


body {
    min-height: 100vh;
    background: var(--paper);
    color: var(--ink);
    font-family: Arial, Helvetica, sans-serif;
}


button {
    font: inherit;
}


/* =========================================================
   HEADER
========================================================= */

.scan-header {
    min-height: 88px;
    padding: 0 6vw;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid var(--line);
}


.scan-brand {
    display: flex;
    align-items: center;
    gap: 14px;
    color: var(--ink);
    text-decoration: none;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 3px;
}


.scan-brand img {
    width: 52px;
    height: 52px;
    object-fit: contain;
}


.header-link {
    color: var(--ink);
    text-decoration: none;
    font-size: 9px;
    font-weight: 700;
}


/* =========================================================
   PAGE
========================================================= */

.scan-page {
    padding: 90px 7vw 120px;
}


.eyebrow,
.panel-number,
.instruction-label {
    color: var(--brown);
    font-size: 8px;
    font-weight: 700;
    letter-spacing: 2px;
}


.scan-heading {
    max-width: 1100px;
}


.scan-heading h1 {
    margin-top: 18px;
    font-size: clamp(68px, 8vw, 125px);
    line-height: .87;
    letter-spacing: -.06em;
}


.scan-heading h1 em {
    display: block;
    color: var(--brown);
    font-family: Georgia, serif;
    font-style: italic;
    font-weight: 400;
}


.scan-heading > p {
    max-width: 720px;
    margin-top: 35px;
    color: var(--muted);
    font-size: 15px;
    line-height: 1.8;
}


/* =========================================================
   ORDER INFO
========================================================= */

.order-info {
    margin-top: 40px;
    padding: 18px 20px;
    border: 1px solid var(--line);
    display: flex;
    justify-content: space-between;
    gap: 20px;
}


.order-info span {
    color: var(--brown);
    font-size: 8px;
    font-weight: 700;
    letter-spacing: 1.5px;
}


/* =========================================================
   ERROR
========================================================= */

.scan-error {
    margin-top: 35px;
    padding: 20px;
    border: 1px solid var(--error);
    color: var(--error);
    font-size: 13px;
    line-height: 1.6;
}


/* =========================================================
   STANDARD PANEL
========================================================= */

.scan-panel,
.review-panel {
    margin-top: 60px;
    padding: 34px;
    border: 1px solid var(--line);
}


.scan-panel h2,
.review-panel h2 {
    margin-top: 9px;
    font-size: 36px;
}


.scan-panel > p,
.review-panel > p {
    max-width: 720px;
    margin-top: 15px;
    color: var(--muted);
    font-size: 13px;
    line-height: 1.7;
}


.instruction-grid {
    margin-top: 30px;
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
}


.instruction-grid article {
    min-height: 125px;
    padding: 18px;
    border: 1px solid var(--line);
}


.instruction-grid strong {
    font-size: 10px;
}


.instruction-grid p {
    margin-top: 10px;
    color: var(--muted);
    font-size: 11px;
    line-height: 1.6;
}


/* =========================================================
   BUTTONS
========================================================= */

.primary-button,
.secondary-button,
.capture-main-button {
    min-height: 56px;
    padding: 0 20px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 9px;
    font-weight: 700;
    letter-spacing: 1px;
    cursor: pointer;
}


.primary-button {
    margin-top: 30px;
    border: 1px solid var(--ink);
    background: var(--ink);
    color: white;
    text-decoration: none;
}


.primary-button:hover {
    background: var(--brown);
    border-color: var(--brown);
}


.secondary-button {
    border: 1px solid var(--ink);
    background: transparent;
    color: var(--ink);
}


.secondary-button:disabled {
    opacity: .35;
    cursor: not-allowed;
}


.capture-main-button {
    min-width: 220px;
    border: 1px solid var(--ink);
    background: var(--ink);
    color: white;
}


.capture-main-button:hover {
    background: var(--brown);
    border-color: var(--brown);
}


/* =========================================================
   CAMERA PANEL
========================================================= */

.camera-panel {
    margin-top: 60px;
}


.camera-topbar {
    margin-bottom: 20px;
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 30px;
}


.camera-topbar h2 {
    margin-top: 8px;
    font-size: 38px;
}


.capture-counter {
    text-align: right;
}


.capture-counter strong {
    display: block;
    font-size: 24px;
}


.capture-counter span {
    color: var(--muted);
    font-size: 7px;
    font-weight: 700;
}


.camera-stage {
    position: relative;
    width: 100%;
    max-width: 860px;
    margin: auto;
    aspect-ratio: 3 / 4;
    overflow: hidden;
    background: #111;
}


.camera-stage video {
    width: 100%;
    height: 100%;
    object-fit: cover;
}


.ear-guide-overlay {
    position: absolute;
    inset: 0;
    pointer-events: none;
    display: flex;
    align-items: center;
    justify-content: center;
}


.ear-guide-shape {
    width: 44%;
    height: 62%;
    border: 3px solid rgba(255,255,255,.8);
    border-radius: 52% 48% 48% 52% / 42% 47% 53% 58%;
    position: relative;
    box-shadow:
        0 0 0 9999px rgba(0,0,0,.12);
}


.ear-guide-inner {
    position: absolute;
    width: 46%;
    height: 45%;
    left: 33%;
    top: 28%;
    border: 2px dashed rgba(255,255,255,.55);
    border-radius: 50%;
}


.camera-warning {
    position: absolute;
    left: 15px;
    right: 15px;
    bottom: 18px;
    padding: 12px 15px;
    background: rgba(0,0,0,.72);
    color: white;
    text-align: center;
    font-size: 9px;
    font-weight: 700;
    letter-spacing: 1px;
}


.secondary-warning {
    bottom: 62px;
}


.camera-instruction {
    max-width: 860px;
    margin: 20px auto 0;
    padding: 22px;
    border: 1px solid var(--line);
}


.camera-instruction h3 {
    margin-top: 8px;
    font-size: 27px;
}


.camera-instruction p {
    margin-top: 8px;
    color: var(--muted);
    font-size: 12px;
    line-height: 1.6;
}


.movement-guide {
    margin-top: 17px;
    display: flex;
    align-items: center;
    gap: 14px;
}


.movement-guide span {
    font-size: 26px;
    color: var(--brown);
}


.movement-guide strong {
    font-size: 10px;
}


.progress-track {
    max-width: 860px;
    height: 5px;
    margin: 18px auto 0;
    background: var(--paper-dark);
}


.progress-fill {
    height: 100%;
    width: 0;
    background: var(--ink);
    transition: width .2s ease;
}


.camera-actions {
    max-width: 860px;
    margin: 20px auto 0;
    display: flex;
    gap: 12px;
}


.mini-preview-strip {
    max-width: 860px;
    margin: 15px auto 0;
    display: grid;
    grid-template-columns: repeat(10, 1fr);
    gap: 4px;
}


.mini-preview-strip img {
    width: 100%;
    aspect-ratio: 1 / 1;
    object-fit: cover;
}


/* =========================================================
   REVIEW
========================================================= */

.review-heading {
    display: flex;
    justify-content: space-between;
    gap: 30px;
}


.review-heading > strong {
    color: var(--brown);
    font-size: 10px;
}


.review-grid {
    margin-top: 30px;
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 8px;
}


.review-item {
    aspect-ratio: 1 / 1;
    position: relative;
    overflow: hidden;
    background: var(--paper-dark);
}


.review-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}


.review-item button {
    position: absolute;
    top: 4px;
    right: 4px;
    width: 25px;
    height: 25px;
    border: none;
    background: rgba(0,0,0,.75);
    color: white;
    cursor: pointer;
}


.review-actions {
    margin-top: 28px;
    display: flex;
    gap: 12px;
}


/* =========================================================
   FINAL
========================================================= */

.final-summary {
    margin-top: 25px;
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
}


.final-summary article {
    padding: 18px;
    border: 1px solid var(--line);
}


.final-summary span {
    color: var(--brown);
    font-size: 8px;
    font-weight: 700;
}


.final-summary strong {
    display: block;
    margin-top: 8px;
    font-size: 28px;
}


.upload-status {
    margin-top: 14px;
    color: var(--brown);
    font-size: 11px;
}


/* =========================================================
   MOBILE
========================================================= */

@media
(max-width: 700px) {

    .scan-header {
        min-height: 72px;
        padding: 0 18px;
    }


    .scan-brand img {
        width: 42px;
        height: 42px;
    }


    .scan-brand span {
        display: none;
    }


    .scan-page {
        padding: 65px 18px 90px;
    }


    .scan-heading h1 {
        font-size: 60px;
    }


    .instruction-grid {
        grid-template-columns: 1fr;
    }


    .camera-topbar,
    .review-heading {
        align-items: flex-start;
        flex-direction: column;
    }


    .capture-counter {
        text-align: left;
    }


    .camera-stage {
        aspect-ratio: 9 / 13;
    }


    .ear-guide-shape {
        width: 54%;
        height: 59%;
    }


    .camera-actions,
    .review-actions {
        flex-direction: column;
    }


    .camera-actions button,
    .review-actions button,
    .review-actions a {
        width: 100%;
    }


    .mini-preview-strip {
        grid-template-columns: repeat(6, 1fr);
    }


    .review-grid {
        grid-template-columns: repeat(3, 1fr);
    }


    .final-summary {
        grid-template-columns: 1fr;
    }

}
[hidden] { display: none !important; }
.scan-order-list { display: grid; gap: 12px; margin: 24px 0; }
.scan-order-list a { text-decoration: none; text-align: center; }
