:root {
    --primary: #6b8cae;
    --primary-dark: #5a7d9e;
    --primary-light: #a3c4e0;
    --accent: #e8836b;
    --bg-start: #e2e8f0;
    --bg-end: #d5d0e8;
    --glass-bg: rgba(255, 255, 255, 0.55);
    --glass-bg-hover: rgba(107, 140, 174, 0.08);
    --glass-border: rgba(0, 0, 0, 0.06);
    --glass-shadow: 0 4px 16px rgba(100, 110, 140, 0.08);
    --text-primary: #2d3748;
    --text-secondary: #5a6578;
    --text-muted: #8e99a8;
    --green: #68b88a;
    --amber: #d4a054;
    --coral: #e8836b;
    --radius: 14px;
    --radius-sm: 8px;
    --radius-xs: 6px;
    --font: 'Inter', 'Noto Sans SC', -apple-system, BlinkMacSystemFont, sans-serif;
    --transition: all 0.2s ease;
}

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

html {
    font-size: 16px;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    font-family: var(--font);
    color: var(--text-primary);
    min-height: 100vh;
    overflow-x: hidden;
    position: relative;
    background: linear-gradient(145deg, var(--bg-start) 0%, var(--bg-end) 50%, #c8d0e0 100%);
    background-attachment: fixed;
}

.container {
    position: relative;
    z-index: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 24px 16px;
}

.card {
    width: 100%;
    max-width: 420px;
    background: rgba(255, 255, 255, 0.7);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius);
    box-shadow: var(--glass-shadow);
    overflow: hidden;
    animation: cardEnter 0.5s cubic-bezier(0.16, 1, 0.3, 1) forwards;
    opacity: 0;
    transform: translateY(16px);
}

@keyframes cardEnter {
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.card-header {
    text-align: center;
    padding: 28px 24px 0;
}

.avatar-wrapper {
    margin-bottom: 12px;
}

.avatar {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid var(--glass-border);
}

.site-name {
    font-size: 1.4rem;
    font-weight: 700;
    letter-spacing: -0.01em;
    color: var(--text-primary);
    margin-bottom: 4px;
}

.site-desc {
    font-size: 0.85rem;
    color: var(--text-secondary);
    font-weight: 400;
    line-height: 1.5;
}

.announcement {
    margin-top: 10px;
    padding: 8px 14px;
    background: rgba(107, 140, 174, 0.08);
    border: 1px solid rgba(107, 140, 174, 0.12);
    border-radius: var(--radius-sm);
    font-size: 0.8rem;
    color: var(--blue);
    text-align: left;
    line-height: 1.5;
}

.card-body {
    padding: 20px 24px 24px;
}

.preset-amounts {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 18px;
}

.preset-chip {
    padding: 6px 14px;
    background: rgba(255, 255, 255, 0.5);
    border: 1px solid rgba(0, 0, 0, 0.06);
    border-radius: 100px;
    color: var(--text-secondary);
    font-size: 0.82rem;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
    user-select: none;
}

.preset-chip:hover {
    background: rgba(107, 140, 174, 0.08);
    border-color: var(--primary-light);
    color: var(--text-primary);
}

.preset-chip.active {
    background: var(--primary);
    border-color: var(--primary);
    color: #fff;
    font-weight: 600;
}

.input-label {
    display: block;
    font-size: 0.76rem;
    font-weight: 500;
    color: var(--text-muted);
    margin-bottom: 5px;
    letter-spacing: 0.02em;
}

.custom-amount-group {
    margin-bottom: 14px;
}

.amount-input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.currency-symbol {
    position: absolute;
    left: 12px;
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--primary);
    pointer-events: none;
    z-index: 1;
}

.amount-input {
    width: 100%;
    padding: 11px 12px 11px 36px;
    background: rgba(255, 255, 255, 0.5);
    border: 1px solid rgba(0, 0, 0, 0.08);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-size: 1.3rem;
    font-weight: 600;
    font-family: var(--font);
    transition: var(--transition);
    outline: none;
    -moz-appearance: textfield;
}

.amount-input::-webkit-outer-spin-button,
.amount-input::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

.amount-input::placeholder {
    color: var(--text-muted);
    font-weight: 300;
}

.amount-input:focus {
    border-color: var(--primary);
    background: rgba(255, 255, 255, 0.7);
}

.description-group {
    margin-bottom: 14px;
}

.desc-input {
    width: 100%;
    padding: 9px 12px;
    background: rgba(255, 255, 255, 0.5);
    border: 1px solid rgba(0, 0, 0, 0.08);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-size: 0.88rem;
    font-family: var(--font);
    transition: var(--transition);
    outline: none;
}

.desc-input::placeholder {
    color: var(--text-muted);
}

.desc-input:focus {
    border-color: var(--primary);
    background: rgba(255, 255, 255, 0.7);
}

.method-group {
    margin-bottom: 20px;
}

.method-options {
    display: flex;
    gap: 8px;
}

.method-btn {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 9px 12px;
    background: rgba(255, 255, 255, 0.5);
    border: 1px solid rgba(0, 0, 0, 0.06);
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    font-size: 0.82rem;
    font-weight: 500;
    font-family: var(--font);
    cursor: pointer;
    transition: var(--transition);
    user-select: none;
}

.method-btn:hover {
    background: rgba(107, 140, 174, 0.08);
    border-color: var(--primary-light);
    color: var(--text-primary);
}

.method-btn.active {
    background: rgba(107, 140, 174, 0.15);
    border-color: var(--primary);
    color: var(--primary);
}

.method-btn i {
    font-size: 1rem;
}

.pay-btn {
    width: 100%;
    padding: 13px;
    background: var(--primary);
    border: none;
    border-radius: var(--radius-sm);
    color: #fff;
    font-size: 0.92rem;
    font-weight: 600;
    font-family: var(--font);
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.pay-btn:hover {
    background: var(--primary-dark);
    transform: translateY(-1px);
}

.pay-btn:active {
    transform: translateY(0);
}

.pay-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

.pay-btn i {
    font-size: 1rem;
    color: rgba(255, 255, 255, 0.9);
}

.result-card {
    animation: cardEnter 0.4s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

.result-header {
    text-align: center;
    padding: 24px 24px 0;
}

.result-icon {
    width: 44px;
    height: 44px;
    margin: 0 auto 10px;
    background: rgba(107, 140, 174, 0.1);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    color: var(--primary);
}

.result-header h2 {
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: 4px;
}

.result-amount {
    font-size: 1.8rem;
    font-weight: 700;
    color: var(--text-primary);
    letter-spacing: -0.02em;
}

.result-body {
    padding: 18px 24px 24px;
}

.qrcode-wrapper {
    display: flex;
    justify-content: center;
    margin-bottom: 12px;
    padding: 12px;
    background: #ffffff;
    border-radius: var(--radius-sm);
    width: fit-content;
    margin-left: auto;
    margin-right: auto;
}

#qrcodeContainer {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
}

.qrcode-wrapper.is-expired img {
    filter: grayscale(100%) blur(4px);
    opacity: 0.5;
}

.expired-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: expiredFadeIn 0.5s ease;
}

.expired-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    color: #e74c3c;
    font-weight: 700;
    font-size: 1.2rem;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
}

.expired-content i {
    font-size: 2rem;
    animation: expiredPulse 2s ease-in-out infinite;
}

.expired-content span {
    font-size: 1rem;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

@keyframes expiredFadeIn {
    from { opacity: 0; transform: scale(0.9); }
    to { opacity: 1; transform: scale(1); }
}

@keyframes expiredPulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.1); }
}

.qrcode-wrapper img {
    display: block;
    width: 180px;
    height: 180px;
    border-radius: 6px;
}

.qr-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: 180px;
    height: 180px;
    gap: 12px;
}

.qr-loading span {
    font-size: 0.78rem;
    color: var(--text-muted);
}

.qr-loading-spinner {
    width: 36px;
    height: 36px;
    border: 3px solid rgba(107, 140, 174, 0.15);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: qrSpin 0.8s linear infinite;
}

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

.result-tip {
    text-align: center;
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-bottom: 14px;
}

.result-info {
    background: rgba(0, 0, 0, 0.03);
    border: 1px solid rgba(0, 0, 0, 0.05);
    border-radius: var(--radius-sm);
    padding: 10px 14px;
    margin-bottom: 14px;
}

.info-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 4px 0;
}

.info-row + .info-row {
    border-top: 1px solid rgba(0, 0, 0, 0.05);
}

.info-label {
    font-size: 0.8rem;
    color: var(--text-muted);
}

.info-value {
    font-size: 0.82rem;
    color: var(--text-secondary);
    font-weight: 500;
}

.status-pending {
    color: var(--amber) !important;
}

.status-paid {
    color: var(--green) !important;
}

.status-expired {
    color: var(--text-muted) !important;
}

.result-actions {
    display: flex;
    gap: 8px;
}

.btn-secondary {
    flex: 1;
    padding: 9px 12px;
    background: rgba(255, 255, 255, 0.5);
    border: 1px solid rgba(0, 0, 0, 0.06);
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    font-size: 0.82rem;
    font-weight: 500;
    font-family: var(--font);
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
}

.btn-secondary:hover {
    background: rgba(107, 140, 174, 0.08);
    border-color: var(--primary-light);
    color: var(--text-primary);
}

.footer {
    margin-top: 18px;
    text-align: center;
    font-size: 0.76rem;
    color: var(--text-muted);
}

.brand {
    color: var(--primary);
    font-weight: 500;
}

.toast {
    position: fixed;
    top: 20px;
    left: 50%;
    transform: translateX(-50%) translateY(-60px);
    padding: 10px 18px;
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-size: 0.82rem;
    z-index: 9999;
    transition: transform 0.3s ease;
    box-shadow: var(--glass-shadow);
}

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

.toast.success {
    border-left: 3px solid var(--green);
}

.toast.error {
    border-left: 3px solid var(--coral);
}

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

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

.dot-animation::after {
    content: '';
    animation: dots 1.5s infinite;
}

@keyframes dots {
    0%, 20% { content: '.'; }
    40% { content: '..'; }
    60%, 100% { content: '...'; }
}

.success-card {
    animation: cardEnter 0.5s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

.success-content {
    padding: 40px 24px;
    text-align: center;
}

.success-icon-wrapper {
    margin-bottom: 20px;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
}

.success-icon-wrapper .avatar-wrapper {
    margin-bottom: 0;
    display: none;
}

.success-icon-wrapper .avatar {
    width: 72px;
    height: 72px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid var(--glass-border);
    animation: successPop 0.5s cubic-bezier(0.16, 1, 0.3, 1);
}

.success-icon {
    width: 72px;
    height: 72px;
    margin: 0 auto;
    background: linear-gradient(135deg, #68b88a 0%, #4a9d6e 100%);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
    color: #fff;
    animation: successPop 0.5s cubic-bezier(0.16, 1, 0.3, 1);
}

.success-icon-wrapper.has-avatar .avatar-wrapper {
    display: block;
}

.success-icon-wrapper.has-avatar .success-icon {
    display: none;
}

@keyframes successPop {
    0% { transform: scale(0); opacity: 0; }
    50% { transform: scale(1.2); }
    100% { transform: scale(1); opacity: 1; }
}

.success-title {
    font-size: 1.4rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 8px;
}

.success-amount {
    font-size: 2.2rem;
    font-weight: 700;
    color: #68b88a;
    letter-spacing: -0.02em;
    margin-bottom: 24px;
}

.success-info {
    background: rgba(0, 0, 0, 0.03);
    border: 1px solid rgba(0, 0, 0, 0.05);
    border-radius: var(--radius-sm);
    padding: 12px 16px;
    text-align: left;
}

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

    .card-header {
        padding: 22px 18px 0;
    }

    .card-body {
        padding: 18px;
    }

    .site-name {
        font-size: 1.2rem;
    }

    .amount-input {
        font-size: 1.1rem;
    }

    .preset-chip {
        padding: 5px 12px;
        font-size: 0.78rem;
    }
}
