:root {
    --brand: #2563eb;
    --brand-soft: #eff4ff;
    --ink: #1f2937;
    --muted: #6b7280;
    --line: #e5e7eb;
    --bg: #f4f6f9;
    --card: #ffffff;
    --ok: #047857;
    --warn: #b45309;
    --danger: #b42318;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

body {
    margin: 0;
    background: var(--bg);
    color: var(--ink);
    font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", sans-serif;
    font-size: 14px;
    padding-bottom: 76px;
}

button, input, select, textarea { font: inherit; color: inherit; }
a { color: inherit; text-decoration: none; }

.topbar {
    position: sticky;
    top: 0;
    z-index: 20;
    height: 56px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 16px;
    background: #fff;
    border-bottom: 1px solid var(--line);
}

.brand { display: flex; align-items: center; gap: 10px; min-width: 0; }
.mark {
    width: 34px; height: 34px; border-radius: 10px; flex: none;
    display: grid; place-items: center; color: #fff; font-weight: 800;
    background: linear-gradient(135deg, #60a5fa, var(--brand));
}
.brand strong { display: block; font-size: 15px; }
.brand span { color: var(--muted); font-size: 12px; }
.link-btn { color: var(--brand); font-size: 13px; }

#main { max-width: 760px; margin: 0 auto; padding: 12px 14px 24px; }

.card {
    background: var(--card);
    border-radius: 14px;
    padding: 16px;
    margin-bottom: 12px;
    box-shadow: 0 6px 18px rgba(15, 23, 42, 0.05);
}
.card h2 { margin: 0 0 6px; font-size: 17px; }
.card h3 { margin: 14px 0 8px; font-size: 15px; }
.muted { color: var(--muted); font-size: 12px; line-height: 1.6; }
.row { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.wrap { display: flex; flex-wrap: wrap; gap: 8px; }

.hero {
    position: relative;
    border-radius: 18px;
    overflow: hidden;
    color: #fff;
    padding: 22px 18px;
    margin-bottom: 12px;
    background: linear-gradient(140deg, #3b82f6, #1d4ed8 70%, #1e40af);
}
.hero h1 { margin: 0; font-size: 22px; }
.hero p { margin: 8px 0 0; opacity: 0.9; line-height: 1.6; }
.hero .search {
    margin-top: 14px; display: flex; gap: 8px;
}
.hero .search input { flex: 1; border: 0; border-radius: 10px; height: 40px; padding: 0 12px; }
.hero .search button { border: 0; border-radius: 10px; padding: 0 16px; background: #fff; color: var(--brand); font-weight: 700; }

.grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 8px; text-align: center; }
@media (max-width: 520px) { .grid { grid-template-columns: repeat(4, 1fr); } }
.grid button {
    border: 0; background: var(--brand-soft); color: var(--brand);
    border-radius: 12px; padding: 12px 4px; cursor: pointer; font-size: 12px; line-height: 1.5;
}

.tabs {
    position: fixed; left: 0; right: 0; bottom: 0; height: 60px;
    display: flex; background: #fff; border-top: 1px solid var(--line); z-index: 30;
}
.tabs button {
    flex: 1; border: 0; background: transparent; color: #8a94a6; cursor: pointer;
    display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; font-size: 12px;
}
.tabs button.on { color: var(--brand); font-weight: 700; }

.chips { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 4px; margin-bottom: 10px; }
.chips button {
    flex: none; border: 1px solid var(--line); background: #fff; color: var(--muted);
    border-radius: 999px; padding: 6px 14px; cursor: pointer;
}
.chips button.on { border-color: var(--brand); background: var(--brand-soft); color: var(--brand); font-weight: 600; }

.item {
    display: flex; gap: 12px; padding: 12px 0; border-bottom: 1px solid #f0f2f5; cursor: pointer;
}
.item:last-child { border-bottom: 0; }
.thumb {
    width: 76px; height: 76px; flex: none; border-radius: 10px; background: #f1f5f9;
    display: grid; place-items: center; color: #94a3b8; font-size: 12px; overflow: hidden;
}
.thumb img { width: 100%; height: 100%; object-fit: cover; }
.item .meta { min-width: 0; flex: 1; }
.item .meta strong { display: block; font-size: 15px; margin-bottom: 4px; }
.price { color: #dc2626; font-weight: 700; }
.price small { font-weight: 400; font-size: 12px; }

.btn {
    border: 0; border-radius: 20px; height: 38px; padding: 0 16px;
    background: var(--brand); color: #fff; font-weight: 600; cursor: pointer;
}
.btn.block { width: 100%; height: 44px; margin-top: 10px; }
.btn.ghost { background: #eff2f6; color: var(--ink); }
.btn.danger { background: #fef2f2; color: var(--danger); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.tag {
    display: inline-block; padding: 2px 8px; border-radius: 999px; font-size: 12px;
    background: var(--brand-soft); color: var(--brand);
}
.tag.ok { background: #ecfdf5; color: var(--ok); }
.tag.warn { background: #fffbeb; color: var(--warn); }
.tag.danger { background: #fef2f2; color: var(--danger); }

form .field { margin-bottom: 12px; }
form label { display: block; font-size: 12px; color: var(--muted); margin-bottom: 6px; }
form input, form select, form textarea {
    width: 100%; border: 1px solid var(--line); border-radius: 10px;
    background: #f8fafc; padding: 10px 12px;
}
form input:focus, form select:focus, form textarea:focus {
    outline: 2px solid #dbeafe; border-color: var(--brand); background: #fff;
}
textarea { min-height: 84px; resize: vertical; }

.sheet-mask {
    position: fixed; inset: 0; background: rgba(15, 23, 42, 0.45); z-index: 40;
    display: flex; align-items: flex-end;
}
.sheet {
    width: 100%; max-width: 760px; margin: 0 auto; background: #fff;
    border-radius: 18px 18px 0 0; padding: 18px 16px 26px; max-height: 88vh; overflow-y: auto;
}
.sheet h2 { margin: 0 0 10px; font-size: 18px; }
.toast {
    position: fixed; left: 50%; top: 76px; transform: translateX(-50%);
    background: rgba(17, 24, 39, 0.9); color: #fff; padding: 8px 16px;
    border-radius: 999px; font-size: 13px; z-index: 60; max-width: 80vw;
}
.toast.err { background: rgba(180, 35, 24, 0.94); }
.divider { height: 1px; background: #f0f2f5; margin: 12px 0; }
.log { padding: 8px 0; border-bottom: 1px dashed #eef0f3; }
.log:last-child { border-bottom: 0; }
.empty { text-align: center; color: var(--muted); padding: 26px 0; font-size: 13px; }
.quick-links { display: flex; gap: 10px; flex-wrap: wrap; }
.quick-links button {
    border: 1px solid var(--line); background: #fff; border-radius: 10px; padding: 8px 14px; cursor: pointer;
}
.stat { display: flex; gap: 18px; flex-wrap: wrap; margin: 6px 0 10px; }
.stat div { min-width: 90px; }
.stat strong { font-size: 20px; display: block; }
.stat span { color: var(--muted); font-size: 12px; }
.notice { padding: 8px 0; border-bottom: 1px dashed #eef0f3; cursor: pointer; }

/* 桌面端：内部保持 375 宽手机排版，整体等比放大由 portal.js 计算（最高 1.5 倍）。 */
@media (min-width: 768px) {
    body { max-width: 375px; margin: 0 auto; min-height: 100vh; box-shadow: 0 0 48px rgba(15, 23, 42, 0.12); }
    #main { max-width: 375px; }
    .tabs { max-width: 375px; margin: 0 auto; }
    .sheet { max-width: 375px; }
}
/* 图片：列表缩略图之外，详情弹层使用整幅实拍图 */
/* 详情页大图：只作用于 <img class="hero">，不要覆盖首页 .hero 横幅的渐变背景 */
img.hero { display: block; width: 100%; max-height: 240px; object-fit: cover; border-radius: 12px; margin: 4px 0 10px; background: #f1f5f9; }