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

:root {
    --theme: #4f46e5;
    --theme-dark: #4338ca;
    --theme-soft: #eef2ff;
    --theme-rgb: 79, 70, 229;
    --text: #1f2937;
    --text-secondary: #6b7280;
    --border: #e5e7eb;
    --bg: #eef1f8;
    --success: #12b76a;
    --danger: #ef4444;
    --radius: 18px;
}

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

html {
    -webkit-text-size-adjust: 100%;
    text-size-adjust: 100%;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB",
        "Microsoft YaHei", "Helvetica Neue", Arial, sans-serif;
    background: var(--theme);
    color: var(--text);
    font-size: 14px;
    line-height: 1.6;
}

.page {
    position: relative;
    max-width: 500px;
    min-height: 100vh;
    min-height: 100dvh;
    margin: 0 auto;
    padding-bottom: calc(30px + env(safe-area-inset-bottom, 0px));
    background: var(--theme);
    overflow-x: hidden;
}

.page-bg {
    position: fixed;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 100%;
    max-width: 500px;
    height: 100vh;
    height: 100dvh;
    background-color: transparent;
    background-size: cover;
    background-position: top center;
    background-repeat: no-repeat;
    z-index: 0;
    pointer-events: none;
}

/* ---------- 页面标题 ---------- */
.hero {
    position: relative;
    z-index: 1;
    padding: 30px max(20px, env(safe-area-inset-right, 0px)) 18px max(20px, env(safe-area-inset-left, 0px));
    text-align: center;
}

.hero-inner {
    position: relative;
    z-index: 1;
    width: 100%;
}

.hero-inner h1 {
    color: var(--title-color, #ffffff);
    font-size: clamp(20px, 5.8vw, 24px);
    font-weight: 700;
    letter-spacing: 0.5px;
    line-height: 1.4;
    word-break: break-word;
    transition: color 0.2s;
}

.page.has-page-bg .hero-inner h1 {
    color: #fff;
    text-shadow: 0 2px 12px rgba(15, 23, 42, 0.35);
}

/* ---------- 页面内容 ---------- */
.content {
    position: relative;
    z-index: 2;
    padding: 18px max(16px, env(safe-area-inset-right, 0px)) 10px max(16px, env(safe-area-inset-left, 0px));
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.gallery {
    display: flex;
    flex-direction: column;
    gap: 0;
}

.gallery a {
    display: block;
    border-radius: 0;
    overflow: hidden;
    box-shadow: none;
}

.gallery img {
    display: block;
    width: 100%;
    border-radius: 0;
    object-fit: cover;
}

/* ---------- 领取卡片 ---------- */
.claim-card {
    position: relative;
    background: #fff;
    border-radius: var(--radius);
    border: 1px solid rgba(var(--theme-rgb), 0.12);
    padding: 20px 18px 18px;
    box-shadow: 0 14px 34px rgba(var(--theme-rgb), 0.14);
    scroll-margin-top: 12px;
}

.claim-card::before {
    content: "";
    position: absolute;
    top: 0;
    left: 18px;
    width: 46px;
    height: 4px;
    border-radius: 0 0 6px 6px;
    background: linear-gradient(90deg, var(--theme), var(--theme-dark));
}

.claim-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 14px;
}

.claim-title {
    font-size: 16px;
    font-weight: 700;
    color: var(--text);
}

.claim-tag {
    font-size: 11px;
    color: var(--theme-dark);
    background: var(--theme-soft);
    padding: 2px 9px;
    border-radius: 999px;
}

.field {
    margin-bottom: 10px;
}

.input {
    width: 100%;
    height: 46px;
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 0 14px;
    font-size: 16px;
    color: var(--text);
    background: #fafbfe;
    outline: none;
    transition: border-color 0.2s, box-shadow 0.2s, background 0.2s;
}

.input:focus {
    border-color: var(--theme);
    background: #fff;
    box-shadow: 0 0 0 3px rgba(var(--theme-rgb), 0.14);
}

.input::placeholder {
    color: #b3bac7;
    font-size: 14px;
}

.captcha-row {
    display: flex;
    gap: 10px;
    align-items: center;
    margin-bottom: 4px;
}

.captcha-row .input {
    flex: 1;
}

.captcha-img {
    width: 112px;
    height: 46px;
    border-radius: 12px;
    border: 1px solid rgba(var(--theme-rgb), 0.18);
    background: var(--theme-soft);
    cursor: pointer;
    object-fit: cover;
    flex-shrink: 0;
}

.captcha-state {
    height: 18px;
    font-size: 12px;
    margin-bottom: 6px;
    color: var(--success);
}

.captcha-state.error {
    color: var(--danger);
}

.sms-row {
    display: flex;
    gap: 10px;
}

.sms-row .input {
    flex: 1;
}

.id-card-field {
    margin-top: 10px;
    margin-bottom: 4px;
}

.btn-ghost {
    flex-shrink: 0;
    min-width: 108px;
    height: 46px;
    border-radius: 12px;
    border: 1px solid rgba(var(--theme-rgb), 0.28);
    background: var(--theme-soft);
    color: var(--theme-dark);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: opacity 0.2s;
}

.btn-ghost:disabled {
    color: #9aa3b2;
    background: #f3f4f6;
    border-color: var(--border);
    cursor: not-allowed;
}

.btn-primary {
    width: 100%;
    height: 48px;
    border: none;
    border-radius: 12px;
    background: linear-gradient(135deg, var(--theme), var(--theme-dark));
    color: #fff;
    font-size: 16px;
    font-weight: 600;
    letter-spacing: 1px;
    cursor: pointer;
    margin-top: 14px;
    box-shadow: 0 10px 22px rgba(var(--theme-rgb), 0.3);
    transition: transform 0.15s, opacity 0.2s;
}

.btn-primary:active {
    transform: translateY(1px);
}

.btn-primary:disabled {
    opacity: 0.65;
    cursor: not-allowed;
    box-shadow: none;
}

.test-tip {
    background: #fff7ed;
    border: 1px dashed #fdba74;
    color: #c2410c;
    border-radius: 10px;
    padding: 8px 12px;
    font-size: 12px;
    margin-top: 10px;
}

/* ---------- 活动说明 ---------- */
.notice {
    background: #fff;
    border-radius: var(--radius);
    padding: 18px;
    box-shadow: 0 8px 22px rgba(15, 23, 42, 0.05);
}

.notice h2 {
    position: relative;
    font-size: 15px;
    color: var(--text);
    padding-left: 12px;
    margin-bottom: 10px;
}

.notice h2::before {
    content: "";
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 4px;
    height: 15px;
    border-radius: 2px;
    background: var(--theme);
}

.notice-text {
    color: #4b5563;
    font-size: 13px;
    line-height: 1.9;
    white-space: pre-line;
    word-break: break-word;
}

.notice-link {
    display: inline-flex;
    align-items: center;
    gap: 2px;
    margin-top: 8px;
    color: var(--theme-dark);
    font-size: 13px;
    font-weight: 600;
    text-decoration: none;
}

.notice-link::after {
    content: "›";
    font-size: 16px;
    line-height: 1;
    margin-top: -2px;
}

.notice-link:active {
    opacity: 0.7;
}

.hidden {
    display: none !important;
}

/* ---------- 提示与弹窗 ---------- */
.toast {
    position: fixed;
    top: 28px;
    left: 50%;
    transform: translate(-50%, -16px);
    background: rgba(24, 28, 40, 0.92);
    color: #fff;
    font-size: 13px;
    padding: 10px 18px;
    border-radius: 10px;
    max-width: 82%;
    text-align: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.25s, transform 0.25s;
    z-index: 100;
}

.toast.show {
    opacity: 1;
    transform: translate(-50%, 0);
}

.modal {
    position: fixed;
    inset: 0;
    background: rgba(17, 24, 39, 0.55);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    z-index: 90;
}

.modal-card {
    width: 100%;
    max-width: 340px;
    background: #fff;
    border-radius: 20px;
    padding: 26px 22px 20px;
    text-align: center;
    animation: pop 0.22s ease-out;
}

@keyframes pop {
    from {
        opacity: 0;
        transform: scale(0.94);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

.modal-card h2 {
    font-size: 19px;
    margin: 12px 0 6px;
}

.modal-desc {
    color: var(--text-secondary);
    font-size: 13px;
    margin-bottom: 16px;
}

.modal-info {
    background: #f8fafc;
    border-radius: 12px;
    padding: 12px 14px;
    margin-bottom: 6px;
}

.modal-info > div {
    display: flex;
    justify-content: space-between;
    font-size: 13px;
    padding: 4px 0;
}

.modal-info span {
    color: var(--text-secondary);
}

.modal-info .tag {
    color: var(--success);
}

.modal-info .tag-fail {
    color: var(--danger);
}

.modal-info .recharge-success {
    color: var(--success);
}

.modal-info .recharge-fail {
    color: var(--danger);
}

.modal-info .recharge-pending {
    color: #d97706;
}

@media (max-width: 380px) {
    .hero {
        padding: 24px max(16px, env(safe-area-inset-right, 0px)) 14px max(16px, env(safe-area-inset-left, 0px));
    }

    .content {
        padding: 14px max(14px, env(safe-area-inset-right, 0px)) 8px max(14px, env(safe-area-inset-left, 0px));
        gap: 12px;
    }

    .claim-card {
        padding: 18px 14px 16px;
    }

    .notice {
        padding: 16px 14px;
    }

    .btn-ghost {
        min-width: 98px;
        font-size: 12px;
    }

    .captcha-img {
        width: 100px;
    }
}

@media (max-width: 340px) {
    .input {
        height: 44px;
        padding: 0 12px;
    }

    .btn-ghost {
        min-width: 92px;
        height: 44px;
        padding: 0 8px;
    }

    .captcha-img {
        width: 92px;
        height: 44px;
    }

    .btn-primary {
        height: 46px;
        font-size: 15px;
    }

    .claim-card {
        padding: 16px 12px 14px;
    }

    .modal-card {
        padding: 22px 18px 18px;
    }
}
