/* 全局样式重置 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

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

body {
    font-family: Arial, sans-serif;
    min-height: 100vh;
    min-height: 100dvh;
    background-color: #f4f4f4;
    -webkit-text-size-adjust: 100%;
    text-size-adjust: 100%;
}

/* 顶部蓝色条样式 */
.header {
    background-color: #007bff;
    padding: 14px 16px 44px;
    text-align: center;
}

.header img {
    max-width: 120px;
    height: auto;
}

body.qr-mode .header {
    background-color: #fff;
    padding: 14px 16px 44px;
}

/* 主体内容样式 */
.main-content {
    background-color: white;
    padding: 20px 18px 24px;
    margin: 0 16px 20px;
    margin-top: -32px;
    border-radius: 10px;
    box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
    display: block;
    max-width: 100%;
    overflow: hidden;
}

.main-content > * {
    width: 100%;
}

.deep-link p {
    text-align: center;
    margin-bottom: 0;
    font-size: 14px;
    line-height: 1.45;
    color: #333;
}

.expire-countdown {
    text-align: center;
    margin-top: 4px;
}

.expire-countdown p {
    margin-bottom: 0;
    font-size: 14px;
    color: #666;
    line-height: 1.45;
}

.expire-countdown #expire-time {
    font-weight: 700;
    color: #007bff;
    font-variant-numeric: tabular-nums;
}

.expire-countdown.urgent #expire-time {
    color: #ff6b35;
}

.expire-countdown.expired #expire-time {
    color: #d81e06;
}

.order-info {
    text-align: center;
    margin-bottom: 12px;
    display: block;
    width: 100%;
    clear: both;
}

.order-info .section-label {
    font-size: 14px;
    color: #666;
    margin-bottom: 4px;
}

.order-info .transaction-id {
    font-size: 13px;
    color: #999;
    word-break: break-all;
    line-height: 1.35;
    text-align: left;
}

.transaction-row {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin-bottom: 8px;
    max-width: 100%;
}

.copy-btn {
    flex-shrink: 0;
    padding: 4px 10px;
    font-size: 12px;
    color: #007bff;
    background: #eef5ff;
    border: 1px solid #b8d4ff;
    border-radius: 4px;
    cursor: pointer;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
}

.copy-btn:active {
    background: #dbeaff;
}

.order-info .amount {
    font-size: 26px;
    font-weight: 700;
    color: #333;
    margin-bottom: 8px;
    line-height: 1.2;
}

.order-info .scan-hint {
    font-size: 14px;
    color: #666;
    margin-bottom: 0;
    line-height: 1.45;
}

/* 打开应用按钮样式 */
.open-button {
    display: block;
    margin: 8px auto 0;
    padding: 12px 24px;
    background-color: #007bff;
    color: white;
    border: none;
    border-radius: 5px;
    font-size: 16px;
    cursor: pointer;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
}

.open-button:disabled {
    background-color: gray;
}

/* 二维码样式 */
.qr-code {
    position: relative;
    width: 200px;
    height: 200px;
    max-width: 72vw;
    max-height: 72vw;
    margin: 0 auto 12px;
    border-radius: 8px;
    display: block;
    background-color: white;
    clear: both;
    text-align: center;
    overflow: hidden;
}

.qr-code .qr-loading-wrap {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 0 8px;
    justify-content: center;
}

.qr-loading-wrap .extra {
    font-size: 14px;
    margin-top: 8px;
    text-align: center;
    line-height: 1.4;
}

.qr-loading span {
    display: inline-block;
    vertical-align: middle;
    width: 8px;
    height: 8px;
    margin: 3px;
    background: #3199FF;
    border-radius: 50%;
    -webkit-animation: loading 2s infinite alternate;
    animation: loading 2s infinite alternate;
}

.qr-code img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    display: none;
}

.qr-code img.is-visible {
    display: block;
    margin: 0 auto;
}

.qr-code .qr-success {
    position: absolute;
    inset: 0;
    backdrop-filter: blur(10px) brightness(0.9);
    -webkit-backdrop-filter: blur(10px) brightness(0.9);
    background-color: rgba(255, 255, 255, 0.5);
    z-index: 2;
    border-radius: 8px;
    align-items: center;
    display: none;
}

.qr-success .qr-success-hits {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    font-size: 18px;
    color: #2557E5;
    font-weight: 600;
    gap: 4px;
    padding: 8px;
    text-align: center;
}

.order-expired {
    text-align: center;
    padding: 32px 20px;
    background: linear-gradient(180deg, #fff8f8 0%, #fff 100%);
    border: 1px solid #ffe0e0;
    border-radius: 12px;
}

.order-expired .expired-icon {
    width: 72px;
    height: 72px;
    margin: 0 auto 16px;
    border-radius: 50%;
    background: #fff0f0;
    display: flex;
    align-items: center;
    justify-content: center;
}

.order-expired .expired-title {
    font-size: 20px;
    font-weight: 700;
    color: #d81e06;
    margin-bottom: 10px;
    line-height: 1.3;
}

.order-expired .expired-desc {
    font-size: 14px;
    color: #666;
    line-height: 1.55;
    max-width: 280px;
    margin: 0 auto;
}

.save-capture-area {
    width: 100%;
    max-width: 100%;
    display: none;
    overflow: hidden;
    clear: both;
}

.save-capture-area.is-active {
    display: block;
}

.order-info,
.capture-notes {
    width: 100%;
    max-width: 100%;
}

.capture-notes {
    width: 100%;
    text-align: center;
    padding: 0 4px;
    box-sizing: border-box;
}

.capture-notes .warning-text,
.capture-notes .save-hint {
    word-break: break-word;
    overflow-wrap: anywhere;
}

.capture-notes .warning-text {
    color: #ff6b35;
    font-size: 14px;
    margin-bottom: 4px;
    font-weight: 500;
    line-height: 1.4;
}

.capture-notes .save-hint {
    font-size: 13px;
    color: #666;
    margin-bottom: 0;
    line-height: 1.4;
}

.qr-actions {
    text-align: center;
    margin-top: 12px;
    width: 100%;
    clear: both;
}

.qr-actions .capture-notes {
    margin-bottom: 12px;
}

.in-app-browser .save-hint strong {
    color: #ff6b35;
}

body.save-preview-open {
    overflow: hidden;
    position: fixed;
    width: 100%;
    left: 0;
    right: 0;
}

.save-preview {
    position: fixed;
    inset: 0;
    z-index: 2147483000;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    padding: 16px;
    padding-bottom: max(16px, env(safe-area-inset-bottom, 0px));
    box-sizing: border-box;
    visibility: hidden;
    opacity: 0;
    pointer-events: none;
    -webkit-transform: translateZ(0);
    transform: translateZ(0);
}

.save-preview.is-visible {
    visibility: visible;
    opacity: 1;
    pointer-events: auto;
}

.save-preview-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.72);
}

.save-preview-panel {
    position: relative;
    z-index: 1;
    max-width: 360px;
    width: 100%;
    margin: 0 auto;
    max-height: min(90dvh, calc(100dvh - 32px));
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    padding: 16px;
    background: #fff;
    border-radius: 12px;
    text-align: center;
    box-sizing: border-box;
    box-shadow: 0 16px 48px rgba(0, 0, 0, 0.35);
}

.save-preview-title {
    font-size: 18px;
    font-weight: 700;
    margin: 0 0 10px;
    color: #1a1a1a;
}

.save-preview-tip {
    font-size: 15px;
    color: #333;
    line-height: 1.5;
    margin: 0 0 8px;
}

.save-preview-tip strong {
    color: #ff6b35;
}

.save-preview-subtip {
    font-size: 12px;
    color: #666;
    line-height: 1.4;
    margin: 0 0 12px;
}

.save-preview-panel img {
    width: 100%;
    height: auto;
    display: block;
    border-radius: 8px;
    background: #fff;
    -webkit-touch-callout: default;
}

.save-preview-close {
    margin-top: 12px;
    width: 100%;
    border: none;
    border-radius: 24px;
    padding: 12px 16px;
    font-size: 16px;
    font-weight: 600;
    color: #fff;
    background: #ff6b35;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
}

.save-btn {
    display: block;
    margin: 0 auto;
    background-color: #ff6b35;
    color: #fff;
    border: none;
    border-radius: 24px;
    padding: 12px 40px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    width: 100%;
    max-width: 280px;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
}

.save-btn:disabled {
    background-color: #ccc;
    cursor: not-allowed;
}

.save-status {
    margin-top: 8px;
    min-height: 18px;
    font-size: 13px;
    line-height: 1.4;
}

.save-status.success {
    color: #28a745;
}

.save-status.error {
    color: #d81e06;
}