:root {
    --primary: #3b82f6;
    --primary-hover: #2563eb;
    --primary-light: #dbeafe;
    --bg-body: #f1f5f9;
    --bg-white: #ffffff;
    --bg-gray: #f8fafc;
    --text-primary: #1e293b;
    --text-secondary: #64748b;
    --text-muted: #94a3b8;
    --border: #e2e8f0;
    --success: #10b981;
    --success-light: #d1fae5;
    --danger: #ef4444;
    --danger-light: #fee2e2;
    --purple: #8b5cf6;
    --purple-light: #ede9fe;
    --cyan: #06b6d4;
    --cyan-light: #cffafe;
    --orange: #f59e0b;
    --orange-light: #fef3c7;
    --pink: #ec4899;
    --pink-light: #fdf2f8;
    --shadow: 0 1px 3px rgba(0,0,0,0.1);
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Noto Sans SC', sans-serif;
    background: var(--bg-body);
    color: var(--text-primary);
    line-height: 1.6;
}

/* 顶部栏 */
.topbar {
    background: var(--bg-white);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 50;
    box-shadow: var(--shadow);
}

.topbar-inner {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 24px;
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

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

.brand-icon {
    width: 40px;
    height: 40px;
    background: linear-gradient(135deg, var(--primary), var(--cyan));
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 18px;
}

.brand-text h1 { font-size: 1.1rem; font-weight: 700; }
.brand-text .sub { font-size: 0.75rem; color: var(--text-muted); }

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

/* 状态徽章 */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 5px 12px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 500;
}

.badge.loading { background: var(--orange-light); color: var(--orange); }
.badge.success { background: var(--success-light); color: var(--success); }
.badge.error { background: var(--danger-light); color: var(--danger); }

.badge .dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: currentColor;
}

.badge.loading .dot { animation: pulse 1.5s infinite; }
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.3; } }

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

/* 主内容 */
.main {
    max-width: 1200px;
    margin: 0 auto;
    padding: 24px;
}

/* 双列行布局 */
.row-2col {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    margin-bottom: 40px;
}

.row-2col > .content-section {
    margin-bottom: 0;
    scroll-margin-top: 80px;
}

/* 内容区块 */
.content-section {
    margin-bottom: 40px;
    scroll-margin-top: 80px;
}

.section-title {
    font-size: 1.25rem;
    font-weight: 700;
    margin-bottom: 20px;
    padding-bottom: 12px;
    border-bottom: 2px solid var(--border);
    color: var(--primary);
    display: flex;
    align-items: center;
    gap: 10px;
    position: relative;
}
.section-title::after {
    content: '';
    position: absolute;
    bottom: -2px; left: 0;
    width: 60px; height: 2px;
    background: linear-gradient(90deg, var(--primary), var(--cyan));
    border-radius: 2px;
}

.sub-title {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text-primary);
    margin: 20px 0 12px;
    padding-left: 12px;
    border-left: 3px solid var(--primary);
    display: flex;
    align-items: center;
    gap: 8px;
}

.sub-title:first-child { margin-top: 0; }

/* 网格布局 */
.grid-2 { display: grid; grid-template-columns: repeat(2, 1fr); gap: 16px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.gunvan-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.grid-2 > .card, .grid-3 > .card, .gunvan-grid > .card { margin-bottom: 0; }

@media (max-width: 1000px) {
    .grid-3, .gunvan-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 768px) {
    .grid-2, .grid-3, .gunvan-grid { grid-template-columns: 1fr; }
    .row-2col { grid-template-columns: 1fr; }
}

/* 卡片 */
.card {
    background: var(--bg-white);
    border-radius: 10px;
    border: 1px solid var(--border);
    margin-bottom: 16px;
    box-shadow: var(--shadow);
    overflow: hidden;
}

.card:last-child { margin-bottom: 0; }

.card-header {
    padding: 12px 16px;
    background: linear-gradient(135deg, var(--bg-gray), var(--bg-white));
    border-bottom: 1px solid var(--border);
    border-left: 3px solid var(--primary);
    font-weight: 600;
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    gap: 8px;
}

.card-body { padding: 14px 16px; }

/* 列表项 */
.item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 14px;
    background: var(--bg-white);
    border-radius: 8px;
    margin-bottom: 6px;
    border: 1px solid var(--border);
    transition: all 0.2s;
    gap: 12px;
}

.item:last-child { margin-bottom: 0; }
.item:hover { border-color: var(--primary); box-shadow: 0 2px 8px rgba(59,130,246,0.1); transform: translateX(2px); }
.item-main { flex: 1; min-width: 0; }
.item-name { font-weight: 600; font-size: 0.9rem; display: flex; align-items: center; gap: 6px; }
.item-name::before { content: ''; width: 5px; height: 5px; border-radius: 50%; background: var(--primary); opacity: 0.5; flex-shrink: 0; }
.item-price { font-size: 0.8rem; color: var(--text-secondary); margin-top: 4px; }

.item-tags {
    display: grid;
    grid-template-columns: auto auto;
    gap: 4px;
    justify-content: end;
    flex-shrink: 0;
}
/* 奇数个 tag 时最后一个独占第二列（右对齐） */
.tag:last-child:nth-child(odd) {
    grid-column: 2;
}

/* 标签 */
.tag {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    padding: 3px 8px;
    border-radius: 4px;
    font-size: 0.7rem;
    font-weight: 600;
    white-space: nowrap;
    width: fit-content;
}

.tag-free { background: var(--success-light); color: var(--success); }
.tag-discount { background: var(--danger-light); color: var(--danger); }
.tag-return { background: var(--purple-light); color: var(--purple); }
.tag-special { background: var(--pink-light); color: var(--pink); }
.tag-info { background: var(--orange-light); color: var(--orange); }
.tag-bonus { background: var(--orange-light); color: var(--orange); }
.tag-day { background: var(--cyan-light); color: var(--cyan); }

/* 按钮 */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    border-radius: 8px;
    font-size: 0.85rem;
    font-weight: 500;
    cursor: pointer;
    border: none;
    transition: all 0.2s;
    background: var(--primary);
    color: white;
}

.btn:hover { background: var(--primary-hover); }
.btn-secondary { background: var(--bg-gray); color: var(--text-primary); border: 1px solid var(--border); }
.btn-secondary:hover { background: var(--border); }

/* 弹窗 */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 2000;
    padding: 20px;
}

.modal-overlay.active { display: flex; }

.modal {
    background: var(--bg-white);
    border-radius: 16px;
    width: 100%;
    max-width: 900px;
    max-height: 85vh;
    display: flex;
    flex-direction: column;
}

.modal-header {
    padding: 16px 20px;
    border-bottom: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: var(--bg-gray);
    border-radius: 16px 16px 0 0;
}

.modal-title {
    font-size: 1rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--primary);
}

.modal-actions { display: flex; gap: 8px; }
.modal-body { padding: 20px; overflow-y: auto; flex: 1; }

.modal-section {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--primary);
    margin: 16px 0 10px;
    padding-bottom: 6px;
    border-bottom: 1px solid var(--border);
}

.modal-section:first-child { margin-top: 0; }

.raw-data {
    background: var(--bg-gray);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 14px;
    max-height: 300px;
    overflow-y: auto;
    font-family: 'Monaco', 'Menlo', monospace;
    font-size: 0.8rem;
    line-height: 1.8;
}

.json-key { color: var(--primary); }
.json-value { color: var(--success); }

/* 页脚 */
.footer {
    text-align: center;
    padding: 24px;
    border-top: 1px solid var(--border);
    color: var(--text-muted);
    font-size: 0.85rem;
    background: var(--bg-white);
    border-radius: 10px;
    margin-top: 20px;
}

.footer a { color: var(--primary); text-decoration: none; }
.footer a:hover { text-decoration: underline; }

/* 评分 */
.rating-section {
    text-align: center;
    padding: 28px 24px;
    margin-top: 20px;
    background: var(--bg-white);
    border-radius: 10px;
    border: 1px solid var(--border);
    box-shadow: var(--shadow);
}

.rating-question {
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 18px;
}

.rating-buttons {
    display: flex;
    justify-content: center;
    gap: 24px;
}

.rating-btn {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 14px 32px;
    border-radius: 12px;
    border: 2px solid var(--border);
    background: var(--bg-gray);
    cursor: pointer;
    transition: all 0.2s;
    font-size: 1rem;
    color: var(--text-secondary);
    position: relative;
    overflow: hidden;
}

.rating-btn::after {
    content: '';
    position: absolute;
    inset: 0;
    background: currentColor;
    opacity: 0;
    transition: opacity 0.3s;
    pointer-events: none;
}

.rating-btn.clicked::after {
    animation: rating-pulse 0.4s ease-out;
}

@keyframes rating-pulse {
    0% { opacity: 0.3; }
    100% { opacity: 0; }
}

.like-btn:hover {
    border-color: var(--success);
    background: var(--success-light);
    color: var(--success);
}

.dislike-btn:hover {
    border-color: var(--danger);
    background: var(--danger-light);
    color: var(--danger);
}

.rating-count {
    font-weight: 800;
    font-size: 1.15rem;
    min-width: 20px;
    text-align: center;
}

.like-btn:hover .rating-count { color: var(--success); }
.dislike-btn:hover .rating-count { color: var(--danger); }

/* 移动端响应式 */
@media (max-width: 768px) {
    .main { padding: 16px; }

    .topbar-inner {
        height: auto;
        padding: 12px 16px;
        flex-wrap: wrap;
        gap: 8px;
    }

    .topbar-actions {
        flex-wrap: wrap;
        gap: 8px;
    }

    .item {
        flex-wrap: wrap;
    }

    .item-tags {
        grid-template-columns: auto auto;
        justify-content: end;
    }

    .rating-buttons { gap: 16px; }
    .rating-btn { padding: 12px 24px; }
    .rating-count { font-size: 1rem; }
}