:root {
    --ink: #1e2821;
    --muted: #59645c;
    --line: #bfc5c1;
    --green: #b9ecc9;
    --green-strong: #38ad7a;
    --warning: #f4743b;
    --surface: #ffffff;
    --shadow: 0 12px 32px rgba(35, 66, 47, 0.08);
}

* {
    box-sizing: border-box;
}

html {
    background: #edf5f1;
    color: var(--ink);
    font-family: "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans CJK SC", sans-serif;
    -webkit-text-size-adjust: 100%;
}

body {
    min-height: 100vh;
    margin: 0;
    background:
        radial-gradient(circle at 12% 10%, rgba(195, 238, 213, 0.52), transparent 28rem),
        #edf5f1;
}

button,
input {
    font: inherit;
}

button {
    -webkit-tap-highlight-color: transparent;
}

.page-shell {
    width: min(100%, 600px);
    min-height: 100vh;
    margin: 0 auto;
    background: var(--surface);
    box-shadow: var(--shadow);
}

.hero {
    overflow: hidden;
    background: #d6eced;
}

.hero img {
    display: block;
    width: 100%;
    height: auto;
}

.lookup-panel {
    padding: 18px 18px 0;
}

.lookup-row {
    display: grid;
    grid-template-columns: minmax(0, 1.55fr) minmax(0, 1fr);
    gap: 12px;
}

.field {
    position: relative;
    display: flex;
    min-width: 0;
    min-height: 72px;
    overflow: hidden;
    border: 1.5px solid #adb7b0;
    border-radius: 8px;
    background: #fff;
    transition: border-color 160ms ease, box-shadow 160ms ease;
}

.field:focus-within {
    border-color: #59bb8b;
    box-shadow: 0 0 0 3px rgba(89, 187, 139, 0.13);
}

.field-label {
    position: absolute;
    top: 10px;
    left: 15px;
    color: #7a857d;
    font-size: 11px;
    line-height: 1;
    letter-spacing: 0.04em;
    pointer-events: none;
}

.field input {
    width: 100%;
    min-width: 0;
    border: 0;
    outline: 0;
    padding: 30px 14px 8px;
    background: transparent;
    color: var(--ink);
    font-size: 16px;
}

.field input::placeholder {
    color: #6e7670;
    opacity: 1;
}

.field-code input {
    padding-right: 54px;
}

.scan-button {
    position: absolute;
    top: 50%;
    right: 9px;
    display: grid;
    width: 44px;
    height: 44px;
    padding: 6px;
    transform: translateY(-50%);
    place-items: center;
    border: 0;
    background: transparent;
    color: #14271b;
    cursor: pointer;
}

.scan-button svg {
    width: 34px;
    height: 34px;
    fill: none;
    stroke: currentColor;
    stroke-linecap: round;
    stroke-linejoin: round;
    stroke-width: 2.6;
}

.field-error {
    min-height: 20px;
    margin: 7px 2px 0;
    color: #c6502f;
    font-size: 13px;
    line-height: 20px;
}

.verify-button {
    position: relative;
    width: 100%;
    min-height: 70px;
    margin: 5px 0 4px;
    border: 0;
    border-radius: 7px;
    background: var(--green);
    color: #233b2d;
    font-size: 27px;
    font-weight: 500;
    letter-spacing: 0.03em;
    cursor: pointer;
    transition: transform 160ms ease, filter 160ms ease;
}

.verify-button:active {
    transform: scale(0.992);
    filter: brightness(0.98);
}

.verify-button:disabled {
    cursor: wait;
    opacity: 0.78;
}

.button-spinner {
    position: absolute;
    top: 50%;
    left: calc(50% + 78px);
    display: none;
    width: 19px;
    height: 19px;
    margin-top: -10px;
    border: 2px solid rgba(35, 59, 45, 0.25);
    border-top-color: #233b2d;
    border-radius: 50%;
    animation: spin 0.75s linear infinite;
}

.verify-button.is-loading .button-spinner {
    display: block;
}

.result-card {
    display: grid;
    grid-template-columns: 46px minmax(0, 1fr);
    gap: 18px;
    align-items: start;
    margin: 18px;
    padding: 22px;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: #fff;
}

.result-card[hidden] {
    display: none;
}

.result-icon {
    display: block;
    width: 46px;
    height: 46px;
    margin-top: 27px;
}

.result-content {
    min-width: 0;
}

.result-eyebrow {
    margin: 0 0 8px;
    color: #314038;
    font-size: 13px;
    font-weight: 500;
    line-height: 1.5;
}

.result-message {
    margin: 0;
    color: #202823;
    font-size: 13px;
    font-weight: 400;
    line-height: 1.65;
    overflow-wrap: anywhere;
}

.result-code {
    margin: 7px 0 0;
    color: #4e5851;
    font-size: 13px;
    line-height: 1.65;
    overflow-wrap: anywhere;
}

.result-note {
    margin: 8px 0 0;
    color: #748078;
    font-size: 13px;
    line-height: 1.5;
}

.result-card[data-status="not_found"] .result-message,
.result-card[data-status="auth_failed"] .result-message,
.result-card[data-status="query_limit"] .result-message,
.result-card[data-status="error"] .result-message {
    color: #b94c2b;
}

.instructions {
    margin: 20px 18px calc(28px + env(safe-area-inset-bottom));
    overflow: hidden;
    border-radius: 9px;
}

.instructions img {
    display: block;
    width: 100%;
    height: auto;
}

.toast {
    position: fixed;
    right: 20px;
    bottom: calc(24px + env(safe-area-inset-bottom));
    left: 20px;
    z-index: 10;
    max-width: 520px;
    margin: 0 auto;
    padding: 13px 16px;
    border-radius: 9px;
    background: rgba(26, 42, 32, 0.92);
    color: #fff;
    font-size: 14px;
    line-height: 1.5;
    text-align: center;
    opacity: 0;
    pointer-events: none;
    transform: translateY(10px);
    transition: opacity 180ms ease, transform 180ms ease;
}

.toast.is-visible {
    opacity: 1;
    transform: translateY(0);
}

.layui-dialog-layer {
    position: fixed;
    inset: 0;
    z-index: 1000;
    display: grid;
    padding: 20px;
    place-items: center;
}

.layui-dialog-layer[hidden] {
    display: none;
}

.layui-dialog-mask {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.3);
    animation: dialog-fade-in 160ms ease-out;
}

.layui-dialog {
    position: relative;
    width: min(100%, 420px);
    overflow: hidden;
    border-radius: 3px;
    background: #fff;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.18);
    animation: dialog-pop-in 160ms ease-out;
}

.layui-dialog-header {
    display: flex;
    height: 42px;
    padding: 0 14px;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid #f1f1f1;
    background: #f8f8f8;
    color: #333;
    font-size: 14px;
    font-weight: 600;
}

.layui-dialog-close {
    display: grid;
    width: 30px;
    height: 30px;
    padding: 0;
    place-items: center;
    border: 0;
    background: transparent;
    color: #999;
    font-family: Arial, sans-serif;
    font-size: 22px;
    font-weight: 400;
    line-height: 1;
    cursor: pointer;
}

.layui-dialog-close:hover,
.layui-dialog-close:focus-visible {
    color: #333;
}

.layui-dialog-body {
    padding: 24px 22px;
    color: #333;
    font-size: 14px;
    line-height: 1.7;
}

.layui-dialog-body p {
    margin: 0;
}

.layui-dialog-footer {
    display: flex;
    padding: 0 12px 12px;
    justify-content: flex-end;
}

.layui-dialog-confirm {
    min-width: 80px;
    height: 32px;
    padding: 0 15px;
    border: 0;
    border-radius: 2px;
    background: #1e9fff;
    color: #fff;
    font-size: 14px;
    cursor: pointer;
}

.layui-dialog-confirm:hover,
.layui-dialog-confirm:focus-visible {
    background: #168ced;
}

.dialog-open {
    overflow: hidden;
}

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

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

@keyframes dialog-fade-in {
    from {
        opacity: 0;
    }
}

@keyframes dialog-pop-in {
    from {
        opacity: 0;
        transform: translateY(-10px) scale(0.98);
    }
}

@media (max-width: 390px) {
    .lookup-panel {
        padding-right: 12px;
        padding-left: 12px;
    }

    .lookup-row {
        gap: 8px;
    }

    .field {
        min-height: 66px;
    }

    .field input {
        padding-right: 9px;
        padding-left: 10px;
        font-size: 14px;
    }

    .field-code input {
        padding-right: 42px;
    }

    .field-label {
        left: 11px;
    }

    .scan-button {
        right: 3px;
        width: 39px;
    }

    .verify-button {
        min-height: 62px;
        font-size: 24px;
    }

    .result-card {
        grid-template-columns: 38px minmax(0, 1fr);
        gap: 13px;
        margin: 15px 12px;
        padding: 17px 14px;
    }

    .result-icon {
        width: 38px;
        height: 38px;
        margin-top: 24px;
    }

    .instructions {
        margin-right: 12px;
        margin-left: 12px;
    }

    .layui-dialog-layer {
        padding: 14px;
    }
}

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        scroll-behavior: auto !important;
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}
