:root {
    --primary: #1769e8;
    --primary-dark: #125ed3;
    --success: #22a06b;
    --danger: #e5484d;
    --text: #172033;
    --muted: #8a94a6;
    --border: #e5eaf1;
    --bg: #f4f7fb;
    --card: #ffffff;
    --radius: 14px;
    --shadow: 0 6px 24px rgba(31, 61, 114, .07);
}

* { box-sizing: border-box; }

body {
    margin: 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", Arial, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
}

a { color: var(--primary); text-decoration: none; }
a:hover { color: var(--primary-dark); }

.container { width: 100%; max-width: 1180px; margin: 0 auto; padding: 0 24px; }

.top-area {
    height: 245px;
    position: relative;
    overflow: hidden;
    background: linear-gradient(135deg, #1677ff 0%, #2166f3 48%, #164bc9 100%);
}
.top-area::before {
    content: "";
    position: absolute;
    width: 420px; height: 420px;
    border-radius: 50%;
    background: rgba(255, 255, 255, .08);
    top: -250px; right: -80px;
}
.top-area::after {
    content: "";
    position: absolute;
    width: 280px; height: 280px;
    border-radius: 50%;
    background: rgba(255, 255, 255, .06);
    bottom: -210px; left: 8%;
}
.top-content {
    max-width: 1180px; height: 100%;
    margin: 0 auto;
    padding: 28px 24px 0;
    position: relative; z-index: 2;
    display: flex; align-items: flex-start; justify-content: space-between;
}

.logo { display: flex; flex-direction: column; align-items: flex-start; gap: 12px; color: #fff; font-weight: 650; }
.logo-main { display: flex; align-items: center; gap: 11px; font-size: 17px; }
.logo-icon {
    width: 38px; height: 38px; border-radius: 10px;
    background: rgba(255, 255, 255, .18);
    border: 1px solid rgba(255, 255, 255, .22);
    display: flex; align-items: center; justify-content: center;
    font-size: 12px; font-weight: 800; letter-spacing: .5px;
}
.logo-text { font-size: 17px; font-weight: 650; }
.header-date { color: rgba(255, 255, 255, .82); font-size: 13px; padding-top: 10px; }

.site-header {
    background: linear-gradient(135deg, #1677ff 0%, #2166f3 48%, #164bc9 100%);
    color: #fff;
    box-shadow: 0 2px 16px rgba(22, 105, 232, .25);
}
.header-inner { display: flex; align-items: center; justify-content: space-between; height: 62px; }
.nav { display: flex; gap: 6px; }
.nav-link {
    color: rgba(255, 255, 255, .85);
    padding: 7px 14px; border-radius: 999px;
    font-size: 14px; transition: .2s;
}
.nav-link:hover, .nav-link.active { background: rgba(255, 255, 255, .18); color: #fff; }

main { min-height: 60vh; }
.hero { margin-bottom: 24px; }
.hero h1 { margin: 0 0 6px; font-size: 26px; }
.muted { color: var(--muted); margin: 0; font-size: 14px; }
.strong { font-weight: 600; }

.breadcrumb { font-size: 14px; color: var(--muted); margin-bottom: 18px; }
.breadcrumb .sep { margin: 0 8px; }

.card {
    background: var(--card);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 22px;
}
.card + .card { margin-top: 20px; }
.card-header {
    display: flex; align-items: center; justify-content: space-between;
    margin-bottom: 16px; gap: 12px; flex-wrap: wrap;
}
.card-header h2 { margin: 0; font-size: 17px; }

.home-container {
    max-width: 1180px;
    margin: -110px auto 0;
    padding: 0 24px 55px;
    position: relative; z-index: 5;
}
.product-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 18px;
}
.product-card {
    display: block;
    min-height: 190px;
    background: rgba(255, 255, 255, .98);
    border: 1px solid rgba(226, 232, 240, .9);
    border-radius: 16px;
    padding: 22px;
    cursor: pointer;
    color: var(--text);
    box-shadow: 0 12px 35px rgba(31, 61, 114, .10);
    transition: transform .15s ease, box-shadow .15s ease, border-color .15s ease;
}
.product-card:hover {
    transform: translateY(-4px);
    border-color: #d7e2f5;
    box-shadow: 0 16px 38px rgba(31, 61, 114, .15);
    color: var(--text);
}
.product-card:active { transform: translateY(-1px); }
.product-top { display: flex; align-items: center; justify-content: space-between; }
.product-icon {
    width: 44px; height: 44px; border-radius: 12px;
    background: #edf5ff; color: #1769e8;
    display: flex; align-items: center; justify-content: center;
    font-size: 13px; font-weight: 800;
}
.product-arrow {
    width: 30px; height: 30px; border-radius: 8px;
    background: #f7f9fc; color: #94a3b8;
    display: flex; align-items: center; justify-content: center;
    font-size: 19px;
}
.product-name { margin-top: 18px; font-size: 20px; line-height: 1.2; font-weight: 700; color: #172033; }
.product-desc { margin-top: 7px; font-size: 13px; color: #8a94a6; }
.product-bottom { margin-top: 20px; display: flex; align-items: center; justify-content: space-between; }
.product-count { font-size: 12px; color: #a0a9b8; }
.view-detail { color: #1769e8; font-size: 13px; font-weight: 600; }

.detail-container { max-width: 1180px; margin: 0 auto; padding: 30px 24px 55px; }
.back-btn {
    border: 0; background: transparent; padding: 0; margin: 0 0 18px;
    color: #64748b; font-size: 14px; cursor: pointer; font-family: inherit;
}
.back-btn:hover { color: #1769e8; }

.detail-header {
    background: #fff;
    border: 1px solid #e5eaf1;
    border-radius: 16px;
    padding: 22px;
    display: flex; align-items: center; justify-content: space-between; gap: 20px;
    box-shadow: 0 5px 20px rgba(30, 55, 90, .04);
}
.detail-info { display: flex; align-items: center; gap: 14px; min-width: 0; }
.detail-icon {
    width: 50px; height: 50px; border-radius: 12px;
    background: #edf5ff; color: #1769e8;
    display: flex; align-items: center; justify-content: center;
    font-size: 13px; font-weight: 800; flex-shrink: 0;
}
.detail-name { font-size: 21px; line-height: 1.2; font-weight: 700; color: #172033; }
.detail-desc { margin-top: 5px; font-size: 13px; color: #8a94a6; }
.detail-count { margin-top: 4px; font-size: 12px; color: #a0a9b8; }
.link-search {
    display: flex; align-items: center; gap: 10px;
    margin-top: 16px; flex-wrap: wrap;
}
.link-search .input { max-width: 320px; }

.link-list {
    margin-top: 16px; background: #fff;
    border: 1px solid #e5eaf1; border-radius: 16px; overflow: hidden;
    box-shadow: 0 5px 20px rgba(30, 55, 90, .04);
}
.link-row {
    min-height: 68px; padding: 12px 18px;
    border-bottom: 1px solid #eef1f5;
    display: grid; grid-template-columns: 118px 56px minmax(0, 1fr) 78px;
    align-items: center; gap: 16px;
}
.link-row:last-child { border-bottom: 0; }
.link-size { color: #263247; font-size: 14px; font-weight: 700; word-break: break-all; }
.link-url {
    min-width: 0; color: #718096; font-size: 13px;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.copy-btn {
    border: 1px solid #dfe5ed; background: #fff; color: #445066;
    border-radius: 7px; padding: 7px 10px; cursor: pointer;
    font-size: 12px; font-weight: 600; font-family: inherit;
    transition: background .12s ease, border-color .12s ease;
}
.copy-btn:hover { background: #f7faff; border-color: #c9d7ec; }
.copy-btn.copied { background: #1769e8; border-color: #1769e8; color: #fff; }
.copy-btn:disabled { opacity: .55; cursor: not-allowed; }

/* 图片列表内联备注：跨整行显示在每一行底部 */
.link-remark {
    grid-column: 1 / -1;
    display: flex; align-items: flex-start; gap: 8px;
    margin-top: 4px;
}
.link-remark textarea {
    flex: 1; min-width: 0; resize: vertical;
    padding: 6px 9px; font-size: 13px; line-height: 1.45;
    border: 1px solid #e5eaf1; border-radius: 7px;
    background: #fafbfe; color: #263247; font-family: inherit;
    box-sizing: border-box;
}
.link-remark textarea:focus { outline: none; border-color: #c9d7ec; background: #fff; }

.product-head { display: flex; align-items: center; gap: 10px; font-size: 17px; font-weight: 600; color: var(--text); }
.product-head input[type="checkbox"] { width: 16px; height: 16px; cursor: pointer; margin: 0; }
.collapse-toggle { cursor: pointer; user-select: none; }
.collapse-toggle:hover { color: var(--primary); }
.caret {
    display: inline-block; font-size: 12px; color: var(--muted);
    transition: transform .15s ease; cursor: pointer;
}
.product-block.collapsed .product-body { display: none; }
.product-block.collapsed .caret { transform: rotate(-90deg); }

.size-group {
    margin-top: 14px; padding-top: 14px;
    border-top: 1px dashed var(--border);
}
.size-group:first-child { margin-top: 0; padding-top: 0; border-top: 0; }
.size-title {
    display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
    font-size: 14px; font-weight: 700; color: #263247; margin-bottom: 6px;
}
.link-line {
    display: flex; align-items: center; gap: 10px;
    padding: 5px 0; font-size: 13px;
}
.link-line .url {
    flex: 1; min-width: 0; color: #718096;
    word-break: break-all; overflow: hidden;
}

.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table th, .table td { padding: 12px 14px; border-bottom: 1px solid var(--border); text-align: left; }
.table th { color: var(--muted); font-weight: 500; font-size: 13px; background: #fafbfe; }
.table tbody tr:hover { background: #fafbff; }
.table tbody tr:last-child td { border-bottom: none; }

.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 6px;
    border: 1px solid transparent; border-radius: 9px;
    padding: 8px 16px; font-size: 14px; cursor: pointer;
    transition: .18s; font-family: inherit; text-decoration: none;
}
.btn:active { transform: scale(.97); }
.btn:disabled { opacity: .6; cursor: not-allowed; }
.btn:disabled:active { transform: none; }
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); color: #fff; }
.btn-default { background: #fff; border-color: var(--border); color: var(--text); }
.btn-default:hover { border-color: var(--primary); color: var(--primary); }
.btn-danger { background: #fff; border-color: #f5c2c4; color: var(--danger); }
.btn-danger:hover { background: var(--danger); color: #fff; border-color: var(--danger); }
.btn-sm { padding: 5px 12px; font-size: 13px; border-radius: 7px; }
.btn-primary.copied { background: var(--success); }
.btn-row { display: flex; gap: 8px; flex-wrap: wrap; }

.thumb-sm, .size-thumb, .link-thumb img {
    width: 44px; height: 44px; object-fit: cover;
    border-radius: 8px; border: 1px solid var(--border);
    display: block; background: #fafbfe;
}
.thumb-empty {
    width: 44px; height: 44px; border-radius: 8px;
    border: 1px dashed var(--border); background: #fafbfe;
    display: flex; align-items: center; justify-content: center;
    font-size: 11px; color: #b8bfd0;
}
.js-preview { cursor: zoom-in; transition: box-shadow .18s, transform .18s; }
.js-preview:hover { box-shadow: 0 0 0 3px rgba(23, 105, 232, .25); }

.img-cell { width: 64px; text-align: center !important; }
.table td.img-cell, .table th.img-cell { vertical-align: middle; }

.img-preview {
    position: fixed; top: 0; right: 0; bottom: 0; left: 0;
    background: rgba(15, 20, 32, .72);
    display: none; align-items: center; justify-content: center;
    z-index: 9999; cursor: zoom-out;
}
.img-preview.show { display: flex; }
.img-preview img {
    max-width: 88vw; max-height: 88vh; border-radius: 10px;
    background: #fff; box-shadow: 0 12px 40px rgba(0, 0, 0, .45);
}

.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 16px; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field label { font-size: 13px; color: var(--muted); }
.field .hint { font-size: 12px; color: var(--muted); font-weight: 400; }
.input, .select {
    width: 100%; padding: 9px 12px; font-size: 14px;
    border: 1px solid var(--border); border-radius: 9px; background: #fff;
    font-family: inherit; color: var(--text); transition: .18s;
}
.input:focus, .select:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(23, 105, 232, .12); }
.checkbox { display: flex; align-items: center; gap: 8px; font-size: 14px; }

.alert { border-radius: 10px; padding: 12px 16px; font-size: 14px; margin-bottom: 18px; }
.alert-success { background: #e9f8f1; color: var(--success); border: 1px solid #b9e8d3; }
.alert-error { background: #fdefef; color: var(--danger); border: 1px solid #f6c9cb; }
.empty {
    text-align: center; padding: 48px 20px; color: var(--muted);
    background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow);
}

.login-box { max-width: 380px; margin: 80px auto; }

.toast {
    position: fixed; left: 50%; bottom: 30px;
    transform: translateX(-50%) translateY(15px);
    padding: 10px 17px; border-radius: 9px;
    background: #172033; color: #fff; font-size: 13px;
    opacity: 0; pointer-events: none; z-index: 9999;
    transition: opacity .15s ease, transform .15s ease;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

.site-footer { padding: 22px 0; color: var(--muted); font-size: 13px; text-align: center; }

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

@media (max-width: 620px) {
    .top-area { height: 215px; }
    .top-content { padding: 20px 16px 0; }
    .logo-icon { width: 35px; height: 35px; }
    .logo-text { font-size: 16px; }
    .header-date { font-size: 12px; padding-top: 8px; }
    .home-container { margin-top: -92px; padding: 0 14px 40px; }
    .product-grid { grid-template-columns: 1fr; gap: 12px; }
    .product-card { min-height: 175px; padding: 19px; }
    .detail-container { padding: 20px 14px 40px; }
    .detail-header { align-items: flex-start; flex-direction: column; padding: 18px; }
    .link-search .input { max-width: 100%; }
    .link-list { border-radius: 13px; }
    .link-row {
        grid-template-columns: 82px minmax(0, 1fr) 66px;
        gap: 10px; padding: 11px 12px; min-height: 62px;
    }
    .link-thumb { display: none; }
    .link-size { font-size: 12px; }
    .link-url { font-size: 11px; }
    .copy-btn { padding: 7px 5px; font-size: 11px; }
    .card { padding: 16px; }
}

/* 后台列表的图床类型筛选（链接记录 / 链接检测，可切换显示） */
.bed-filter { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin: 0 0 14px; }
.bed-filter-label { font-size: 13px; color: #5b6678; font-weight: 600; }
.bed-filter-btn {
    border: 1px solid #dfe5ed; background: #fff; color: #445066;
    border-radius: 8px; padding: 5px 14px; cursor: pointer;
    font-size: 13px; font-weight: 600; text-decoration: none;
}
.bed-filter-btn:hover { background: #f7faff; border-color: #c9d7ec; }
.bed-filter-btn.active { background: #1769e8; border-color: #1769e8; color: #fff; }

/* 图床切换（首页 / 分类页共用） */
.bed-switch {
    display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
    margin: 14px 0 4px;
}
.bed-label { font-size: 13px; color: #5b6678; font-weight: 600; }
.bed-btn {
    border: 1px solid #dfe5ed; background: #fff; color: #445066;
    border-radius: 8px; padding: 6px 16px; cursor: pointer;
    font-size: 13px; font-weight: 600; font-family: inherit;
    transition: background .12s ease, border-color .12s ease, color .12s ease;
}
.bed-btn:hover { background: #f7faff; border-color: #c9d7ec; }
.bed-btn.active { background: #1769e8; border-color: #1769e8; color: #fff; }
.bed-hint { font-size: 12px; color: #a0a9b8; }

/* 首页蓝底头部内的图床切换：放在 logo 文字下方，分类卡片在头部之外不会遮挡 */
.top-area .bed-switch { margin: 0; }
.top-area .bed-label,
.top-area .bed-hint { color: rgba(255, 255, 255, .85); }
.top-area .bed-btn {
    background: rgba(255, 255, 255, .14);
    border-color: rgba(255, 255, 255, .38);
    color: #fff;
}
.top-area .bed-btn:hover { background: rgba(255, 255, 255, .26); border-color: rgba(255, 255, 255, .55); }
.top-area .bed-btn.active { background: #fff; border-color: #fff; color: #1677ff; }
@media (max-width: 620px) {
    .top-area .bed-hint { display: none; }
    .top-area .bed-btn { padding: 5px 12px; font-size: 12px; }
}
