@font-face {
    font-family: "ZYN Sans";
    src: url("fonts/ZYNSans-ExtraBold.ttf") format("truetype");
    font-weight: 800;
    font-display: swap;
}

@font-face {
    font-family: "HP Forma";
    src: url("fonts/HPForma-Regular.ttf") format("truetype");
    font-weight: 400;
    font-display: swap;
}

@font-face {
    font-family: "HP Forma";
    src: url("fonts/HPForma-Medium.ttf") format("truetype");
    font-weight: 500;
    font-display: swap;
}

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

html,
body {
    height: 100%;
    background: #ffffff;
}

body {
    display: flex;
    justify-content: center;
    color: #111111;
}

button,
h1,
h2 {
    font-family: "ZYN Sans", "Arial Black", sans-serif;
}

.device {
    width: min(100vw, calc(100dvh * 1080 / 1920));
    height: 100dvh;
    display: flex;
    flex-direction: column;
    background: #10afe6;
    overflow: hidden;
}

.stage {
    flex: 1;
    min-height: 0;
    position: relative;
}

.screen {
    display: none;
    height: 100%;
}

.screen.active {
    display: flex;
}

#screen-cta {
    align-items: center;
    justify-content: center;
    padding: 8% 7%;
    cursor: pointer;
    background: #10afe6;
}

#screen-cta h1 {
    color: #ffffff;
    font-size: clamp(34px, 4.6vw, 68px);
    font-weight: 800;
    line-height: 0.98;
    letter-spacing: -0.03em;
    text-align: center;
    text-transform: uppercase;
}

.screen-card {
    width: 100%;
}

#screen-backgrounds,
#screen-capture,
#screen-loading,
#screen-result {
    padding: 22px 22px 14px;
}

.panel {
    background: #ffffff;
    border-radius: 36px;
    width: 100%;
    height: 100%;
    padding: 36px 28px 28px;
    display: flex;
    flex-direction: column;
    align-items: center;
    min-height: 0;
}

.panel h2 {
    font-size: clamp(26px, 3.2vw, 42px);
    line-height: 1.05;
    letter-spacing: -0.03em;
    text-align: center;
    max-width: 16ch;
}

.panel-center {
    justify-content: center;
}

.dots span {
    opacity: 0;
    animation-duration: 1.6s;
    animation-iteration-count: infinite;
    animation-timing-function: linear;
}

.dots span:nth-child(1) {
    animation-name: dot-one;
}

.dots span:nth-child(2) {
    animation-name: dot-two;
}

.dots span:nth-child(3) {
    animation-name: dot-three;
}

@keyframes dot-one {
    0%, 74% { opacity: 1; }
    75%, 100% { opacity: 0; }
}

@keyframes dot-two {
    0%, 24% { opacity: 0; }
    25%, 74% { opacity: 1; }
    75%, 100% { opacity: 0; }
}

@keyframes dot-three {
    0%, 49% { opacity: 0; }
    50%, 74% { opacity: 1; }
    75%, 100% { opacity: 0; }
}

.background-grid {
    width: 100%;
    flex: 1;
    min-height: 0;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    align-content: center;
    margin: 22px 0;
}

.background-option {
    border: 0;
    padding: 0;
    background: transparent;
    border-radius: 22px;
    cursor: pointer;
    overflow: hidden;
}

.background-option img {
    display: block;
    width: auto;
    height: auto;
    max-width: 100%;
    max-height: 28dvh;
    object-fit: contain;
    border-radius: 22px;
}

.background-option.selected img {
    outline: 5px solid #10afe6;
    outline-offset: -5px;
}

.pill {
    border: 0;
    border-radius: 999px;
    background: #10afe6;
    color: #ffffff;
    font-size: clamp(16px, 1.7vw, 22px);
    letter-spacing: 0.04em;
    text-transform: uppercase;
    padding: 14px 28px;
    cursor: pointer;
    min-width: 160px;
}

.pill:disabled {
    opacity: 0.45;
    cursor: default;
}

#continue-btn {
    margin-top: auto;
}

.capture-actions,
.result-actions {
    display: flex;
    justify-content: center;
    gap: 14px;
    width: 100%;
    margin-top: 22px;
}

.capture-actions {
    margin-bottom: 18px;
}

.camera-stage {
    position: relative;
    width: min(100%, 520px);
    flex: 1;
    min-height: 0;
    border-radius: 8px;
    overflow: hidden;
    background: #d9d9d9;
}

.camera-stage video,
#person-preview {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

#countdown {
    position: absolute;
    z-index: 2;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: "ZYN Sans", sans-serif;
    font-size: 7rem;
    color: #ffffff;
    text-shadow: 0 4px 18px rgba(0, 0, 0, 0.45);
    background: rgba(16, 175, 230, 0.28);
}

[hidden] {
    display: none !important;
}

.inline-status {
    min-height: 1.2em;
    margin-top: 12px;
    text-align: center;
    font-family: "HP Forma", sans-serif;
    font-size: 16px;
}

.result-title {
    max-width: 18ch;
}

.result-row {
    width: 100%;
    flex: 1;
    min-height: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 18px;
    margin: 22px 0;
}

#result-image {
    height: 100%;
    max-height: 46dvh;
    width: auto;
    max-width: 68%;
    object-fit: contain;
    background: #f3f3f3;
}

#result-qr {
    width: 132px;
    height: 132px;
    background: #ffffff;
    object-fit: contain;
}

.result-actions {
    margin-top: auto;
}

.result-actions .pill {
    min-width: 0;
    flex: 1;
    padding-left: 12px;
    padding-right: 12px;
}

.legal {
    flex-shrink: 0;
    background: #ffffff;
    color: #111111;
    text-align: center;
    font-family: "HP Forma", sans-serif;
    font-weight: 500;
    font-size: clamp(11px, 1.35vw, 15px);
    line-height: 1.25;
    letter-spacing: 0.01em;
    text-transform: uppercase;
    padding: 16px 28px 20px;
}

@page {
    margin: 0;
    size: auto;
}

@media print {
    html,
    body {
        width: 100%;
        height: 100%;
        margin: 0;
        padding: 0;
        background: #ffffff;
        overflow: hidden;
    }

    body {
        display: block;
    }

    .device,
    .stage,
    #screen-result,
    #screen-result .panel,
    .result-row {
        display: block;
        width: 100%;
        height: auto;
        min-height: 0;
        margin: 0;
        padding: 0;
        background: #ffffff;
        overflow: hidden;
        border-radius: 0;
    }

    .legal,
    .result-actions,
    .result-title,
    #result-qr,
    #capture-status,
    #screen-cta,
    #screen-backgrounds,
    #screen-capture,
    #screen-loading {
        display: none !important;
    }

    #screen-result {
        display: block !important;
    }

    #result-image {
        position: fixed;
        inset: 0;
        display: block;
        width: 100%;
        height: 100%;
        max-width: none;
        max-height: none;
        margin: 0;
        object-fit: contain;
        background: #ffffff;
        break-inside: avoid;
        page-break-inside: avoid;
        page-break-after: avoid;
        page-break-before: avoid;
    }
}
