:root {
    --bg: #eef6ff;
    --bg-soft: #f7fbff;
    --card: rgba(255, 255, 255, 0.96);
    --line: rgba(103, 162, 255, 0.18);
    --text: #16314d;
    --muted: #6482a4;
    --primary: #3388ff;
    --primary-deep: #1b67d8;
    --success: #1d9d69;
    --danger: #e34c67;
    --shadow: 0 20px 55px rgba(52, 110, 190, 0.12);
    --radius-xl: 28px;
    --radius-lg: 20px;
    --radius-md: 14px;
}

* {
    box-sizing: border-box;
}

html,
body {
    margin: 0;
    padding: 0;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
    color: var(--text);
    background:
        radial-gradient(circle at top left, rgba(80, 151, 255, 0.18), transparent 32%),
        radial-gradient(circle at top right, rgba(149, 205, 255, 0.28), transparent 28%),
        linear-gradient(180deg, #f8fbff 0%, #eff6ff 100%);
    min-height: 100vh;
}

body.modal-open {
    overflow: hidden;
}

a {
    color: inherit;
    text-decoration: none;
}

img {
    display: block;
    max-width: 100%;
}

.site-shell,
.admin-layout {
    width: min(1280px, calc(100% - 32px));
    margin: 0 auto;
}

.hero-section {
    margin-top: 20px;
    padding: 24px;
    background: linear-gradient(135deg, rgba(255,255,255,0.96), rgba(237,246,255,0.92));
    border: 1px solid var(--line);
    border-radius: 36px;
    box-shadow: var(--shadow);
    backdrop-filter: blur(16px);
}

.hero-topbar,
.admin-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}

.brand-mark,
.sidebar-brand {
    font-weight: 800;
    letter-spacing: 0.04em;
    color: var(--primary-deep);
}

.admin-link,
.secondary-btn,
.danger-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 11px 16px;
    border-radius: 999px;
    border: 1px solid rgba(51, 136, 255, 0.18);
    background: rgba(255, 255, 255, 0.8);
    color: var(--primary-deep);
    transition: 0.2s ease;
}

.danger-btn {
    color: var(--danger);
    border-color: rgba(227, 76, 103, 0.16);
}

.admin-link:hover,
.secondary-btn:hover,
.danger-btn:hover,
.product-card:hover {
    transform: translateY(-2px);
}

.hero-content {
    display: grid;
    grid-template-columns: 1.35fr 0.85fr;
    gap: 24px;
    margin-top: 28px;
}

.badge,
.auth-badge {
    display: inline-flex;
    padding: 8px 14px;
    border-radius: 999px;
    background: rgba(51, 136, 255, 0.12);
    color: var(--primary-deep);
    font-weight: 700;
    font-size: 13px;
}

.hero-copy h1,
.auth-card h1,
.admin-header h1 {
    margin: 14px 0 10px;
    font-size: clamp(32px, 4vw, 52px);
    line-height: 1.08;
}

.hero-copy p,
.hero-panel-card p,
.section-head p,
.site-footer p,
.admin-header p,
.card-head span,
.item-content p,
.empty-inline,
.empty-state p,
.auth-card p {
    color: var(--muted);
}

.hero-stats,
.product-grid {
    display: grid;
    gap: 18px;
}

.hero-stats {
    margin-top: 22px;
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

.stat-card,
.hero-panel-card,
.product-card,
.admin-card,
.auth-card,
.alert,
.admin-product-item {
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow);
}

.stat-card,
.hero-panel-card,
.admin-card,
.auth-card,
.alert,
.admin-product-item {
    padding: 20px;
}

.stat-card strong {
    display: block;
    font-size: 28px;
    color: var(--primary-deep);
}

.hero-panel {
    display: flex;
    align-items: stretch;
}

.hero-panel-card {
    width: 100%;
    display: flex;
    flex-direction: column;
    justify-content: center;
    background: linear-gradient(180deg, rgba(59,138,255,0.08), rgba(255,255,255,0.88));
}

.mini-list {
    margin-top: 14px;
    padding: 14px;
    border-radius: var(--radius-lg);
    background: rgba(255,255,255,0.78);
    word-break: break-word;
}

.content-wrap {
    padding: 28px 0 10px;
}

.section-head {
    margin-bottom: 18px;
}

.section-head h2,
.card-head h2 {
    margin: 0 0 6px;
    font-size: 28px;
}

.product-grid {
    grid-template-columns: repeat(auto-fit, minmax(270px, 1fr));
}

.product-card {
    overflow: hidden;
    transition: transform .2s ease, box-shadow .2s ease;
}

.product-image-wrap {
    position: relative;
    height: 240px;
    background: linear-gradient(135deg, #eef7ff, #dceeff);
    cursor: pointer;
    overflow: hidden;
    border-radius: 22px 22px 0 0;
}

.product-image-wrap img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.multi-count-badge {
    position: absolute;
    right: 10px;
    top: 10px;
    padding: 6px 10px;
    border-radius: 999px;
    background: rgba(22, 49, 77, 0.78);
    color: #fff;
    font-size: 12px;
    font-weight: 700;
}

.image-placeholder,
.thumb-placeholder {
    height: 100%;
    display: grid;
    place-items: center;
    color: var(--muted);
    font-weight: 700;
}

.product-body {
    padding: 18px;
}

.product-body h3 {
    margin: 0 0 8px;
    font-size: 22px;
}

.product-body p {
    margin: 0;
    line-height: 1.7;
    color: var(--muted);
    min-height: 78px;
    word-break: break-word;
}

.gallery-btn {
    margin-top: 14px;
    width: 100%;
    border: 1px solid rgba(51, 136, 255, 0.18);
    background: rgba(51, 136, 255, 0.08);
    color: var(--primary-deep);
    box-shadow: none;
}

.product-footer,
.meta-row,
.actions-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.product-footer {
    margin-top: 16px;
}

.price-tag,
.jump-tag {
    display: inline-flex;
    align-items: center;
    border-radius: 999px;
    padding: 10px 14px;
    font-weight: 700;
}

.price-tag {
    background: rgba(51, 136, 255, 0.11);
    color: var(--primary-deep);
}

.jump-tag {
    background: linear-gradient(135deg, var(--primary), var(--primary-deep));
    color: #fff;
}

.empty-state,
.empty-inline {
    padding: 48px 20px;
    text-align: center;
    background: var(--card);
    border: 1px dashed rgba(51,136,255,0.2);
    border-radius: var(--radius-xl);
}

.empty-icon {
    font-size: 48px;
}

.site-footer {
    padding: 18px 0 36px;
    text-align: center;
}

.admin-page {
    padding: 22px 0;
}

.admin-layout {
    display: grid;
    grid-template-columns: 250px 1fr;
    gap: 22px;
    align-items: start;
}

.admin-sidebar {
    position: sticky;
    top: 20px;
    padding: 22px;
    background: rgba(255,255,255,0.88);
    border: 1px solid var(--line);
    border-radius: 28px;
    box-shadow: var(--shadow);
}

.admin-sidebar nav {
    margin-top: 18px;
    display: grid;
    gap: 10px;
}

.admin-sidebar nav a {
    padding: 12px 14px;
    border-radius: 14px;
    color: var(--text);
    background: rgba(238,246,255,0.95);
    border: 1px solid transparent;
}

.admin-sidebar nav a:hover {
    border-color: rgba(51,136,255,0.2);
    color: var(--primary-deep);
}

.admin-main {
    display: grid;
    gap: 20px;
}

.admin-card {
    padding: 24px;
}

.card-head {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 18px;
}

.grid-form {
    display: grid;
    gap: 16px;
}

.grid-form.two-col {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.full-width {
    grid-column: 1 / -1;
}

label {
    display: block;
    margin-bottom: 8px;
    font-weight: 700;
}

input[type="text"],
input[type="url"],
input[type="password"],
input[type="number"],
input[type="file"],
textarea {
    width: 100%;
    border: 1px solid rgba(114, 164, 241, 0.24);
    background: #fff;
    border-radius: 16px;
    padding: 14px 16px;
    font-size: 15px;
    color: var(--text);
    outline: none;
    transition: border-color .2s ease, box-shadow .2s ease;
}

input:focus,
textarea:focus {
    border-color: rgba(51, 136, 255, 0.45);
    box-shadow: 0 0 0 4px rgba(51, 136, 255, 0.1);
}

textarea {
    resize: vertical;
    min-height: 120px;
}

button {
    border: none;
    cursor: pointer;
    border-radius: 16px;
    padding: 14px 18px;
    background: linear-gradient(135deg, var(--primary), var(--primary-deep));
    color: white;
    font-weight: 800;
    box-shadow: 0 14px 26px rgba(27, 103, 216, 0.18);
}

button:hover {
    transform: translateY(-1px);
}

.alert.success {
    color: var(--success);
}

.alert.error {
    color: var(--danger);
}

.admin-product-list {
    display: grid;
    gap: 16px;
}

.admin-product-item {
    display: grid;
    grid-template-columns: 110px 1fr auto;
    gap: 16px;
    align-items: center;
}

.thumb {
    width: 110px;
    height: 110px;
    overflow: hidden;
    border-radius: 18px;
    background: linear-gradient(135deg, #eef7ff, #dceeff);
}

.thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.item-content h3 {
    margin: 0 0 8px;
}

.item-content p {
    margin: 0 0 10px;
    line-height: 1.65;
}

.item-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.preview-box {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.preview-box img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.multi-preview-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(110px, 1fr));
    gap: 12px;
}

.multi-preview-item {
    position: relative;
    height: 110px;
    overflow: hidden;
    border-radius: 18px;
    border: 1px solid var(--line);
    background: #fff;
}

.cover-badge {
    position: absolute;
    left: 8px;
    top: 8px;
    padding: 4px 8px;
    border-radius: 999px;
    background: rgba(27, 103, 216, 0.9);
    color: #fff;
    font-size: 12px;
    font-weight: 700;
}

.admin-auth-page {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 24px;
}

.auth-card {
    width: min(500px, 100%);
    padding: 28px;
}

.auth-form {
    margin-top: 18px;
    display: grid;
    gap: 14px;
}

.back-link {
    display: inline-block;
    margin-top: 18px;
    color: var(--primary-deep);
}

/* 弹窗 */
.img-modal,
.gallery-modal {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 99999;
    background: rgba(0, 0, 0, 0.82);
    padding: 24px;
}

.img-modal.show,
.gallery-modal.show {
    display: flex;
    align-items: center;
    justify-content: center;
}

.img-modal-inner {
    position: relative;
    width: auto;
    max-width: min(1100px, 96vw);
    max-height: 92vh;
    display: flex;
    align-items: center;
    justify-content: center;
}

.img-modal img {
    display: block;
    max-width: 100%;
    max-height: 90vh;
    border-radius: 16px;
    object-fit: contain;
    box-shadow: 0 24px 60px rgba(0,0,0,0.35);
    background: #fff;
}

.img-close,
.gallery-close {
    position: absolute;
    right: -6px;
    top: -6px;
    width: 44px;
    height: 44px;
    border-radius: 999px;
    padding: 0;
    font-size: 28px;
    line-height: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 12px 24px rgba(0,0,0,0.22);
    z-index: 2;
}

.gallery-dialog {
    position: relative;
    width: min(980px, 100%);
    max-height: 92vh;
    overflow: auto;
    background: #fff;
    border-radius: 24px;
    padding: 22px;
    box-shadow: 0 24px 60px rgba(0,0,0,0.24);
}

.gallery-main {
    height: min(62vh, 620px);
    border-radius: 18px;
    overflow: hidden;
    background: #f5f9ff;
    display: flex;
    justify-content: center;
    align-items: center;
}

.gallery-main img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}

.gallery-thumbs {
    margin-top: 16px;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(90px, 1fr));
    gap: 12px;
}

.gallery-thumb-btn {
    border: 2px solid transparent;
    background: #fff;
    padding: 0;
    height: 90px;
    overflow: hidden;
    border-radius: 14px;
    box-shadow: none;
    cursor: pointer;
}

.gallery-thumb-btn.active {
    border-color: var(--primary);
}

.gallery-thumb-btn img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

@media (max-width: 1024px) {
    .hero-content,
    .admin-layout,
    .admin-product-item {
        grid-template-columns: 1fr;
    }

    .admin-sidebar {
        position: static;
    }
}

@media (max-width: 720px) {
    .site-shell,
    .admin-layout {
        width: min(100% - 20px, 1280px);
    }

    .hero-stats,
    .grid-form.two-col,
    .product-grid {
        grid-template-columns: 1fr;
    }

    .hero-section {
        padding: 18px;
        border-radius: 26px;
    }

    .product-image-wrap {
        height: 210px;
    }

    .card-head,
    .hero-topbar,
    .product-footer,
    .meta-row,
    .actions-row {
        flex-direction: column;
        align-items: flex-start;
    }

    .gallery-dialog {
        padding: 16px;
    }

    .gallery-main {
        height: 42vh;
    }

    .img-modal,
    .gallery-modal {
        padding: 12px;
    }

    .img-close,
    .gallery-close {
        right: 6px;
        top: 6px;
    }
}