.ech-scan-open {
    overflow: hidden !important;
}

.ech-scan-overlay {
    position: fixed;
    inset: 0;
    z-index: 100000;
    width: 100vw;
    height: 100vh;
    height: 100dvh;
    overflow: hidden;
    color: #fff;
    background: #020617;
    font-family: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    isolation: isolate;
    overscroll-behavior: none;
}

.ech-scan-reader {
    position: absolute !important;
    inset: 0 !important;
    width: 100% !important;
    height: 100% !important;
    padding: 0 !important;
    border: 0 !important;
    overflow: hidden !important;
}

.ech-scan-reader {
    background:
        radial-gradient(circle at 50% 42%, rgba(16, 185, 129, 0.12), transparent 42%),
        #020617;
}

.ech-scan-reader video,
.ech-scan-reader canvas {
    width: 100% !important;
    height: 100% !important;
    object-fit: cover !important;
}

.ech-scan-vignette {
    position: absolute;
    inset: 0;
    pointer-events: none;
    background:
        linear-gradient(180deg, rgba(2, 6, 23, 0.88) 0%, rgba(2, 6, 23, 0.18) 25%, transparent 42%),
        linear-gradient(0deg, rgba(2, 6, 23, 0.94) 0%, rgba(2, 6, 23, 0.25) 26%, transparent 46%);
}

.ech-scan-header {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    display: grid;
    grid-template-columns: 48px 1fr 48px;
    align-items: center;
    gap: 12px;
    padding: calc(14px + env(safe-area-inset-top)) 18px 12px;
}

.ech-scan-title {
    overflow: hidden;
    font-size: 17px;
    font-weight: 750;
    line-height: 1.2;
    text-align: center;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.ech-scan-icon-button {
    display: inline-flex;
    width: 48px;
    height: 48px;
    align-items: center;
    justify-content: center;
    border: 1px solid rgba(255, 255, 255, 0.18);
    border-radius: 999px;
    color: #fff;
    background: rgba(15, 23, 42, 0.58);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.22);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    transition: transform 150ms ease, background 150ms ease, border-color 150ms ease;
}

.ech-scan-icon-button:active {
    transform: scale(0.94);
}

.ech-scan-icon-button:focus-visible,
.ech-scan-control-button:focus-visible,
.ech-scan-action:focus-visible {
    outline: 3px solid rgba(52, 211, 153, 0.7);
    outline-offset: 3px;
}

.ech-scan-icon-button.is-active {
    color: #052e16;
    border-color: #6ee7b7;
    background: #6ee7b7;
}

.ech-scan-permission {
    position: absolute;
    top: calc(82px + env(safe-area-inset-top));
    left: 50%;
    display: flex;
    width: min(88vw, 430px);
    align-items: center;
    gap: 10px;
    padding: 11px 14px;
    border: 1px solid rgba(110, 231, 183, 0.28);
    border-radius: 16px;
    color: #d1fae5;
    background: rgba(6, 78, 59, 0.76);
    box-shadow: 0 12px 36px rgba(0, 0, 0, 0.26);
    font-size: 13px;
    line-height: 1.35;
    transform: translateX(-50%);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
}

.ech-scan-permission svg {
    width: 22px;
    height: 22px;
    flex: 0 0 auto;
}

.ech-scan-target-wrap {
    position: absolute;
    top: 48%;
    left: 50%;
    width: min(86vw, 460px);
    transform: translate(-50%, -50%);
    transition: opacity 180ms ease;
}

.ech-scan-target {
    position: relative;
    width: 100%;
    height: clamp(150px, 38vw, 210px);
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, 0.32);
    border-radius: 26px;
    box-shadow:
        0 0 0 999vmax rgba(2, 6, 23, 0.32),
        inset 0 0 42px rgba(16, 185, 129, 0.1);
}

.ech-scan-target::before,
.ech-scan-target::after {
    position: absolute;
    inset: 0;
    border: 3px solid transparent;
    border-radius: 26px;
    content: "";
}

.ech-scan-target::before {
    border-top-color: #6ee7b7;
    border-left-color: #6ee7b7;
    clip-path: polygon(0 0, 24% 0, 24% 4px, 4px 4px, 4px 30%, 0 30%);
}

.ech-scan-target::after {
    border-right-color: #6ee7b7;
    border-bottom-color: #6ee7b7;
    clip-path: polygon(76% calc(100% - 4px), calc(100% - 4px) calc(100% - 4px), calc(100% - 4px) 70%, 100% 70%, 100% 100%, 76% 100%);
}

.ech-scan-line {
    position: absolute;
    left: 7%;
    right: 7%;
    top: 10%;
    height: 2px;
    border-radius: 999px;
    background: #4ade80;
    box-shadow: 0 0 8px #22c55e, 0 0 20px rgba(34, 197, 94, 0.85);
    animation: ech-scan-sweep 2.2s ease-in-out infinite;
}

.ech-scan-status {
    width: min(82vw, 390px);
    min-height: 42px;
    margin: 16px auto 0;
    padding: 10px 15px;
    border: 1px solid rgba(255, 255, 255, 0.14);
    border-radius: 999px;
    color: rgba(255, 255, 255, 0.9);
    background: rgba(15, 23, 42, 0.7);
    font-size: 13px;
    font-weight: 650;
    line-height: 20px;
    text-align: center;
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
}

.ech-scan-error {
    position: absolute;
    top: 48%;
    left: 50%;
    display: none;
    width: min(86vw, 390px);
    padding: 22px;
    border: 1px solid rgba(248, 113, 113, 0.24);
    border-radius: 24px;
    background: rgba(15, 23, 42, 0.9);
    box-shadow: 0 22px 70px rgba(0, 0, 0, 0.42);
    text-align: center;
    transform: translate(-50%, -50%);
    backdrop-filter: blur(18px);
    -webkit-backdrop-filter: blur(18px);
}

.ech-scan-error p {
    margin: 0 0 16px;
    color: #fee2e2;
    font-size: 14px;
    line-height: 1.5;
}

.ech-scan-error-actions {
    display: flex;
    justify-content: center;
    gap: 10px;
}

.ech-scan-action {
    min-height: 44px;
    padding: 10px 16px;
    border-radius: 999px;
    color: #052e16;
    background: #6ee7b7;
    font-size: 14px;
    font-weight: 800;
}

.ech-scan-action.is-secondary {
    color: #fff;
    background: rgba(255, 255, 255, 0.1);
}

.ech-scan-controls {
    position: absolute;
    right: 0;
    bottom: 0;
    left: 0;
    display: grid;
    grid-template-columns: minmax(74px, 1fr) minmax(94px, 1fr) minmax(74px, 1fr);
    align-items: end;
    gap: 10px;
    width: min(92vw, 460px);
    margin: 0 auto;
    padding: 20px 8px calc(22px + env(safe-area-inset-bottom));
}

.ech-scan-control {
    display: flex;
    min-width: 0;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    color: rgba(255, 255, 255, 0.84);
    font-size: 11px;
    font-weight: 650;
    line-height: 1.2;
    text-align: center;
}

.ech-scan-control-button {
    display: inline-flex;
    width: 58px;
    height: 58px;
    align-items: center;
    justify-content: center;
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 999px;
    color: #fff;
    background: rgba(15, 23, 42, 0.62);
    box-shadow: 0 10px 34px rgba(0, 0, 0, 0.28);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    transition: transform 150ms ease, opacity 150ms ease;
}

.ech-scan-control-button.is-capture {
    width: 74px;
    height: 74px;
    border: 5px solid rgba(255, 255, 255, 0.96);
    background: rgba(255, 255, 255, 0.2);
    box-shadow: 0 0 0 2px rgba(2, 6, 23, 0.4), 0 14px 42px rgba(0, 0, 0, 0.36);
}

.ech-scan-control-button.is-capture::after {
    width: 52px;
    height: 52px;
    border-radius: 999px;
    background: #fff;
    content: "";
}

.ech-scan-control-button:active {
    transform: scale(0.92);
}

.ech-scan-control-button:disabled,
.ech-scan-icon-button:disabled {
    opacity: 0.38;
}

.ech-scan-control svg,
.ech-scan-icon-button svg {
    width: 24px;
    height: 24px;
}

.ech-scan-file {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
    clip-path: inset(50%);
}

.ech-scan-overlay[data-state="error"] .ech-scan-target-wrap {
    opacity: 0.12;
}

.ech-scan-overlay[data-state="error"] .ech-scan-error {
    display: block;
}

.ech-scan-overlay[data-state="ready"] .ech-scan-permission,
.ech-scan-overlay[data-state="error"] .ech-scan-permission,
.ech-scan-overlay[data-state="analyzing"] .ech-scan-permission {
    display: none;
}

.ech-scan-hidden {
    display: none !important;
}

@keyframes ech-scan-sweep {
    0%, 100% {
        top: 9%;
        opacity: 0.65;
    }
    50% {
        top: 90%;
        opacity: 1;
    }
}

@media (orientation: landscape) and (max-height: 560px) {
    .ech-scan-header {
        padding-top: calc(8px + env(safe-area-inset-top));
    }

    .ech-scan-permission {
        top: calc(66px + env(safe-area-inset-top));
    }

    .ech-scan-target-wrap {
        top: 45%;
        width: min(58vw, 480px);
    }

    .ech-scan-target {
        height: min(36vh, 170px);
    }

    .ech-scan-controls {
        left: auto;
        grid-template-columns: 72px;
        grid-template-rows: repeat(3, auto);
        width: auto;
        padding-right: calc(18px + env(safe-area-inset-right));
    }

    .ech-scan-control {
        display: flex;
    }
}

@media (prefers-reduced-motion: reduce) {
    .ech-scan-line {
        top: 50%;
        animation: none;
    }
}
