:root {
    --brand-red: #e1251b;
    --brand-red-dark: #c8161d;
    --brand-orange: #ff6a00;
    --page-bg: #f5f5f5;
    --card-bg: #ffffff;
    --text-main: #222222;
    --text-sub: #888888;
    --text-weak: #999999;
    --tabbar-h: 52px;
    --max-w: 480px;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html, body {
    min-height: 100%;
    overflow-y: auto;
}

body {
    font-family: 'Noto Sans SC', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--page-bg);
    color: var(--text-main);
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    max-width: var(--max-w);
    margin: 0 auto;
}

button {
    font-family: inherit;
    cursor: pointer;
}

[hidden] {
    display: none !important;
}

.page {
    min-height: 100%;
    padding-bottom: calc(var(--tabbar-h) + 12px);
}

body.coupon-mode .page {
    padding-bottom: 12px;
}

body.h5-pending .page,
body.h5-pending .tabbar {
    visibility: hidden;
}

body.order-only .page {
    padding-bottom: 12px;
}

/* ===== 线报头 ===== */
.feed-header {
    background: var(--brand-red);
    padding: 10px 12px 8px;
    color: #fff;
}

.feed-header-top {
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    height: 32px;
    margin-bottom: 10px;
}

.brand-logo {
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    font-size: 13px;
    font-weight: 700;
    letter-spacing: 0.5px;
    padding: 2px 8px;
    border: 1px solid rgba(255, 255, 255, 0.85);
    border-radius: 4px;
}

.feed-page-title {
    font-size: 17px;
    font-weight: 700;
}

.feed-search-bar {
    display: flex;
    align-items: center;
    background: #fff;
    border-radius: 999px;
    padding: 4px 4px 4px 14px;
    margin-bottom: 10px;
}

.feed-search-bar input {
    flex: 1;
    border: none;
    outline: none;
    font-size: 14px;
    color: var(--text-main);
    background: transparent;
    height: 32px;
    min-width: 0;
}

.feed-search-bar input::placeholder {
    color: #bbb;
}

.feed-search-btn {
    width: 34px;
    height: 34px;
    border: none;
    border-radius: 50%;
    background: var(--brand-orange);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.cat-scroll {
    display: flex;
    gap: 18px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    padding: 4px 2px 8px;
    scrollbar-width: none;
}

.cat-scroll::-webkit-scrollbar {
    display: none;
}

.cat-item {
    flex-shrink: 0;
    border: none;
    background: transparent;
    color: rgba(255, 255, 255, 0.85);
    font-size: 15px;
    padding: 6px 0 8px;
    position: relative;
}

.cat-item.active {
    color: #fff;
    font-weight: 700;
}

.cat-item.active::after {
    content: "";
    position: absolute;
    left: 50%;
    bottom: 0;
    width: 22px;
    height: 3px;
    background: #fff;
    border-radius: 2px;
    transform: translateX(-50%);
}

.sort-bar {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    background: var(--brand-red);
}

.sort-pill {
    border: none;
    background: rgba(255, 255, 255, 0.2);
    color: #fff;
    font-size: 13px;
    padding: 4px 14px;
    border-radius: 999px;
}

.sort-pill.active {
    background: #fff;
    color: var(--brand-red);
    font-weight: 700;
}

.alert-bar {
    margin: 0;
    padding: 8px 12px;
    background: #fff4e8;
    color: #e65c00;
    font-size: 12px;
    border-bottom: 1px solid #ffd8b0;
}

.feed-list {
    padding: 10px 10px 0;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.deal-card {
    background: var(--card-bg);
    border-radius: 10px;
    padding: 12px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
    overflow: visible;
}

.deal-card-head {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    margin-bottom: 10px;
}

.deal-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--brand-red);
    color: #fff;
    font-size: 10px;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.deal-meta {
    flex: 1;
    min-width: 0;
}

.deal-author {
    font-size: 15px;
    font-weight: 700;
}

.deal-time {
    font-size: 12px;
    color: var(--text-sub);
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
}

.deal-sales {
    color: var(--brand-orange);
    font-weight: 600;
}

.coupon-entry-btn {
    border: none;
    background: var(--brand-orange);
    color: #fff;
    font-size: 13px;
    padding: 6px 12px;
    border-radius: 999px;
    flex-shrink: 0;
}

.deal-content {
    font-size: 14px;
    color: var(--text-main);
    white-space: pre-line;
    word-break: break-word;
    overflow-wrap: anywhere;
    line-height: 1.45;
    height: auto;
    max-height: none;
    overflow: visible;
    display: block;
}

.deal-link {
    color: #1677ff;
    text-decoration: none;
    word-break: break-all;
}

.deal-cashback {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px solid #f3f3f3;
    color: var(--text-sub);
    font-size: 14px;
    font-weight: 500;
    line-height: 1;
}

.deal-cashback strong {
    color: var(--brand-red);
    font-size: 16px;
    font-weight: 700;
    line-height: 1;
}

.empty-state {
    text-align: center;
    color: var(--text-weak);
    padding: 64px 16px;
    font-size: 15px;
}

.load-more {
    text-align: center;
    color: var(--text-weak);
    font-size: 13px;
    padding: 12px 0 4px;
}

/* ===== 查单 ===== */
.page-order {
    background: #fff;
}

.order-header {
    background: var(--brand-red);
    padding: 16px 16px 20px;
}

.order-page-title {
    color: #fff;
    font-size: 20px;
    font-weight: 700;
    text-align: center;
    margin-bottom: 14px;
    letter-spacing: 1px;
}

.order-search-bar {
    display: flex;
    align-items: center;
    background: #fff;
    border-radius: 999px;
    padding: 4px 4px 4px 16px;
}

.order-search-bar input {
    flex: 1;
    border: none;
    outline: none;
    height: 38px;
    font-size: 14px;
    min-width: 0;
    background: transparent;
    color: var(--text-main);
}

.order-search-bar input::placeholder {
    color: #bbb;
}

.clear-btn {
    border: none;
    background: transparent;
    color: #999;
    font-size: 16px;
    padding: 0 8px;
    height: 38px;
}

.order-search-btn {
    width: 40px;
    height: 40px;
    border: none;
    border-radius: 50%;
    background: #ff8a3d;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    padding: 0;
}

.order-body {
    padding: 16px 12px 12px;
    background: #fff;
}

.order-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.order-list:not(:empty) {
    margin-bottom: 12px;
}

.order-card {
    background: var(--card-bg);
    border-radius: 10px;
    overflow: hidden;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
}

.order-card-header {
    padding: 10px 12px;
    border-bottom: 1px solid #f0f0f0;
    display: flex;
    justify-content: space-between;
    gap: 8px;
}

.order-id-info {
    font-size: 13px;
    color: var(--text-sub);
    line-height: 1.45;
}

.order-meta-right {
    font-size: 13px;
    color: var(--text-sub);
    text-align: right;
}

.order-card-body {
    display: flex;
    gap: 12px;
    padding: 10px 12px;
}

.order-goods-img {
    width: 80px;
    height: 80px;
    border-radius: 8px;
    object-fit: cover;
    background: #f3f3f3;
    flex-shrink: 0;
}

.order-goods-info {
    flex: 1;
    min-width: 0;
}

.order-goods-name {
    font-size: 14px;
    font-weight: 500;
    line-height: 1.4;
    word-break: break-word;
    margin-bottom: 4px;
}

.order-meta {
    font-size: 13px;
    color: var(--text-sub);
}

.status-text {
    font-size: 14px;
    font-weight: 500;
}

.status-invalid { color: #bbb; }
.status-pending { color: #03aaf0; }
.status-finish { color: #798dee; }
.status-paid { color: var(--brand-red); }

.register-card {
    background: #fff;
    border: 1px dashed #cfcfcf;
    border-radius: 14px;
    padding: 22px 16px 10px;
}

.register-title {
    text-align: center;
    font-size: 18px;
    font-weight: 700;
    color: #222;
    margin-bottom: 18px;
}

.register-list {
    margin: 0;
    padding-left: 1.4em;
}

.register-list li {
    font-size: 14px;
    line-height: 1.7;
    color: #333;
    margin-bottom: 14px;
}

/* ===== 查券 ===== */
.page-coupon {
    background: linear-gradient(180deg, var(--brand-red) 0 120px, var(--page-bg) 120px);
    min-height: 100%;
}

.coupon-header {
    display: flex;
    align-items: center;
    height: 44px;
    padding: 0 4px;
    color: #fff;
}

.coupon-back {
    border: none;
    background: transparent;
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.coupon-header-title {
    font-size: 16px;
    font-weight: 600;
}

.coupon-main {
    padding: 8px 12px 24px;
}

.coupon-card,
.tutorial-card {
    background: #fff;
    border-radius: 14px;
    padding: 16px 14px 18px;
    margin-bottom: 12px;
}

.coupon-title {
    font-size: 18px;
    font-weight: 700;
    margin-bottom: 12px;
}

.coupon-input-box {
    position: relative;
    background: #f7f7f7;
    border-radius: 10px;
    padding: 10px 10px 36px;
}

.coupon-input-box textarea {
    width: 100%;
    border: none;
    outline: none;
    resize: none;
    background: transparent;
    font-size: 14px;
    font-family: inherit;
    color: var(--text-main);
    line-height: 1.6;
}

.coupon-input-actions {
    position: absolute;
    right: 10px;
    bottom: 8px;
    display: flex;
    gap: 14px;
}

.coupon-input-actions button {
    border: none;
    background: transparent;
    color: #aaa;
    font-size: 13px;
}

.coupon-hint {
    font-size: 12px;
    color: var(--text-weak);
    margin: 12px 0 16px;
    line-height: 1.6;
}

.coupon-submit {
    display: block;
    width: 70%;
    margin: 0 auto;
    border: none;
    background: var(--brand-red);
    color: #fff;
    font-size: 16px;
    font-weight: 600;
    padding: 12px 16px;
    border-radius: 999px;
}

.coupon-result-list {
    margin-bottom: 12px;
}

.coupon-empty {
    background: #fff;
    border-radius: 14px;
    padding: 28px 16px;
    text-align: center;
    color: var(--text-weak);
    font-size: 14px;
    margin-bottom: 12px;
}

.convert-card {
    background: #fff;
    border-radius: 14px;
    padding: 14px;
    margin-bottom: 12px;
}

.convert-body {
    display: flex;
    gap: 10px;
    margin-bottom: 14px;
}

.convert-img {
    width: 88px;
    height: 88px;
    border-radius: 8px;
    object-fit: cover;
    background: #f3f3f3;
    flex-shrink: 0;
}

.convert-info {
    flex: 1;
    min-width: 0;
}

.convert-name {
    font-size: 15px;
    font-weight: 700;
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    margin-bottom: 8px;
}

.convert-subsidy {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    color: var(--text-sub);
    line-height: 1;
}

.convert-subsidy strong {
    color: var(--brand-red);
    font-size: 18px;
    font-weight: 700;
    line-height: 1;
}

.convert-actions {
    display: flex;
    gap: 10px;
}

.convert-actions button {
    flex: 1;
    border: none;
    color: #fff;
    font-size: 14px;
    font-weight: 600;
    padding: 10px 8px;
    border-radius: 999px;
}

.convert-copy {
    background: var(--brand-red);
}

.tutorial-title {
    text-align: center;
    font-size: 16px;
    margin-bottom: 14px;
}

.tutorial-img {
    display: block;
    width: 100%;
    height: auto;
}

/* ===== 底栏 ===== */
.tabbar {
    position: fixed;
    left: 50%;
    bottom: 0;
    transform: translateX(-50%);
    width: 100%;
    max-width: var(--max-w);
    height: var(--tabbar-h);
    background: #fff;
    display: flex;
    border-top: 1px solid #eee;
    z-index: 100;
}

body.coupon-mode .tabbar,
body.order-only .tabbar {
    display: none;
}

.tab-item {
    flex: 1;
    border: none;
    background: transparent;
    color: #999;
    font-size: 11px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
}

.tab-item .tab-icon {
    width: 22px;
    height: 22px;
    fill: currentColor;
}

.tab-item.active {
    color: var(--brand-red);
}

/* ===== Loading / Popup / Toast ===== */
.global-loading {
    position: fixed;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
}

.loading-box {
    background: rgba(0, 0, 0, 0.7);
    border-radius: 12px;
    padding: 24px 32px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    min-width: 120px;
}

.loading-spinner {
    width: 36px;
    height: 36px;
    border: 3px solid rgba(255, 255, 255, 0.2);
    border-top-color: #fff;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

.loading-text {
    color: #fff;
    font-size: 15px;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.popup-mask {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
}

.popup-card {
    background: #fff;
    border-radius: 12px;
    width: 80%;
    max-width: 320px;
    overflow: hidden;
}

.popup-title {
    font-size: 18px;
    font-weight: 500;
    text-align: center;
    padding: 20px 16px 8px;
}

.popup-content {
    font-size: 15px;
    color: #999;
    text-align: center;
    padding: 8px 16px 20px;
    word-break: break-all;
}

.popup-divider {
    height: 1px;
    background: #eee;
}

.popup-btn {
    width: 100%;
    border: none;
    background: transparent;
    color: var(--brand-red);
    font-size: 17px;
    padding: 14px;
}

.toast {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(0, 0, 0, 0.75);
    color: #fff;
    padding: 12px 24px;
    border-radius: 8px;
    font-size: 14px;
    z-index: 10001;
    max-width: 80%;
    text-align: center;
}
