:root {
    --safe-top: env(safe-area-inset-top, 0px);
    --safe-right: env(safe-area-inset-right, 0px);
    --safe-bottom: env(safe-area-inset-bottom, 0px);
    --safe-left: env(safe-area-inset-left, 0px);
    --bg-fallback: #ffffff;
    --glass-blur: 8px;
    --glass-saturate: 190%;
    --glass-radius: 32px;
    --glass-border: rgba(255, 255, 255, 0.32);
    --glass-highlight: rgba(255, 255, 255, 0.55);
    /* 中间下载卡片透明度：数值越小越透明（0 = 全透明，1 = 不透明） */
    --card-glass-opacity-start: 0.08;
    --card-glass-opacity-mid: 0.03;
    --card-glass-opacity-end: 0.005;
    --card-glass-shine-start: 0.15;
    --card-glass-shine-mid: 0.03;
    --card-glass-border-opacity: 0.22;
    --card-glass-highlight-opacity: 0.35;
    /* 下载卡片距顶部距离：数值越小越靠上（如 10vh），越大越靠下（如 25vh） */
    --card-offset-top: 14vh;
    /* 文字亮度：primary 主标题/输入，secondary 副标题；数值越大越亮（最大 1） */
    --text-primary: #ffffff;
    --text-secondary: rgba(255, 255, 255, 0.9);
    --text-placeholder: rgba(255, 255, 255, 0.68);
    --text-shadow: 0 1px 2px rgba(0, 0, 0, 0.5), 0 2px 8px rgba(0, 0, 0, 0.35);
}

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

html {
    height: 100%;
    height: 100dvh;
    background: var(--bg-fallback);
}

body {
    min-height: 100%;
    min-height: 100dvh;
    font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", "SF Pro Text", "Segoe UI", Roboto, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
    color: var(--text-primary);
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
    background: var(--bg-fallback);
}

.page {
    min-height: 100vh;
    min-height: 100dvh;
    display: flex;
    flex-direction: column;
    position: relative;
    z-index: 1;
}

.bg {
    position: fixed;
    inset: 0;
    z-index: 0;
    background: var(--bg-fallback);
    overflow: hidden;
    pointer-events: none;
}

.bg-video {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center top;
    pointer-events: none;
}

.bg-overlay {
    position: absolute;
    inset: 0;
    background: linear-gradient(
            180deg,
            rgba(0, 0, 0, 0.08) 0%,
            rgba(0, 0, 0, 0.02) 40%,
            rgba(0, 0, 0, 0.12) 100%
    );
    pointer-events: none;
}

/* ── 液态玻璃通用材质 ── */
.glass {
    position: relative;
    background: linear-gradient(
            148deg,
            rgba(255, 255, 255, 0.22) 0%,
            rgba(255, 255, 255, 0.08) 42%,
            rgba(255, 255, 255, 0.03) 100%
    );
    backdrop-filter: blur(var(--glass-blur)) saturate(var(--glass-saturate));
    -webkit-backdrop-filter: blur(var(--glass-blur)) saturate(var(--glass-saturate));
    border: 0.5px solid var(--glass-border);
    box-shadow: 0 1px 0 var(--glass-highlight) inset,
    0 -0.5px 0 rgba(255, 255, 255, 0.06) inset,
    0 24px 48px -12px rgba(0, 0, 0, 0.35),
    0 8px 16px -8px rgba(0, 0, 0, 0.2);
    overflow: hidden;
}

.glass::before {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(
            168deg,
            rgba(255, 255, 255, 0.28) 0%,
            rgba(255, 255, 255, 0.06) 28%,
            transparent 55%
    );
    pointer-events: none;
    z-index: 0;
}

.glass::after {
    content: "";
    position: absolute;
    inset: 0;
    opacity: 0.04;
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
    background-size: 128px 128px;
    pointer-events: none;
    z-index: 0;
}

.glass > * {
    position: relative;
    z-index: 1;
}

.main {
    flex: 1;
    display: flex;
    align-items: flex-start;
    justify-content: center;
    padding: calc(var(--card-offset-top) + var(--safe-top)) max(24px, var(--safe-right)) calc(32px + var(--safe-bottom)) max(24px, var(--safe-left));
    position: relative;
    z-index: 1;
}

.card {
    width: 100%;
    max-width: 680px;
    border-radius: var(--glass-radius);
    padding: 56px 48px;
    text-align: center;
}

.card.glass {
    background: linear-gradient(
            148deg,
            rgba(255, 255, 255, var(--card-glass-opacity-start)) 0%,
            rgba(255, 255, 255, var(--card-glass-opacity-mid)) 42%,
            rgba(255, 255, 255, var(--card-glass-opacity-end)) 100%
    );
    border-color: rgba(255, 255, 255, var(--card-glass-border-opacity));
    box-shadow: 0 1px 0 rgba(255, 255, 255, var(--card-glass-highlight-opacity)) inset,
    0 -0.5px 0 rgba(255, 255, 255, 0.04) inset,
    0 24px 48px -12px rgba(0, 0, 0, 0.28),
    0 8px 16px -8px rgba(0, 0, 0, 0.16);
}

.card.glass::before {
    background: linear-gradient(
            168deg,
            rgba(255, 255, 255, var(--card-glass-shine-start)) 0%,
            rgba(255, 255, 255, var(--card-glass-shine-mid)) 28%,
            transparent 55%
    );
}

.icon {
    width: 72px;
    height: 72px;
    margin: 0 auto 28px;
    border-radius: 22px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(
            145deg,
            rgba(255, 255, 255, 0.3) 0%,
            rgba(255, 255, 255, 0.08) 100%
    );
    backdrop-filter: blur(24px) saturate(180%);
    -webkit-backdrop-filter: blur(24px) saturate(180%);
    border: 0.5px solid rgba(255, 255, 255, 0.4);
    box-shadow: 0 1px 0 rgba(255, 255, 255, 0.5) inset,
    0 12px 32px -8px rgba(10, 132, 255, 0.35);
}

.icon svg {
    width: 34px;
    height: 34px;
    fill: none;
    stroke: rgba(255, 255, 255, 0.92);
    stroke-width: 1.8;
    stroke-linecap: round;
    stroke-linejoin: round;
    filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.15));
}

h1 {
    font-size: 1.85rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 10px;
    letter-spacing: -0.02em;
    text-shadow: var(--text-shadow);
}

.subtitle {
    color: var(--text-secondary);
    font-size: 0.95rem;
    margin-bottom: 40px;
    line-height: 1.65;
    font-weight: 400;
    text-shadow: var(--text-shadow);
}

.input-group {
    display: flex;
    gap: 12px;
    margin-bottom: 20px;
}

input[type="text"] {
    flex: 1;
    min-width: 0;
    padding: 17px 22px;
    border: 0.5px solid rgba(255, 255, 255, 0.28);
    border-radius: 18px;
    font-size: 1.05rem;
    outline: none;
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(20px) saturate(160%);
    -webkit-backdrop-filter: blur(20px) saturate(160%);
    color: var(--text-primary);
    text-shadow: var(--text-shadow);
    transition: border-color 0.25s, box-shadow 0.25s, background 0.25s;
    letter-spacing: 0.04em;
    box-shadow: 0 1px 0 rgba(255, 255, 255, 0.18) inset;
}

input[type="text"]::placeholder {
    color: var(--text-placeholder);
    letter-spacing: normal;
    text-shadow: none;
}

input[type="text"]:focus {
    border-color: rgba(10, 132, 255, 0.65);
    background: rgba(255, 255, 255, 0.14);
    box-shadow: 0 1px 0 rgba(255, 255, 255, 0.22) inset,
    0 0 0 3.5px rgba(10, 132, 255, 0.22);
}

button {
    padding: 17px 32px;
    background: linear-gradient(
            180deg,
            rgba(10, 132, 255, 0.92) 0%,
            rgba(0, 102, 214, 0.88) 100%
    );
    color: #fff;
    border: 0.5px solid rgba(255, 255, 255, 0.28);
    border-radius: 18px;
    font-size: 1.05rem;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.2s cubic-bezier(0.25, 0.46, 0.45, 0.94),
    box-shadow 0.25s, opacity 0.2s, filter 0.2s;
    white-space: nowrap;
    box-shadow: 0 1px 0 rgba(255, 255, 255, 0.3) inset,
    0 6px 24px -4px rgba(10, 132, 255, 0.55);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
}

button:hover {
    filter: brightness(1.06);
    box-shadow: 0 1px 0 rgba(255, 255, 255, 0.35) inset,
    0 10px 32px -4px rgba(10, 132, 255, 0.65);
    transform: translateY(-1px);
}

button:active {
    transform: translateY(0) scale(0.97);
    filter: brightness(0.96);
}

button:disabled {
    opacity: 0.45;
    cursor: not-allowed;
    transform: none;
    filter: none;
    box-shadow: none;
}

button.btn-glass {
    background: linear-gradient(
            148deg,
            rgba(255, 255, 255, 0.2) 0%,
            rgba(255, 255, 255, 0.08) 42%,
            rgba(255, 255, 255, 0.04) 100%
    );
    backdrop-filter: blur(20px) saturate(180%);
    -webkit-backdrop-filter: blur(20px) saturate(180%);
    border: 0.5px solid rgba(255, 255, 255, 0.32);
    color: var(--text-primary);
    text-shadow: var(--text-shadow);
    box-shadow: 0 1px 0 rgba(255, 255, 255, 0.3) inset,
    0 8px 20px -8px rgba(0, 0, 0, 0.2);
}

button.btn-glass:hover {
    background: linear-gradient(
            148deg,
            rgba(255, 255, 255, 0.28) 0%,
            rgba(255, 255, 255, 0.12) 42%,
            rgba(255, 255, 255, 0.06) 100%
    );
    border-color: rgba(255, 255, 255, 0.42);
    filter: none;
    box-shadow: 0 1px 0 rgba(255, 255, 255, 0.4) inset,
    0 10px 28px -8px rgba(0, 0, 0, 0.25);
    transform: translateY(-1px);
}

button.btn-glass:active {
    transform: translateY(0) scale(0.97);
    filter: none;
    background: linear-gradient(
            148deg,
            rgba(255, 255, 255, 0.16) 0%,
            rgba(255, 255, 255, 0.06) 100%
    );
}

button.btn-glass:disabled {
    opacity: 0.45;
    cursor: not-allowed;
    transform: none;
    filter: none;
    box-shadow: 0 1px 0 rgba(255, 255, 255, 0.15) inset;
}

.toast {
    position: fixed;
    top: calc(18px + var(--safe-top));
    left: 50%;
    z-index: 200;
    transform: translateX(-50%) translateY(-150%);
    max-width: min(420px, calc(100vw - 32px));
    padding: 15px 24px;
    border-radius: 18px;
    font-size: 1.08rem;
    font-weight: 600;
    line-height: 1.5;
    letter-spacing: 0.005em;
    text-align: center;
    color: #ffffff;
    background: linear-gradient(
            148deg,
            rgba(255, 255, 255, 0.24) 0%,
            rgba(255, 255, 255, 0.1) 42%,
            rgba(255, 255, 255, 0.05) 100%
    );
    backdrop-filter: blur(22px) saturate(180%);
    -webkit-backdrop-filter: blur(22px) saturate(180%);
    border: 0.5px solid rgba(255, 255, 255, 0.35);
    box-shadow: 0 1px 0 rgba(255, 255, 255, 0.4) inset,
    0 12px 36px -8px rgba(0, 0, 0, 0.4);
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity 0.4s ease,
    transform 0.45s cubic-bezier(0.34, 1.56, 0.64, 1),
    visibility 0.4s;
}

.toast.visible {
    opacity: 1;
    visibility: visible;
    transform: translateX(-50%) translateY(0);
}

.toast.error {
    color: #ff4841;
}

.toast.success {
    color: #46ff8e;
}

.footer {
    position: relative;
    z-index: 1;
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    align-items: center;
    gap: 0 12px;
    padding: 20px max(24px, var(--safe-right)) calc(32px + var(--safe-bottom)) max(24px, var(--safe-left));
    text-align: center;
    color: rgba(255, 255, 255, 0.72);
    font-size: 0.8rem;
    line-height: 1.5;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.4);
}

.footer a {
    color: rgba(255, 255, 255, 0.72);
    text-decoration: none;
    transition: color 0.2s;
}

.footer a:hover {
    color: #ffffff;
}

/* ── 弹窗遮罩 ── */
.overlay {
    position: fixed;
    inset: 0;
    z-index: 100;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 24px;
    background: rgba(0, 0, 0, 0.35);
    backdrop-filter: blur(20px) saturate(140%);
    -webkit-backdrop-filter: blur(20px) saturate(140%);
}

.overlay.visible {
    display: flex;
}

.modal {
    width: 100%;
    max-width: 440px;
    border-radius: 28px;
    padding: 36px 32px 28px;
    animation: modalIn 0.35s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

@keyframes modalIn {
    from {
        opacity: 0;
        transform: translateY(20px) scale(0.94);
        filter: blur(4px);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
        filter: blur(0);
    }
}

.modal-title {
    font-size: 1.3rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 22px;
    text-align: center;
    letter-spacing: -0.02em;
}

.modal-info {
    background: rgba(255, 255, 255, 0.08);
    border: 0.5px solid rgba(255, 255, 255, 0.18);
    border-radius: 18px;
    padding: 18px 20px;
    margin-bottom: 16px;
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    box-shadow: 0 1px 0 rgba(255, 255, 255, 0.12) inset;
}

.modal-info-row {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 16px;
    font-size: 0.92rem;
    line-height: 1.5;
}

.modal-info-row + .modal-info-row {
    margin-top: 12px;
    padding-top: 12px;
    border-top: 0.5px solid rgba(255, 255, 255, 0.12);
}

.modal-label {
    color: var(--text-secondary);
    flex-shrink: 0;
}

.modal-value {
    color: var(--text-primary);
    font-weight: 600;
    text-align: right;
    word-break: break-all;
}

.modal-warning {
    display: flex;
    gap: 10px;
    align-items: flex-start;
    padding: 14px 16px;
    background: rgba(255, 159, 10, 0.12);
    border: 0.5px solid rgba(255, 159, 10, 0.28);
    border-radius: 16px;
    font-size: 0.88rem;
    color: rgba(255, 200, 120, 0.95);
    line-height: 1.55;
    margin-bottom: 24px;
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    box-shadow: 0 1px 0 rgba(255, 255, 255, 0.08) inset;
}

.modal-warning svg {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
    margin-top: 2px;
    fill: none;
    stroke: #ff9f0a;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.modal-actions {
    display: flex;
    gap: 12px;
}

.modal-actions button {
    flex: 1;
    padding: 14px 20px;
    font-size: 1rem;
    border-radius: 16px;
}

.btn-cancel {
    background: rgba(255, 255, 255, 0.12);
    color: rgba(255, 255, 255, 0.85);
    box-shadow: 0 1px 0 rgba(255, 255, 255, 0.15) inset;
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
}

.btn-cancel:hover {
    background: rgba(255, 255, 255, 0.18);
    box-shadow: 0 1px 0 rgba(255, 255, 255, 0.2) inset;
    transform: translateY(-1px);
    filter: none;
}

@media (max-width: 600px) {
    :root {
        --glass-radius: 24px;
        --toast-offset: 18px;
        --toast-height: 56px;
        --toast-gap: 20px;
        --card-offset-top: max(8vh, calc(var(--toast-offset) + var(--toast-height) + var(--toast-gap)));
        --glass-blur: 12px;
    }

    html, body {
        min-height: 100%;
        min-height: 100dvh;
    }

    .page {
        min-height: 100dvh;
    }

    .main {
        padding: calc(var(--card-offset-top) + var(--safe-top)) max(16px, var(--safe-right)) max(20px, var(--safe-bottom)) max(16px, var(--safe-left));
    }

    .card {
        max-width: 340px;
        padding: 26px 22px;
        border-radius: 22px;
    }

    .icon {
        width: 52px;
        height: 52px;
        border-radius: 16px;
        margin-bottom: 16px;
    }

    .icon svg {
        width: 24px;
        height: 24px;
    }

    h1 {
        font-size: 1.3rem;
        margin-bottom: 6px;
    }

    .subtitle {
        font-size: 0.85rem;
        margin-bottom: 22px;
        padding: 0 4px;
    }

    .input-group {
        margin-bottom: 0;
    }

    .input-group {
        flex-direction: column;
        gap: 10px;
    }

    input[type="text"] {
        font-size: 16px;
        padding: 15px 18px;
        border-radius: 14px;
    }

    button {
        width: 100%;
        padding: 15px 16px;
        font-size: 16px;
        min-height: 48px;
        border-radius: 14px;
        touch-action: manipulation;
        -webkit-tap-highlight-color: transparent;
    }

    .toast {
        font-size: 1.02rem;
        padding: 14px 20px;
    }

    .footer {
        flex-direction: column;
        gap: 4px;
        padding: 16px max(16px, var(--safe-left)) max(24px, var(--safe-bottom)) max(16px, var(--safe-right));
        font-size: 0.75rem;
    }

    .footer span[aria-hidden="true"] {
        display: none;
    }

    .overlay {
        align-items: flex-end;
        padding: 0;
    }

    .modal {
        max-width: 100%;
        padding: 24px 20px max(20px, var(--safe-bottom));
        border-radius: 24px 24px 0 0;
        animation: modalInMobile 0.32s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    }

    @keyframes modalInMobile {
        from {
            opacity: 0;
            transform: translateY(100%);
        }
        to {
            opacity: 1;
            transform: translateY(0);
        }
    }

    .modal-title {
        font-size: 1.15rem;
        margin-bottom: 18px;
    }

    .modal-info {
        padding: 14px 16px;
        border-radius: 14px;
    }

    .modal-info-row {
        flex-direction: column;
        gap: 4px;
    }

    .modal-value {
        text-align: left;
    }

    .modal-warning {
        font-size: 0.84rem;
        padding: 12px 14px;
        border-radius: 14px;
        margin-bottom: 20px;
    }

    .modal-actions {
        flex-direction: column-reverse;
        gap: 10px;
    }

    .modal-actions button {
        min-height: 48px;
        border-radius: 14px;
    }
}

@media (max-width: 600px) and (max-height: 500px) {
    :root {
        --card-offset-top: max(4vh, calc(var(--toast-offset) + var(--toast-height) + var(--toast-gap)));
    }

    .card {
        padding: 24px 18px;
    }

    .icon {
        width: 48px;
        height: 48px;
        margin-bottom: 14px;
    }

    .icon svg {
        width: 24px;
        height: 24px;
    }

    h1 {
        font-size: 1.3rem;
    }

    .subtitle {
        margin-bottom: 20px;
    }
}

@media (hover: none) {
    button:hover,
    button.btn-glass:hover,
    .btn-cancel:hover,
    .footer a:hover {
        transform: none;
        filter: none;
    }

    button.btn-glass:hover {
        background: linear-gradient(
                148deg,
                rgba(255, 255, 255, 0.2) 0%,
                rgba(255, 255, 255, 0.08) 42%,
                rgba(255, 255, 255, 0.04) 100%
        );
        border-color: rgba(255, 255, 255, 0.32);
        box-shadow: 0 1px 0 rgba(255, 255, 255, 0.3) inset,
        0 8px 20px -8px rgba(0, 0, 0, 0.2);
    }
}

@media (prefers-reduced-motion: reduce) {
    .bg-video {
        display: none;
    }

    .modal {
        animation: none;
    }

    .toast {
        transition: opacity 0.2s linear, visibility 0.2s linear;
        transform: translateX(-50%) translateY(0);
    }
}
