@font-face {
    font-family: 'Cairo';
    src: url(../../qs/fonts/cairo-regular.woff2) format('woff2');
    font-weight: 400;
    font-style: normal;
    font-display: swap;
}

:root {
    --bg1: #101525;
    --bg2: #18213a;
    --card: rgba(255, 255, 255, .11);
    --border: rgba(255, 255, 255, .16);
    --text: #fff;
    --muted: rgba(255, 255, 255, .68);
    --gold: #f7c873;
    --blue: #67a7ff;
    --green: #42d79b;
    --red: #ff6f8f;
}

* {
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

html,
body {
    margin: 0;
    padding: 0;
    min-height: 100vh;
    font-family: 'Cairo', sans-serif;
    color: var(--text);
    background:
        radial-gradient(circle at top right, rgba(103, 167, 255, .22), transparent 34%),
        radial-gradient(circle at bottom left, rgba(247, 200, 115, .18), transparent 35%),
        linear-gradient(160deg, var(--bg2), var(--bg1));
    overflow-x: hidden;
}

button,
input {
    font-family: 'Cairo', sans-serif;
}

form {
    min-height: 100vh;
}

.page {
    width: 100%;
    max-width: 480px;
    min-height: 100vh;
    margin: 0 auto;
    padding: calc(18px + env(safe-area-inset-top)) 16px 18px;
    display: flex;
    flex-direction: column;
}

.topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 16px;
}

.portal-title {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
}

.portal-logo {
    width: 44px;
    height: 44px;
    border-radius: 17px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--gold), #eaa348);
    color: #17213a;
    font-size: 1rem;
    font-weight: 900;
    box-shadow: 0 14px 28px rgba(247, 200, 115, .20);
    flex: 0 0 auto;
}

.portal-text {
    margin: 0;
    font-size: 1rem;
    font-weight: 900;
    color: #fff;
    line-height: 1.3;
    white-space: nowrap;
}

.back-btn {
    height: 40px;
    padding: 0 13px;
    border-radius: 999px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, .10);
    border: 1px solid rgba(255, 255, 255, .16);
    color: rgba(255, 255, 255, .88);
    text-decoration: none;
    font-size: .8rem;
    font-weight: 900;
    white-space: nowrap;
}

.back-btn:active {
    transform: scale(.96);
}

.header {
    text-align: center;
    padding: 8px 0 18px;
}

.logo {
    width: 62px;
    height: 62px;
    margin: 0 auto 12px;
    border-radius: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--gold), #eaa348);
    color: #17213a;
    font-size: 1.25rem;
    font-weight: 900;
    box-shadow: 0 16px 34px rgba(247, 200, 115, .22);
}

.title {
    margin: 0;
    font-size: 1.55rem;
    font-weight: 900;
    line-height: 1.35;
}

.subtitle {
    margin: 8px 0 0;
    color: var(--muted);
    font-size: .86rem;
    font-weight: 700;
    line-height: 1.8;
}

.switch-box {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin-bottom: 14px;
}

.switch-btn {
    height: 54px;
    border: 1px solid var(--border);
    border-radius: 20px;
    background: rgba(255, 255, 255, .09);
    color: rgba(255, 255, 255, .82);
    font-size: .92rem;
    font-weight: 900;
    cursor: pointer;
}

.switch-btn.active {
    background: var(--gold);
    color: #17213a;
    border-color: transparent;
    box-shadow: 0 14px 28px rgba(247, 200, 115, .18);
}

.card {
    border-radius: 28px;
    padding: 18px;
    background: linear-gradient(135deg, rgba(255, 255, 255, .13), rgba(255, 255, 255, .06));
    border: 1px solid var(--border);
    box-shadow: 0 20px 48px rgba(0, 0, 0, .24);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
}

.section-title {
    margin: 0 0 14px;
    font-size: 1.12rem;
    font-weight: 900;
    line-height: 1.5;
}

.simple-note {
    margin: -6px 0 14px;
    color: var(--muted);
    font-size: .82rem;
    font-weight: 700;
    line-height: 1.7;
}

.input-main {
    width: 100%;
    height: 56px;
    border: 1px solid rgba(255, 255, 255, .15);
    border-radius: 20px;
    padding: 0 15px;
    outline: none;
    background: rgba(255, 255, 255, .10);
    color: #fff;
    font-size: .94rem;
    font-weight: 700;
}

.input-main::placeholder {
    color: rgba(255, 255, 255, .45);
}

.input-main:focus {
    border-color: rgba(247, 200, 115, .55);
    box-shadow: 0 0 0 4px rgba(247, 200, 115, .10);
}

.main-btn {
    width: 100%;
    height: 56px;
    margin-top: 10px;
    border: 0;
    border-radius: 20px;
    font-size: .98rem;
    font-weight: 900;
    cursor: pointer;
    background: var(--gold);
    color: #17213a;
    box-shadow: 0 14px 28px rgba(247, 200, 115, .18);
}

.main-btn:active,
.small-btn:active,
.switch-btn:active {
    transform: scale(.985);
}

.green {
    background: var(--green);
    color: #102421;
}

.red {
    background: var(--red);
    color: #fff;
}

.blue {
    background: var(--blue);
    color: #fff;
}

.soft {
    background: rgba(255, 255, 255, .11);
    color: #fff;
    border: 1px solid rgba(255, 255, 255, .14);
    box-shadow: none;
}

.result-box {
    margin-top: 16px;
    padding: 14px;
    border-radius: 24px;
    background: rgba(255, 255, 255, .09);
    border: 1px solid rgba(255, 255, 255, .12);
    text-align: center;
}

.qr-image {
    width: 230px;
    max-width: 100%;
    height: auto;
    display: block;
    margin: 0 auto 14px;
    padding: 10px;
    border-radius: 22px;
    background: #fff;
    box-shadow: 0 14px 32px rgba(0, 0, 0, .22);
}

.actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin-top: 10px;
}

.small-btn {
    height: 48px;
    border: 0;
    border-radius: 18px;
    font-size: .86rem;
    font-weight: 900;
    cursor: pointer;
}

.reader-box {
    min-height: 250px;
    overflow: hidden;
    border-radius: 24px;
    background: rgba(0, 0, 0, .22);
    border: 1px dashed rgba(255, 255, 255, .26);
    display: flex;
    align-items: center;
    justify-content: center;
}

#reader {
    width: 100%;
    min-height: 250px;
}

#reader video {
    object-fit: cover !important;
    border-radius: 20px;
}

.scan-result {
    margin-top: 14px;
}

.notice,
.server-msg {
    margin-top: 12px;
    padding: 10px 12px;
    border-radius: 16px;
    background: rgba(255, 255, 255, .09);
    border: 1px solid rgba(255, 255, 255, .12);
    color: rgba(255, 255, 255, .82);
    font-size: .82rem;
    font-weight: 800;
    line-height: 1.7;
    text-align: center;
}

.server-msg:empty {
    display: none;
}

.hidden {
    display: none !important;
}

.footer {
    margin-top: auto;
    padding: 24px 8px 4px;
    text-align: center;
}

.footer-line1 {
    color: rgba(255, 255, 255, .82);
    font-size: .8rem;
    font-weight: 900;
    margin-bottom: 4px;
}

.footer-line2 {
    color: rgba(255, 255, 255, .48);
    font-size: .74rem;
    font-weight: 700;
}

.global-loader {
    position: fixed;
    inset: 0;
    z-index: 99999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    background: rgba(10, 14, 26, .72);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
}

.loader-card {
    width: min(260px, 86vw);
    min-height: 170px;
    border-radius: 28px;
    background: linear-gradient(135deg, rgba(255, 255, 255, .16), rgba(255, 255, 255, .07));
    border: 1px solid rgba(255, 255, 255, .18);
    box-shadow: 0 24px 70px rgba(0, 0, 0, .35);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 18px;
    text-align: center;
}

.loader-ring {
    width: 58px;
    height: 58px;
    border-radius: 50%;
    border: 5px solid rgba(255, 255, 255, .18);
    border-top-color: var(--gold);
    border-left-color: var(--gold);
    animation: loaderSpin .8s linear infinite;
}

.loader-text {
    color: #fff;
    font-size: .95rem;
    font-weight: 900;
    line-height: 1.7;
}

body.is-loading {
    cursor: wait;
}

body.is-loading button {
    pointer-events: none;
}

.app-modal {
    position: fixed;
    inset: 0;
    z-index: 100000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 22px;
}

.app-modal-backdrop {
    position: absolute;
    inset: 0;
    background:
        radial-gradient(circle at top right, rgba(247, 200, 115, .16), transparent 36%),
        radial-gradient(circle at bottom left, rgba(103, 167, 255, .14), transparent 36%),
        rgba(8, 12, 24, .76);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
}

.app-modal-card {
    position: relative;
    width: min(360px, 92vw);
    border-radius: 30px;
    padding: 28px 20px 20px;
    text-align: center;
    overflow: hidden;
    background:
        linear-gradient(135deg, rgba(255, 255, 255, .18), rgba(255, 255, 255, .07)),
        linear-gradient(160deg, rgba(24, 33, 58, .96), rgba(16, 21, 37, .96));
    border: 1px solid rgba(255, 255, 255, .18);
    box-shadow: 0 28px 90px rgba(0, 0, 0, .48);
    animation: modalPop .22s ease-out both;
}

.app-modal-card::before {
    content: "";
    position: absolute;
    top: -80px;
    left: 50%;
    width: 190px;
    height: 190px;
    transform: translateX(-50%);
    border-radius: 50%;
    background: rgba(247, 200, 115, .16);
    filter: blur(6px);
    pointer-events: none;
}

.app-modal-close {
    position: absolute;
    top: 12px;
    left: 12px;
    width: 34px;
    height: 34px;
    border: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, .11);
    color: rgba(255, 255, 255, .86);
    font-size: 1.35rem;
    line-height: 1;
    font-weight: 900;
    cursor: pointer;
}

.app-modal-icon {
    position: relative;
    width: 66px;
    height: 66px;
    margin: 0 auto 14px;
    border-radius: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.55rem;
    font-weight: 900;
    box-shadow: 0 18px 35px rgba(0, 0, 0, .22);
}

.app-modal-title {
    position: relative;
    margin: 0;
    color: #fff;
    font-size: 1.18rem;
    font-weight: 900;
    line-height: 1.6;
}

.app-modal-message {
    position: relative;
    margin: 10px 0 20px;
    color: rgba(255, 255, 255, .76);
    font-size: .9rem;
    font-weight: 800;
    line-height: 1.9;
    white-space: pre-line;
}

.app-modal-ok {
    position: relative;
    width: 100%;
    height: 52px;
    border: 0;
    border-radius: 19px;
    background: var(--gold);
    color: #17213a;
    font-size: .95rem;
    font-weight: 900;
    cursor: pointer;
    box-shadow: 0 14px 30px rgba(247, 200, 115, .20);
}

.app-modal-close:active,
.app-modal-ok:active {
    transform: scale(.97);
}

.modal-success {
    background: linear-gradient(135deg, var(--green), #25b87f);
    color: #102421;
}

.modal-error {
    background: linear-gradient(135deg, var(--red), #d94367);
    color: #fff;
}

.modal-warning {
    background: linear-gradient(135deg, var(--gold), #eaa348);
    color: #17213a;
}

.modal-info {
    background: linear-gradient(135deg, var(--blue), #4d82dd);
    color: #fff;
}

body.modal-open {
    overflow: hidden;
}

@keyframes loaderSpin {
    to {
        transform: rotate(360deg);
    }
}

@keyframes modalPop {
    from {
        opacity: 0;
        transform: translateY(12px) scale(.94);
    }

    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

@media (max-width: 360px) {
    .portal-text {
        font-size: .9rem;
    }

    .back-btn {
        height: 38px;
        padding: 0 11px;
        font-size: .76rem;
    }

    .title {
        font-size: 1.38rem;
    }
}

@media (max-height: 690px) {
    .page {
        padding-top: 14px;
    }

    .header {
        padding-bottom: 14px;
    }

    .logo {
        width: 54px;
        height: 54px;
        border-radius: 20px;
        margin-bottom: 10px;
    }

    .title {
        font-size: 1.45rem;
    }

    .subtitle {
        font-size: .82rem;
    }

    .reader-box,
    #reader {
        min-height: 220px;
    }
}
