:root {
    --ink: #192321;
    --soft: #43514e;
    --muted: #6b7774;
    --paper: #ffffff;
    --canvas: #f3f5f4;
    --line: #dce2df;
    --line-strong: #c7d0cc;
    --brand: #0f625a;
    --brand-dark: #0a463f;
    --brand-soft: #e5f0ed;
    --gold: #8a6416;
    --gold-soft: #f3e8cf;
    --danger: #a33b35;
    --shadow: 0 18px 45px rgba(25, 35, 33, 0.08);
}

* { box-sizing: border-box; }

body.site,
body.admin {
    margin: 0;
    color: var(--ink);
    background: var(--canvas);
    font-family: "PingFang SC", "Microsoft YaHei", "Noto Sans SC", Arial, sans-serif;
    line-height: 1.6;
}

body.site a,
body.admin a,
.zyw-manage a { color: inherit; }

.zyw-manage {
    color: var(--ink);
    font-family: "PingFang SC", "Microsoft YaHei", "Noto Sans SC", Arial, sans-serif;
    line-height: 1.6;
}

.zyw-manage .zyw-tabs {
    display: flex;
    align-items: center;
    gap: 4px;
    margin: 0 0 18px;
    padding: 4px;
    background: #eef2f1;
    border-radius: 10px;
}

.zyw-manage .zyw-tabs a {
    text-decoration: none;
    border: 0;
    background: transparent;
    border-radius: 8px;
    padding: 8px 16px;
    color: #43514e;
    font-size: 14px;
    font-weight: 700;
}

.zyw-manage .zyw-tabs a.active {
    color: #0f625a;
    background: #fff;
    box-shadow: 0 1px 3px rgba(25, 35, 33, 0.12);
}

.zyw-manage .zyw-tabs .tab-front {
    margin-left: auto;
    color: #0f625a;
}

.zyw-manage .form-grid {
    display: grid;
    grid-template-columns: minmax(0, 1.35fr) minmax(280px, 0.75fr);
    gap: 16px;
    align-items: start;
}

.zyw-manage .panel {
    border-radius: 10px;
}

.zyw-manage .panel h2 {
    margin: 0 0 14px;
    font-size: 16px;
}

.zyw-manage .photo-panel {
    margin-top: 16px;
}

.zyw-manage .photo-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

.zyw-manage .cover-preview {
    width: 160px;
    height: 100px;
    margin-bottom: 8px;
}

.zyw-manage .check {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    width: auto;
    margin: 8px 0;
    font-weight: 600;
}

.zyw-manage .check input[type="checkbox"] {
    width: 16px;
    height: 16px;
    margin: 0;
    flex: 0 0 auto;
}

.zyw-manage .edit-actions {
    display: flex;
    justify-content: flex-end;
    margin-top: 16px;
}

.zyw-manage .edit-actions .btn {
    min-width: 120px;
}

.zyw-manage .row-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    white-space: nowrap;
}

.zyw-manage .row-actions form {
    margin: 0;
}

.zyw-manage .row-actions .btn {
    min-height: 32px;
    padding: 0 12px;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 700;
}

.zyw-manage a.btn-light {
    color: var(--ink);
}

.zyw-manage .picked-files {
    margin: 8px 0 0;
    padding-left: 18px;
    color: var(--soft);
    font-size: 13px;
}

.zyw-manage .order-filter {
    display: flex;
    align-items: center;
    gap: 8px;
    width: auto;
    margin: 0 0 14px;
}

.zyw-manage .order-filter input,
.zyw-manage .order-filter select {
    width: auto;
    height: 38px;
    margin: 0;
    border: 1px solid var(--line-strong);
    border-radius: 999px;
    background: #fff;
}

.zyw-manage .order-filter input {
    width: 260px;
    padding: 0 14px;
}

.zyw-manage .order-filter select {
    padding: 0 12px;
}

.zyw-manage .order-filter .btn {
    min-height: 38px;
    padding: 0 16px;
    border-radius: 999px;
}

.zyw-manage .cat-table td {
    vertical-align: middle;
}

.zyw-manage .cat-table input,
.zyw-manage .cat-table select {
    height: 36px;
    margin: 0;
    border: 1px solid var(--line-strong);
    border-radius: 8px;
    background: #fff;
    padding: 0 12px;
}

.zyw-manage .cat-table input[name="name"] {
    width: 180px;
}

.zyw-manage .cat-table input[name="sort_order"] {
    width: 88px;
}

.zyw-manage .cat-table select {
    width: 96px;
}

.zyw-manage .cat-table .btn {
    min-height: 36px;
    padding: 0 14px;
    border-radius: 8px;
}

.zyw-manage a.btn-primary,
.zyw-manage a.btn-danger {
    color: #fff;
}

body.site img,
body.admin img,
.zyw-manage img { max-width: 100%; display: block; }

button, input, textarea, select { font: inherit; }

.wrap {
    width: min(1120px, calc(100% - 32px));
    margin: 0 auto;
}

.topbar {
    position: sticky;
    top: 0;
    z-index: 20;
    background: rgba(255, 255, 255, 0.96);
    border-bottom: 1px solid var(--line);
    backdrop-filter: blur(12px);
}

.topbar-inner {
    min-height: 72px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
}

.brand {
    display: flex;
    align-items: center;
    gap: 10px;
    text-decoration: none;
}

.brand-mark {
    width: 38px;
    height: 38px;
    display: grid;
    place-items: center;
    border-radius: 8px;
    color: #fff;
    background: var(--brand);
    font-weight: 800;
}

.brand strong, .brand small { display: block; }
.brand strong { font-size: 16px; }
.brand small { color: var(--muted); font-size: 12px; }

.nav { display: flex; gap: 18px; align-items: center; }
.nav a { color: var(--soft); text-decoration: none; font-weight: 700; font-size: 14px; }
.nav a.active, .nav a:hover { color: var(--brand); }

.hero {
    margin: 22px 0 8px;
    padding: 28px;
    background:
        linear-gradient(135deg, rgba(15, 98, 90, 0.12), rgba(243, 232, 207, 0.7)),
        var(--paper);
    border: 1px solid var(--line);
    border-radius: 8px;
}

.hero h1 { margin: 0 0 8px; font-size: 34px; line-height: 1.2; }
.hero p { margin: 0; max-width: 640px; color: var(--soft); }

.search {
    margin-top: 18px;
    display: flex;
    gap: 8px;
}

.search input, .field input, .field textarea, .field select, .query-form input {
    width: 100%;
    border: 1px solid var(--line-strong);
    background: #fff;
    border-radius: 6px;
    padding: 11px 12px;
    color: var(--ink);
}

.search input { max-width: 460px; }

.cats { display: flex; flex-wrap: wrap; gap: 8px; margin: 16px 0; }
.cats a {
    text-decoration: none;
    border: 1px solid var(--line);
    background: #fff;
    border-radius: 999px;
    padding: 7px 12px;
    color: var(--soft);
    font-size: 14px;
    font-weight: 700;
}
.cats a.active { color: #fff; background: var(--brand); border-color: var(--brand); }

.res-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 16px;
}

.res-card {
    display: flex;
    flex-direction: column;
    min-height: 100%;
    text-decoration: none;
    background: var(--paper);
    border: 1px solid var(--line);
    border-radius: 8px;
    overflow: hidden;
    transition: transform 160ms ease, box-shadow 160ms ease;
}
.res-card:hover { transform: translateY(-3px); box-shadow: var(--shadow); }

.res-cover {
    position: relative;
    aspect-ratio: 16 / 10;
    background: linear-gradient(160deg, var(--brand), #35a394);
    color: #fff;
}
.res-cover img { width: 100%; height: 100%; object-fit: cover; }
.res-cover.placeholder { display: grid; place-items: center; font-size: 42px; font-weight: 800; }

.price-tag, .recommend-tag {
    position: absolute;
    top: 10px;
    border-radius: 999px;
    padding: 4px 8px;
    font-size: 12px;
    font-weight: 800;
}
.price-tag { right: 10px; color: var(--gold); background: var(--gold-soft); }
.price-tag.free { color: var(--brand-dark); background: #fff; }
.recommend-tag { left: 10px; color: #fff; background: var(--brand); }

.res-body { padding: 14px 14px 16px; }
.res-body .cat { color: var(--brand); font-size: 12px; font-weight: 800; }
.res-body h2 { margin: 6px 0; font-size: 18px; line-height: 1.4; }
.res-body p {
    margin: 0;
    color: var(--muted);
    font-size: 14px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.empty, .panel, .buy-card, .unlock-box, .auth-card {
    background: var(--paper);
    border: 1px solid var(--line);
    border-radius: 8px;
}

.empty, .panel { padding: 28px; }
.empty h2, .panel h1, .detail-head h1 { margin: 0 0 8px; }

.detail-head { padding: 26px 0 8px; }
.detail-head .meta { color: var(--muted); font-size: 14px; }
.detail-head .meta span + span::before { content: " · "; }

.detail-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 320px;
    gap: 18px;
    align-items: start;
    padding-bottom: 28px;
}
.detail-gallery { grid-column: 1; }
.detail-content { grid-column: 1; }
.buy-card { grid-column: 2; grid-row: 1 / span 2; position: sticky; top: 88px; padding: 18px; }

body.site .buy-card {
    border: 0;
    border-radius: 16px;
    padding: 22px 20px;
    box-shadow: 0 10px 28px rgba(25, 35, 33, 0.06);
}

body.site .buy-card .price-large {
    margin-bottom: 12px;
}

body.site .home-box {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 42px;
    margin: 0 0 16px;
    border: 1px solid var(--line-strong);
    border-radius: 12px;
    background: #f7faf9;
    color: var(--brand);
    font-weight: 700;
    text-decoration: none;
}

body.site .home-box:hover {
    background: var(--brand-soft);
}

body.site .buy-card .lock-note {
    margin: 0 0 16px;
    font-size: 13px;
    line-height: 1.7;
}

body.site .buy-card .field {
    margin-bottom: 12px;
}

body.site .buy-card .field label {
    font-size: 13px;
    font-weight: 700;
}

body.site .buy-card .field input {
    height: 44px;
    padding: 0 14px;
    border-radius: 12px;
}

body.site .buy-card .pay-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    margin-top: 0;
}

body.site .buy-card .pay-actions .btn {
    width: 100%;
    min-height: 44px;
    border-radius: 12px;
    color: #fff;
}

body.site .buy-card .btn-alipay {
    background: #1677ff;
    border-color: #1677ff;
}

body.site .buy-card .btn-alipay:hover {
    background: #0958d9;
    border-color: #0958d9;
}

body.site .buy-card .btn-wechat {
    background: #07c160;
    border-color: #07c160;
}

body.site .buy-card .btn-wechat:hover {
    background: #06ad56;
    border-color: #06ad56;
}

body.site .buy-card .hint {
    margin: 14px 0 0;
    line-height: 1.7;
}
.detail-content, .gallery-stage { background: #fff; border: 1px solid var(--line); border-radius: 8px; }
.detail-content { padding: 22px; }
.gallery-stage img { width: 100%; max-height: 520px; object-fit: contain; background: #eef3f1; }
.thumbs { display: flex; gap: 8px; overflow-x: auto; margin-top: 8px; }
.thumbs button, .admin-photos button {
    border: 1px solid var(--line);
    padding: 0;
    background: #fff;
    border-radius: 6px;
    cursor: pointer;
}
.thumbs img { width: 84px; height: 64px; object-fit: cover; }

.prose { font-size: 16px; line-height: 1.9; color: var(--ink); }
.prose p { margin: 0 0 14px; }
.price-large { margin: 0 0 8px; font-size: 32px; font-weight: 800; color: var(--gold); }
.price-large.free { color: var(--brand); }
.lock-note { color: var(--soft); }

.btn, button.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 42px;
    padding: 0 16px;
    border-radius: 6px;
    border: 1px solid transparent;
    text-decoration: none;
    font-weight: 800;
    cursor: pointer;
}
.btn-primary { color: #fff; background: var(--brand); }
.btn-primary:hover { background: var(--brand-dark); }
.btn-light { color: var(--ink); background: #fff; border-color: var(--line-strong); }
.btn-danger { color: #fff; background: var(--danger); }
.btn-row, .pay-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.field { margin-bottom: 14px; }
.field label, .check { display: block; margin-bottom: 6px; font-weight: 700; }
.hint, .download-note { color: var(--muted); font-size: 13px; }
.order-no { font-size: 22px; font-weight: 800; letter-spacing: 0; word-break: break-all; }
.unlock-box { padding: 16px; background: var(--brand-soft); }
.unlock-label { margin-top: 0; font-weight: 800; color: var(--brand-dark); }

body.site .unlock-box {
    margin-top: 8px;
    padding: 22px;
    border: 1px solid #d5e8e3;
    border-radius: 14px;
    background: #eef6f4;
}

body.site .save-alert {
    margin: 12px 0;
    padding: 12px 14px;
    border-radius: 10px;
    background: #fff4d6;
    color: #8a4b08;
    font-size: 16px;
    font-weight: 800;
    line-height: 1.5;
}

body.site .order-meta {
    margin: 4px 0;
    color: var(--soft);
    font-size: 14px;
}

body.site .download-caption {
    margin: 16px 0 8px;
    font-size: 13px;
    font-weight: 700;
    color: var(--muted);
}

body.site .download-line {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
    margin: 0 0 12px;
}

body.site .download-url {
    flex: 1;
    min-width: 0;
    height: 42px;
    margin: 0;
    padding: 0 14px;
    border: 1px solid var(--line-strong);
    border-radius: 999px;
    background: #fff;
    color: var(--ink);
}

body.site .download-line .btn,
body.site .unlock-box .btn-primary {
    border-radius: 999px;
    min-height: 42px;
}

body.site .query-order {
    margin: 18px 0;
    padding: 18px 18px 14px;
    border: 1px solid #d5e8e3;
    border-radius: 14px;
    background: #eef6f4;
}

body.site .query-order h2 {
    margin: 0 0 6px;
    font-size: 20px;
}

body.site .query-price {
    margin: 0 0 6px;
    color: var(--gold);
    font-size: 28px;
    font-weight: 800;
    line-height: 1.2;
}

body.site .pay-back {
    display: inline-block;
    margin-top: 16px;
    color: var(--brand);
    font-weight: 700;
    text-decoration: none;
}

.pager { display: flex; gap: 6px; flex-wrap: wrap; margin: 18px 0 28px; }
.pager a { text-decoration: none; min-width: 36px; text-align: center; padding: 6px 8px; border: 1px solid var(--line); background: #fff; border-radius: 6px; }
.pager a.current { color: #fff; background: var(--brand); border-color: var(--brand); }

.site-foot { color: var(--muted); font-size: 13px; padding: 10px 0 28px; }

.lightbox {
    position: fixed;
    inset: 0;
    z-index: 40;
    display: grid;
    place-items: center;
    padding: 24px;
    background: rgba(16, 24, 22, 0.82);
}
.lightbox[hidden] { display: none; }
.lightbox img { max-width: min(1000px, 100%); max-height: 82vh; }
.lightbox-close {
    position: absolute;
    top: 16px;
    right: 16px;
    color: #fff;
    background: transparent;
    border: 0;
    font-size: 16px;
    cursor: pointer;
}

.flash { margin-top: 16px; padding: 12px 14px; border-radius: 6px; background: var(--brand-soft); color: var(--brand-dark); }
.flash-err { background: #fdeceb; color: var(--danger); }

.auth-card { width: min(440px, calc(100% - 32px)); margin: 48px auto; padding: 28px; }
.stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; margin: 16px 0; }
.stat { background: #fff; border: 1px solid var(--line); border-radius: 8px; padding: 16px; }
.stat b { display: block; font-size: 24px; }
.banner { padding: 12px 14px; border-radius: 8px; background: var(--gold-soft); color: var(--gold); }

.table-wrap { overflow-x: auto; background: #fff; border: 1px solid var(--line); border-radius: 8px; }
table { width: 100%; border-collapse: collapse; }
th, td { padding: 10px 12px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; font-size: 14px; }
th { background: #f7faf9; }
.thumb { width: 72px; height: 54px; object-fit: cover; border-radius: 4px; background: var(--brand-soft); }
.admin-main { padding-bottom: 40px; }
.form-grid { display: grid; grid-template-columns: 1.4fr 0.8fr; gap: 18px; }
.admin-photos { display: flex; flex-wrap: wrap; gap: 10px; }
.admin-photos label { width: 120px; font-size: 12px; color: var(--soft); }
.admin-photos img { width: 120px; height: 90px; object-fit: cover; }
.inline-form { display: inline; }
.muted { color: var(--muted); }
.actions { display: flex; gap: 8px; flex-wrap: wrap; }

body.site {
    background:
        radial-gradient(900px 280px at 50% 0%, rgba(15, 98, 90, 0.08), transparent 70%),
        var(--canvas);
}

body.site .storefront {
    width: min(1480px, calc(100% - 40px));
    padding-bottom: 48px;
}

body.site .page-head {
    margin: 28px 0 0;
    padding: 28px 28px 22px;
    background: #fff;
    border-radius: 16px 16px 0 0;
    box-shadow: 0 10px 30px rgba(25, 35, 33, 0.04);
}

body.site .page-head h1 {
    margin: 0;
    font-size: 26px;
    line-height: 1.2;
}

body.site .page-head p {
    margin: 4px 0 0;
    color: var(--muted);
    font-size: 13px;
}

body.site .site-search {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    margin: 14px 0 0;
}

body.site .site-search input {
    flex: 1;
    width: auto;
    min-width: 0;
    height: 44px;
    margin: 0;
    padding: 0 18px;
    border: 1px solid var(--line-strong);
    border-radius: 999px;
    background: #fff;
}

body.site .site-search .btn {
    min-height: 44px;
    padding: 0 22px;
    border-radius: 999px;
}

body.site .storefront .cats,
body.site .storefront .res-grid,
body.site .storefront .empty,
body.site .storefront .pager {
    margin-left: 0;
    margin-right: 0;
    padding-left: 28px;
    padding-right: 28px;
    background: #fff;
}

body.site .storefront .cats {
    margin-top: 0;
    margin-bottom: 0;
    padding-top: 4px;
    padding-bottom: 18px;
}

body.site .storefront .res-grid {
    padding-bottom: 28px;
    border-radius: 0 0 16px 16px;
    box-shadow: 0 16px 30px rgba(25, 35, 33, 0.04);
}

body.site .storefront .empty {
    margin-top: 0;
    border: 0;
    border-radius: 0 0 16px 16px;
    box-shadow: 0 16px 30px rgba(25, 35, 33, 0.04);
}

body.site .res-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 18px;
}

@media (max-width: 1100px) {
    body.site .res-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

body.site .cats {
    margin: 18px 0 20px;
}

body.site .cats a {
    padding: 8px 14px;
    color: var(--ink);
    background: rgba(255, 255, 255, 0.9);
}

body.site .cats a.active {
    color: #fff;
    background: var(--brand);
    border-color: var(--brand);
}

body.site .res-card {
    border: 0;
    border-radius: 14px;
    box-shadow: 0 8px 24px rgba(25, 35, 33, 0.05);
}

body.site .res-cover {
    border-radius: 14px 14px 0 0;
}

@media (max-width: 800px) {
    .topbar-inner, .search, .pay-actions { align-items: stretch; flex-direction: column; }
    body.site .site-search { gap: 8px; }
    body.site .site-search .btn { padding: 0 16px; }
    body.site .page-head,
    body.site .storefront .cats,
    body.site .storefront .res-grid,
    body.site .storefront .empty { padding-left: 16px; padding-right: 16px; }
    body.site .res-grid { grid-template-columns: 1fr; }
    .nav { gap: 12px; flex-wrap: wrap; }
    .hero h1 { font-size: 28px; }
    .detail-layout, .form-grid, .stats, .zyw-manage .form-grid, .zyw-manage .photo-row { grid-template-columns: 1fr; }
    .detail-gallery, .detail-content, .buy-card { grid-column: auto; grid-row: auto; position: static; }
    .search input { max-width: none; }
}
