:root {
    --bg: #f3f4f6;
    --surface: #ffffff;
    --ink: #1c1f26;
    --muted: #6b7280;
    --line: #e5e7eb;
    --accent: #b91c1c;
    --accent-dark: #991b1b;
    --price: #dc2626;
    --brand: #1e3a5f;
    --radius: 12px;
    --safe-bottom: env(safe-area-inset-bottom, 0px);
    --font-sans: "Noto Sans SC", "PingFang SC", "Microsoft YaHei", sans-serif;
    --font-serif: "Noto Serif SC", "Songti SC", "SimSun", serif;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html, body {
    background: var(--bg);
    color: var(--ink);
    font-family: var(--font-sans);
    font-size: 14px;
    line-height: 1.5;
    -webkit-tap-highlight-color: transparent;
}

a {
    color: inherit;
    text-decoration: none;
}

img {
    display: block;
    width: 100%;
    height: auto;
}

.app {
    max-width: 480px;
    margin: 0 auto;
    min-height: 100vh;
    background: var(--bg);
    position: relative;
}

/* Header */
.site-header {
    background: linear-gradient(135deg, #1e3a5f 0%, #0f2744 100%);
    color: #fff;
    padding: 16px 16px 18px;
}

.brand {
    display: flex;
    align-items: center;
    gap: 12px;
}

.brand-mark {
    width: 42px;
    height: 42px;
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.12);
    border: 1px solid rgba(255, 255, 255, 0.25);
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: var(--font-serif);
    font-size: 22px;
    font-weight: 700;
}

.brand-text h1 {
    font-family: var(--font-serif);
    font-size: 20px;
    font-weight: 700;
    line-height: 1.2;
}

.brand-text p {
    margin-top: 2px;
    font-size: 12px;
    opacity: 0.75;
}

.banner {
    margin: 12px 12px 0;
    border-radius: var(--radius);
    overflow: hidden;
    background:
        radial-gradient(circle at 85% 20%, rgba(255, 255, 255, 0.18), transparent 40%),
        linear-gradient(120deg, #243b55, #141e30);
    color: #fff;
}

.banner-inner {
    padding: 20px 18px;
}

.banner-tag {
    display: inline-block;
    font-size: 11px;
    padding: 2px 8px;
    border: 1px solid rgba(255, 255, 255, 0.35);
    border-radius: 999px;
    margin-bottom: 8px;
}

.banner h2 {
    font-family: var(--font-serif);
    font-size: 22px;
    font-weight: 700;
}

.banner-desc {
    margin-top: 6px;
    font-size: 13px;
    opacity: 0.8;
}

.page {
    padding: 14px 12px 28px;
}

.section-head {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    margin-bottom: 12px;
    padding: 0 2px;
}

.section-head h3 {
    font-size: 16px;
    font-weight: 700;
}

.section-head span {
    color: var(--muted);
    font-size: 12px;
}

.product-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

.product-card {
    background: var(--surface);
    border-radius: var(--radius);
    overflow: hidden;
    border: 1px solid var(--line);
    display: flex;
    flex-direction: column;
}

.product-cover {
    aspect-ratio: 1 / 1;
    background: #eef1f5;
    overflow: hidden;
}

.product-cover img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.product-body {
    padding: 10px;
    display: flex;
    flex-direction: column;
    flex: 1;
}

.product-body h4 {
    font-size: 13px;
    font-weight: 700;
    line-height: 1.35;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    min-height: 2.7em;
}

.product-sub {
    margin-top: 4px;
    color: var(--muted);
    font-size: 11px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.product-meta {
    margin-top: auto;
    padding-top: 8px;
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 4px;
}

.price {
    color: var(--price);
    font-weight: 700;
    line-height: 1;
}

.price em {
    font-style: normal;
    font-size: 12px;
    margin-right: 1px;
}

.price strong {
    font-size: 18px;
    font-weight: 700;
}

.price.big strong {
    font-size: 28px;
}

.price del {
    margin-left: 6px;
    color: #9ca3af;
    font-size: 12px;
    font-weight: 400;
}

.sales {
    color: var(--muted);
    font-size: 11px;
    white-space: nowrap;
}

.site-footer {
    text-align: center;
    color: #9ca3af;
    font-size: 11px;
    padding: 16px 12px calc(24px + var(--safe-bottom));
    line-height: 1.7;
    background: var(--bg);
}

.site-footer-brand {
    color: #6b7280;
    font-size: 12px;
    margin-bottom: 8px;
}

.site-footer-copy {
    margin-bottom: 6px;
}

.site-footer-meta {
    font-size: 10px;
    line-height: 1.8;
    color: #a1a1aa;
}

.site-footer-meta .sep {
    margin: 0 4px;
    opacity: 0.6;
}

/* Nav */
.nav-bar {
    position: sticky;
    top: 0;
    z-index: 20;
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 48px;
    padding: 0 8px;
    background: rgba(255, 255, 255, 0.96);
    backdrop-filter: blur(8px);
    border-bottom: 1px solid var(--line);
}

.nav-bar h1 {
    font-size: 16px;
    font-weight: 700;
}

.nav-back {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 28px;
    line-height: 1;
    color: var(--ink);
}

.nav-placeholder {
    width: 40px;
}

/* Detail */
.detail-page {
    padding-bottom: calc(76px + var(--safe-bottom));
}

.detail-cover {
    background: #e8ecf1;
}

.detail-cover img {
    width: 100%;
    aspect-ratio: 1 / 1;
    object-fit: cover;
}

.detail-price-block,
.detail-panel,
.pay-card {
    background: var(--surface);
    margin-top: 10px;
    padding: 16px;
}

.detail-title {
    margin-top: 10px;
    font-size: 18px;
    font-weight: 700;
    font-family: var(--font-serif);
    line-height: 1.4;
}

.detail-sub {
    margin-top: 6px;
    color: var(--muted);
    font-size: 13px;
}

.detail-stats {
    margin-top: 12px;
    display: flex;
    gap: 16px;
    color: var(--muted);
    font-size: 12px;
}

.detail-panel h3 {
    font-size: 15px;
    margin-bottom: 10px;
    font-weight: 700;
}

.specs {
    white-space: pre-wrap;
    font-family: var(--font-sans);
    font-size: 13px;
    color: #374151;
    line-height: 1.8;
    background: #f9fafb;
    border-radius: 8px;
    padding: 12px;
}

.desc p {
    margin-bottom: 10px;
    color: #374151;
    font-size: 14px;
    line-height: 1.7;
}

.buy-bar {
    position: fixed;
    left: 50%;
    transform: translateX(-50%);
    bottom: 0;
    width: 100%;
    max-width: 480px;
    background: #fff;
    border-top: 1px solid var(--line);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 10px 14px calc(10px + var(--safe-bottom));
    z-index: 30;
}

.buy-price span {
    display: block;
    font-size: 11px;
    color: var(--muted);
    margin-bottom: 2px;
}

.btn-buy,
.btn-pay {
    border: 0;
    background: linear-gradient(135deg, var(--accent), var(--accent-dark));
    color: #fff;
    font-size: 15px;
    font-weight: 700;
    border-radius: 999px;
    padding: 12px 28px;
    cursor: pointer;
    font-family: inherit;
}

.btn-buy {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 140px;
}

.btn-pay {
    width: calc(100% - 24px);
    margin: 8px 12px 24px;
    display: block;
    text-align: center;
}

.btn-pay:disabled {
    opacity: 0.7;
}

/* Pay */
.pay-page {
    padding: 12px 0 20px;
}

.pay-product {
    display: flex;
    gap: 12px;
}

.pay-product img {
    width: 88px;
    height: 88px;
    border-radius: 8px;
    object-fit: cover;
    flex-shrink: 0;
    background: #eef1f5;
}

.pay-product h2 {
    font-size: 15px;
    font-weight: 700;
    line-height: 1.35;
}

.pay-product p {
    margin-top: 4px;
    color: var(--muted);
    font-size: 12px;
}

.pay-line {
    margin-top: 10px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.kv {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 0;
    border-bottom: 1px solid var(--line);
    font-size: 13px;
}

.kv:last-child {
    border-bottom: 0;
}

.kv span {
    color: var(--muted);
}

.kv.total {
    padding-top: 14px;
}

.kv.total strong.price {
    font-size: 20px;
}

.empty {
    padding: 80px 20px;
    text-align: center;
}

.empty p {
    color: var(--muted);
    margin-bottom: 16px;
}

.btn-link {
    display: inline-block;
    padding: 10px 20px;
    background: var(--brand);
    color: #fff;
    border-radius: 999px;
    font-size: 14px;
}

@media (min-width: 481px) {
    body {
        background: #dbe0e6;
    }

    .app {
        box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.04), 0 12px 40px rgba(15, 23, 42, 0.12);
        min-height: 100vh;
    }
}
