:root {
    --primary-color: #0071e3;
    --primary-gradient: linear-gradient(135deg, #2997ff, #0051a8);
    --text-main: #1d1d1f;
    --text-secondary: #3a3a3e;
    --glass-bg: rgba(255, 255, 255, 0.72);
    --glass-border: rgba(255, 255, 255, 0.80);
    --radius-main: 28px;
    --radius-inner: 16px;
}

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

html,
body {
    width: 100%;
    min-height: 100vh;
    font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", "SF Pro Text", "Helvetica Neue", Arial, sans-serif;
    color: var(--text-main);
    background-color: #f0f0f2;
}

/* 背景光晕 */
.bg-glow-container {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: -1;
    overflow: hidden;
    background: radial-gradient(circle at 50% 50%, #f0f0f2 0%, #e0e0e5 100%);
}

.glow-blob {
    position: absolute;
    border-radius: 50%;
    filter: blur(100px);
    mix-blend-mode: multiply;
    opacity: 0.25;
    animation: fluidMotion 20s infinite alternate ease-in-out;
}

.blob-1 {
    width: 600px;
    height: 600px;
    background: #9eccff;
    top: -10%;
    left: -10%;
}

.blob-2 {
    width: 500px;
    height: 500px;
    background: #ffbde2;
    bottom: -5%;
    right: -5%;
    animation-delay: -5s;
}

.blob-3 {
    width: 450px;
    height: 450px;
    background: #caadff;
    top: 35%;
    left: 25%;
    animation-delay: -10s;
}

@keyframes fluidMotion {
    0% {
        transform: translate(0, 0) scale(1) rotate(0deg);
    }

    50% {
        transform: translate(60px, -60px) scale(1.15) rotate(90deg);
    }

    100% {
        transform: translate(-40px, 40px) scale(0.9) rotate(-40deg);
    }
}

/* 主容器 */
.app-container {
    width: 100%;
    max-width: 660px;
    margin: 0 auto;
    padding: 24px 16px;
    padding-top: calc(20px + env(safe-area-inset-top));
    padding-bottom: calc(40px + env(safe-area-inset-bottom));
    display: flex;
    flex-direction: column;
    gap: 16px;
}

/* 液态玻璃卡片 */
.liquid-glass-card {
    background: var(--glass-bg);
    backdrop-filter: blur(35px) saturate(210%);
    -webkit-backdrop-filter: blur(35px) saturate(210%);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-main);
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.03), inset 0 1px 2px rgba(255, 255, 255, 0.7), inset 0 -1px 1px rgba(0, 0, 0, 0.01);
    padding: 22px 20px;
    transition: all 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

/* 头部 */
.header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: nowrap;
    padding: 4px 8px;
    gap: 8px;
}

.brand {
    display: flex;
    align-items: center;
    gap: 12px;
}

.logo-box {
    width: 42px;
    height: 42px;
    border-radius: 13px;
    background: var(--primary-gradient);
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 6px 16px rgba(0, 113, 227, 0.25);
}

.logo-box svg {
    width: 28px;
    height: 28px;
    fill: #fff;
}

.brand-text h1 {
    font-size: 18px;
    font-weight: 600;
    letter-spacing: -0.3px;
}

.brand-text p {
    font-size: 11px;
    color: var(--text-secondary);
}

.btn-glass {
    background: rgba(255, 255, 255, 0.5);
    border: 1px solid rgba(255, 255, 255, 0.6);
    padding: 8px 16px;
    border-radius: 30px;
    font-size: 13px;
    font-weight: 500;
    color: var(--primary-color);
    cursor: pointer;
    backdrop-filter: blur(10px);
    transition: all 0.2s ease;
}

.btn-glass:hover {
    background: rgba(255, 255, 255, 0.8);
    transform: scale(1.02);
}

/* 表单 */
.form-item {
    margin-bottom: 18px;
}

.form-item:last-child {
    margin-bottom: 0;
}

.form-label {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-secondary);
    margin-left: 6px;
    margin-bottom: 6px;
    display: block;
}

/* 分类胶囊 */
.category-scroll {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    padding: 2px;
    scrollbar-width: none;
}

.category-scroll::-webkit-scrollbar {
    display: none;
}

.category-pill {
    padding: 10px 18px;
    background: rgba(255, 255, 255, 0.50);
    border: 1px solid rgba(255, 255, 255, 0.5);
    border-radius: 40px;
    font-size: 14px;
    font-weight: 500;
    white-space: nowrap;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    user-select: none;
}

.category-pill.active {
    background: #fff;
    color: var(--primary-color);
    border-color: rgba(255, 255, 255, 0.9);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
    transform: translateY(-1px);
}

/* 输入框 */
.liquid-input,
.liquid-select {
    width: 100%;
    padding: 14px 16px;
    background: rgba(255, 255, 255, 0.85);
    border: 1px solid rgba(0, 0, 0, 0.06);
    border-radius: var(--radius-inner);
    font-size: 16px;
    color: var(--text-main);
    outline: none;
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    appearance: none;
    font-family: inherit;
}

.liquid-input:focus,
.liquid-select:focus {
    background: #ffffff;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 4px rgba(0, 113, 227, 0.15);
}

.liquid-select {
    cursor: pointer;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%233a3a3e' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 16px center;
    padding-right: 40px;
}

/* 商品信息卡片 */
.info-sub-card {
    background: rgba(255, 255, 255, 0.30);
    border-radius: var(--radius-inner);
    border: 1px solid rgba(255, 255, 255, 0.4);
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.info-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 13px;
}

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

.price-value {
    color: #ff3b30;
    font-size: 20px;
    font-weight: 700;
}

.badge {
    background: rgba(52, 199, 89, 0.15);
    color: #248a3d;
    padding: 2px 8px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 600;
}

.badge-out {
    background: rgba(255, 59, 48, 0.12);
    color: #ff3b30;
}

/* 步进器 */
.stepper-container {
    display: flex;
    align-items: center;
    background: rgba(255, 255, 255, 0.85);
    border: 1px solid rgba(0, 0, 0, 0.06);
    border-radius: var(--radius-inner);
    width: fit-content;
    overflow: hidden;
}

.stepper-btn {
    width: 44px;
    height: 44px;
    border: none;
    background: transparent;
    font-size: 18px;
    color: var(--text-main);
    cursor: pointer;
    transition: background 0.2s;
}

.stepper-btn:hover {
    background: rgba(0, 0, 0, 0.04);
}

.stepper-val {
    width: 50px;
    height: 44px;
    border: none;
    background: transparent;
    text-align: center;
    font-size: 15px;
    font-weight: 600;
    outline: none;
}

/* 支付方式 */
.payment-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
}

.payment-item {
    border: 1px solid rgba(255, 255, 255, 0.5);
    background: rgba(255, 255, 255, 0.50);
    border-radius: var(--radius-inner);
    padding: 14px;
    display: flex;
    align-items: center;
    gap: 12px;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.payment-item:hover {
    background: rgba(255, 255, 255, 0.70);
    transform: translateY(-1px);
}

.payment-item.active {
    background: #ffffff;
    border-color: var(--primary-color);
    box-shadow: 0 4px 12px rgba(0, 113, 227, 0.12);
}

.pay-icon {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.pay-icon svg {
    display: block;
}

.pay-icon.alipay {
    background: #E8F0FE;
}

.pay-icon.wechat {
    background: #E8F8F0;
}

.pay-title {
    font-size: 14px;
    font-weight: 500;
}

/* 密码区域 */
.pwd-toggle {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 14px;
    background: rgba(255, 255, 255, 0.3);
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.4);
    cursor: pointer;
}

.pwd-toggle input[type="checkbox"] {
    width: 18px;
    height: 18px;
    accent-color: var(--primary-color);
    cursor: pointer;
}

.pwd-toggle label {
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    color: var(--text-secondary);
}

.pwd-fields {
    margin-top: 10px;
    transition: all 0.3s ease;
}

.pwd-fields.hidden {
    display: none;
}

/* 主按钮 */
.btn-submit {
    width: 100%;
    padding: 15px 24px;
    border: 1px solid rgba(255, 255, 255, 0.5);
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.2);
    backdrop-filter: blur(20px) saturate(180%);
    -webkit-backdrop-filter: blur(20px) saturate(180%);
    color: #0071e3;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.25s ease;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.06);
}

.btn-submit:hover {
    background: rgba(255, 255, 255, 0.35);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
    transform: translateY(-1px);
}

.btn-submit:active {
    transform: scale(0.98);
    background: rgba(255, 255, 255, 0.15);
}

.btn-submit:disabled {
    opacity: 0.4;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.modal-mask {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.35);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    z-index: 999;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.4s ease;
    padding: 20px;
}

.modal-mask.show {
    opacity: 1;
    pointer-events: auto;
}

.modal-body {
    width: 100%;
    max-width: 440px;
    transform: scale(0.92) translateY(15px);
    transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

.modal-mask.show .modal-body {
    transform: scale(1) translateY(0);
}

.modal-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
}

.modal-top h2 {
    font-size: 17px;
    font-weight: 600;
}

.close-circle {
    background: rgba(0, 0, 0, 0.05);
    border: none;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 18px;
    color: var(--text-secondary);
    transition: background 0.2s;
}

.close-circle:hover {
    background: rgba(0, 0, 0, 0.1);
}

.order-result {
    background: rgba(255, 255, 255, 0.3);
    border-radius: 12px;
    padding: 12px 16px;
    margin-bottom: 8px;
    border: 1px solid rgba(255, 255, 255, 0.3);
}

.order-result .row {
    display: flex;
    justify-content: space-between;
    padding: 4px 0;
    font-size: 13px;
}

.order-result .row .label {
    color: var(--text-secondary);
}

/* Toast */
.toast {
    position: fixed;
    top: 20px;
    left: 50%;
    transform: translateX(-50%) translateY(-100px);
    background: rgba(0, 0, 0, 0.75);
    backdrop-filter: blur(20px);
    color: #fff;
    padding: 12px 24px;
    border-radius: 16px;
    font-size: 14px;
    z-index: 1000;
    transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1);
    max-width: 90%;
    text-align: center;
}

.toast.show {
    transform: translateX(-50%) translateY(0);
}

.toast.success {
    background: rgba(52, 199, 89, 0.9);
}

.toast.error {
    background: rgba(255, 59, 48, 0.9);
}

.loading-spinner {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top-color: #fff;
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
    vertical-align: middle;
    margin-right: 8px;
}

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

.tips-text {
    font-size: 12px;
    color: var(--text-secondary);
    line-height: 1.5;
    text-align: center;
    padding: 0 10px;
}

@media (max-width: 480px) {
    .app-container {
        padding: 16px 12px;
        gap: 14px;
    }

    .liquid-glass-card {
        padding: 18px 16px;
        border-radius: 22px;
    }

    .payment-grid {
        grid-template-columns: 1fr;
    }
}

/* product dropdown */
.product-dropdown {
    position: relative;
}

.product-selected {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 16px;
    background: rgba(255, 255, 255, 0.85);
    border: 1px solid rgba(0, 0, 0, 0.06);
    border-radius: 16px;
    cursor: pointer;
    font-size: 16px;
    transition: border-color 0.2s;
}

.product-selected:hover {
    border-color: var(--primary-color);
}

.product-list {
    position: absolute;
    top: calc(100% + 6px);
    left: 0;
    right: 0;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(20px);
    border: 1px solid rgba(0, 0, 0, 0.08);
    border-radius: 16px;
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.1);
    max-height: 320px;
    overflow-y: auto;
    z-index: 100;
    display: none;
    padding: 6px;
}

.product-list.open {
    display: block;
}

.product-card {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 10px;
    border-radius: 10px;
    cursor: pointer;
    transition: background 0.15s;
}

.product-card:hover {
    background: rgba(0, 113, 227, 0.06);
}

.product-card.selected {
    background: rgba(0, 113, 227, 0.1);
}

.product-card-icon {
    width: 36px;
    height: 36px;
    border-radius: 8px;
    flex-shrink: 0;
    background: var(--primary-gradient);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    font-weight: 700;
}

.product-card img {
    width: 36px;
    height: 36px;
    border-radius: 8px;
    object-fit: cover;
    flex-shrink: 0;
}

.product-card-name {
    font-size: 14px;
    font-weight: 500;
    color: var(--text-main);
}

/* product selected state */
.product-selected.has-value {
    padding: 12px 14px;
    gap: 12px;
}

.ps-icon {
    width: 48px;
    height: 48px;
    border-radius: 10px;
    flex-shrink: 0;
    background: var(--primary-gradient);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    font-weight: 700;
}

.product-selected img {
    width: 48px;
    height: 48px;
    border-radius: 10px;
    object-fit: cover;
    flex-shrink: 0;
}

.ps-info {
    flex: 1;
    min-width: 0;
}

.ps-name {
    font-size: 15px;
    font-weight: 600;
    color: var(--text-main);
}

.ps-desc {
    font-size: 12px;
    color: var(--text-secondary);
    margin-top: 2px;
    white-space: normal;
    word-break: break-word;
    line-height: 1.5;
}