* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: rgba(0, 0, 0, 0);
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
    background: linear-gradient(135deg, #f5f7fa 0%, #e4eaf5 100%);
    padding: 16px;
    display: flex;
    flex-direction: column;
    align-items: center;
    min-height: 100vh;
    line-height: 1.4;
    /* 优化渲染性能 */
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeSpeed;
}

/* 全局提示组件 - 仅保留toast */
.toast {
    position: fixed;
    top: 20px;
    left: 50%;
    transform: translate(-50%, 0) scale(0.9);
    padding: 16px 24px;
    border-radius: 12px;
    font-size: 15px;
    font-weight: 500;
    color: #fff;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
    opacity: 0;
    pointer-events: none;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 9999;
    text-align: center;
    max-width: 85%;
    /* 优化渲染层级 */
    transform: translateZ(0) translate(-50%, 0) scale(0.9);
    will-change: opacity, transform;
}

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

.toast.meituan-copy {
    background: #34c759;
}

.toast.taobao-copy {
    background: #ff4500;
}

.toast.wechat-copy {
    background: #ff9800;
}

.toast.jump {
    background: #0a84ff;
}

.toast.ticket-copy {
    background: #7b61ff;
}

.toast.jd-copy {
    background: #e1251b;
}

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

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

@keyframes color-cycle {
    0% {
        background-color: #0a84ff;
    }

    20% {
        background-color: #ff3b30;
    }

    40% {
        background-color: #34c759;
    }

    60% {
        background-color: #ff9500;
    }

    80% {
        background-color: #e1251b;
    }

    100% {
        background-color: #0a84ff;
    }
}

@keyframes text-gradient-animation {
    0% {
        background-position: 0% 50%;
    }

    50% {
        background-position: 100% 50%;
    }

    100% {
        background-position: 0% 50%;
    }
}

/* 主容器 */
.main-container {
    background: #fff;
    padding: 24px;
    border-radius: 20px;
    width: 100%;
    max-width: 520px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.06);
    display: flex;
    flex-direction: column;
    gap: 16px;
}

/* 头部区域 */
.header {
    text-align: center;
    position: relative;
}

.header h2 {
    font-size: 22px;
    font-weight: 700;
    color: #333;
    margin-bottom: 8px;
    letter-spacing: 0.5px;
}

.header .sub-title {
    font-size: 14px;
    color: #6c04f0;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}

.header .sub-title::before,
.header .sub-title::after {
    content: "";
    width: 24px;
    height: 1px;
    background: #eee;
}

/* 店铺链接解析区 */
.link-parser {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.link-parser input {
    width: 100%;
    padding: 15px 18px;
    font-size: 16px;
    border-radius: 12px;
    border: 1px solid #e5e7eb;
    background: #f9fafb;
    color: #333;
    transition: all 0.3s ease;
}

.link-parser input:focus {
    outline: none;
    border-color: #0a84ff;
    box-shadow: 0 0 0 3px rgba(10, 132, 255, 0.1);
    background: #fff;
}

.link-parser input::placeholder {
    color: #9ca3af;
}

/* 按钮样式统一 */
.btn-group {
    display: flex;
    gap: 10px;
}

.btn {
    flex: 1;
    padding: 14px;
    font-size: 15px;
    border: none;
    border-radius: 12px;
    cursor: pointer;
    font-weight: 500;
    transition: transform 0.2s ease, opacity 0.2s ease, box-shadow 0.2s ease;
    color: #fff;
    text-align: center;
    letter-spacing: 0.3px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    /* 性能优化 */
    transform: translateZ(0);
    will-change: transform, opacity, box-shadow;
    -webkit-user-select: none;
    user-select: none;
}

.btn-paste {
    background: #5ac8fa;
}

.btn-go {
    background: #0a84ff;
}

.btn-clear {
    background: #ff3b30;
}

.btn-home {
    background: #34c759;
    width: 100%;
}

.btn-direct {
    background: #5ac8fa;
}

.btn-code {
    background: #0a84ff;
}

.btn-copy {
    background: #34c759;
}

.btn-didi {
    background: #ff453a;
}

.btn-t3 {
    background: #ff9f0a;
}

.btn-hxz {
    background: #0a84ff;
}

.btn-tc {
    background: #34c759;
}

.btn-flow {
    background: linear-gradient(90deg, #5ac8fa 0%, #0a84ff 100%);
    width: 100%;
}

.btn-meituan-flight {
    background: #0066b2;
}

.btn-meituan-train {
    background: #108ee9;
}

.btn-jd {
    background: #e1251b;
}

.btn:hover {
    opacity: 0.95;
    transform: translateZ(0) translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
    will-change: transform, box-shadow;
}

.btn:active {
    transform: translateZ(0) translateY(0);
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.06);
    filter: brightness(0.9);
}

.btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: translateZ(0);
    box-shadow: none;
    will-change: auto;
}

.input-note {
    font-size: 13px;
    color: #888;
    text-align: center;
    margin-top: 4px;
}

/* 折叠面板核心样式 */
.coupon-modules {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.coupon-panel {
    /* 为面板容器添加性能优化 */
    contain: layout style;
    transform: translateZ(0);
    /* 创建新的复合层 */
    /* 减少重绘范围 */
    isolation: isolate;
}

.coupon-panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    background: #f9fafb;
    border-radius: 12px;
    cursor: pointer;
    transition: background-color 0.15s cubic-bezier(0.4, 0, 0.2, 1),
        transform 0.1s cubic-bezier(0.4, 0, 0.2, 1);
    border: 1px solid #f3f4f6;
    will-change: background-color;
    /* 避免layout thrashing */
    transform: translateZ(0);
}

.coupon-panel-header:hover {
    background: #f3f4f6;
    transform: translateZ(0) translateY(-0.5px);
}

.coupon-panel-header:active {
    transform: translateZ(0) translateY(0);
    transition: transform 0.05s cubic-bezier(0.4, 0, 0.2, 1);
}

.coupon-panel-title {
    font-size: 16px;
    font-weight: 600;
    color: #333;
    display: flex;
    align-items: center;
    gap: 8px;
}

.coupon-panel-title::before {
    content: "";
    width: 4px;
    height: 16px;
    background: #0a84ff;
}

[data-target="all-coupons-content"] .coupon-panel-title {
    background: linear-gradient(90deg, #0a84ff, #ff3b30, #34c759, #ff9500, #e1251b, #0a84ff);
    background-size: 200% 200%;
    color: transparent;
    -webkit-background-clip: text;
    background-clip: text;
    animation: text-gradient-animation 5s ease infinite;
}

[data-target="all-coupons-content"] .coupon-panel-title::before {
    animation: color-cycle 5s infinite;
}


#jd-content-header .coupon-panel-title::before {
    background: #e1251b;
}

.panel-icon {
    font-size: 18px;
    color: #666;
    transition: transform 0.2s cubic-bezier(0.25, 0.46, 0.45, 0.94),
        color 0.15s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    will-change: transform, color;
    /* 使用transform3d优化 */
    transform: rotate3d(0, 0, 1, 0deg);
}

.panel-icon.expanded {
    transform: rotate3d(0, 0, 1, 180deg);
    color: #0a84ff;
}


#jd-content-header .panel-icon.expanded {
    color: #e1251b;
}

.coupon-panel-content {
    overflow: hidden;
    max-height: 0;
    opacity: 0;
    transform: translateY(-8px);
    transition: max-height 0.4s cubic-bezier(0.68, -0.55, 0.27, 1.55),
        opacity 0.2s cubic-bezier(0.25, 0.46, 0.45, 0.94) 0.05s,
        transform 0.3s cubic-bezier(0.68, -0.55, 0.27, 1.55);
    padding: 0 16px;
    will-change: max-height, opacity, transform;
    /* 使用transform3d来启用硬件加速 */
    transform: translate3d(0, -8px, 0);
}

.coupon-panel-content.expanded {
    max-height: 8000px;
    opacity: 1;
    transform: translate3d(0, 0, 0);
    padding: 16px;
    background: #fcfcfc;
    border-radius: 0 0 12px 12px;
    margin-top: -8px;
    border: 1px solid #f3f4f6;
    border-top: none;
    transition: max-height 0.35s cubic-bezier(0.25, 0.46, 0.45, 0.94),
        opacity 0.25s cubic-bezier(0.25, 0.46, 0.45, 0.94),
        transform 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

/* 优惠券卡片样式 */
.coupon-card {
    padding: 20px;
    border-radius: 16px;
    background: #fff;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.04);
    border: 1px solid #f3f4f6;
    position: relative;
    overflow: hidden;
    transition: all 0.3s ease;
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-bottom: 16px;
    /* 性能优化 */
    contain: layout style;
    transform: translateZ(0);
    will-change: transform, box-shadow;
}


.jd-card::before {
    background: #e1251b;
}

.coupon-card:last-child {
    margin-bottom: 4px;
}

.coupon-card:hover {
    transform: translateZ(0) translateY(-3px);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.06);
    will-change: transform, box-shadow;
}

.coupon-card::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 4px;
    background: linear-gradient(90deg, #5ac8fa 0%, #0a84ff 100%);
}

.coupon-title {
    font-weight: 600;
    font-size: 16px;
    color: #333;
    display: flex;
    align-items: center;
    gap: 6px;
}

.coupon-title::before {
    content: "🎫";
    font-size: 18px;
}

.coupon-text {
    width: 100%;
    padding: 14px 16px;
    border-radius: 10px;
    border: 1px solid #e5e7eb;
    background: #f9fafb;
    word-break: break-all;
    font-size: 14px;
    color: #444;
    min-height: 50px;
    transition: all 0.3s ease;
}

.coupon-text:focus {
    outline: none;
    border-color: #0a84ff;
    box-shadow: 0 0 0 3px rgba(10, 132, 255, 0.1);
    background: #fff;
}


.jd-card .coupon-text:focus {
    border-color: #e1251b;
    box-shadow: 0 0 0 3px rgba(225, 37, 27, 0.1);
}

.note {
    font-size: 12px;
    color: #999;
    text-align: center;
    line-height: 1.5;
}

/* 各服务模块样式 */
.service-group {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 8px;
}

.service-group .btn {
    flex: 1;
    min-width: calc(50% - 5px);
    padding: 13px;
    font-size: 14px;
}

/* 响应式适配 */
@media (max-width: 375px) {
    .main-container {
        padding: 20px 16px;
    }

    .btn-group {
        gap: 8px;
    }

    .btn {
        padding: 13px 8px;
        font-size: 14px;
    }

    .coupon-card {
        padding: 16px;
    }

    .service-group .btn {
        min-width: calc(50% - 4px);
        font-size: 13px;
    }

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

    .coupon-panel-title {
        font-size: 15px;
    }
}

/* 减少动画以提高低性能设备表现 */
@media (prefers-reduced-motion: reduce) {

    .coupon-panel-content,
    .panel-icon,
    .coupon-panel-header {
        transition: none !important;
    }

    .panel-icon.expanded {
        transform: rotate3d(0, 0, 1, 180deg);
    }
}

/* 针对低端设备的性能优化 */
@media (max-width: 480px) {
    .coupon-panel-content {
        transition-duration: 0.15s, 0.1s, 0.1s;
    }

    .panel-icon {
        transition-duration: 0.15s, 0.1s;
    }

    .coupon-panel-header {
        transition-duration: 0.1s, 0.05s;
    }
}

/* 新增：二维码弹窗样式 */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.modal-overlay.show {
    display: flex;
    opacity: 1;
}

.modal-content {
    background: #fff;
    padding: 30px;
    border-radius: 20px;
    text-align: center;
    position: relative;
    transform: scale(0.95);
    transition: transform 0.3s ease;
}

.modal-overlay.show .modal-content {
    transform: scale(1);
}

#qrcode {
    width: 220px !important;
    height: 220px !important;
    margin: 0 auto 20px;
    padding: 10px;
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.modal-content p {
    font-size: 15px;
    color: #333;
    font-weight: 500;
}

.close-button {
    position: absolute;
    top: -10px;
    right: -10px;
    width: 30px;
    height: 30px;
    background: #fff;
    border-radius: 50%;
    border: none;
    font-size: 20px;
    line-height: 30px;
    text-align: center;
    cursor: pointer;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.15);
    color: #888;
}