:root {
    --bg: #eef6ff;
    --bg2: #f7f4f6;
    --card: #ffffff;
    --line: #e2e8f0;
    --text: #1f2937;
    --muted: #6b7280;
    --accent: #5b9cf6;
    --accent2: #7ad3c3;
    --danger: #ef5b67;
    --ok: #22c55e;
    --shadow: 0 12px 40px rgba(91, 156, 246, .16);
    --radius: 18px;
    --font: "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Noto Sans SC", sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
    font-family: var(--font);
    color: var(--text);
    min-height: 100vh;
    background: linear-gradient(180deg, #f6f1f4 0%, #eaf4ff 42%, #dceeff 100%);
}
a { color: var(--accent); text-decoration: none; }
a:hover { color: #3b82f6; }
button, input, textarea, select { font: inherit; }

.topbar, .foot {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 16px 24px;
}
.topbar {
    position: sticky;
    top: 0;
    z-index: 10;
    background: rgba(255,255,255,.78);
    backdrop-filter: blur(16px);
    border-bottom: 1px solid rgba(255,255,255,.6);
}
.brand { display: flex; align-items: center; gap: 12px; color: inherit; }
.brand small { display: block; color: var(--muted); font-size: 12px; }
.logo {
    width: 40px; height: 40px; border-radius: 12px;
    display: grid; place-items: center;
    background: linear-gradient(135deg, #7ad3c3, #5b9cf6);
    color: #fff; font-weight: 800;
}
.topbar nav { display: flex; gap: 8px; }
.topbar nav a, .btn {
    display: inline-flex; align-items: center; justify-content: center;
    padding: 8px 14px; border-radius: 999px;
    border: 1px solid var(--line); color: var(--text);
    background: #fff; cursor: pointer;
}
.btn.primary, .pill.solid {
    background: linear-gradient(135deg, #5b9cf6, #3b82f6);
    border-color: transparent; color: #fff; font-weight: 700;
}
.btn.ghost { background: transparent; }
.btn.danger { border-color: #fecaca; color: var(--danger); background: #fff; }
.wrap { max-width: 980px; margin: 0 auto; padding: 24px 18px 80px; }
.page-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 12px; margin-bottom: 18px; }
.page-head h1 { margin: 0; }
.page-head p { margin: 6px 0 0; color: var(--muted); }
.stats {
    display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-bottom: 18px;
}
.stats.wide { grid-template-columns: repeat(4, 1fr); }
.stats > div, .panel, .empty, .login-card, .card, .info, .stage {
    background: var(--card); border: 1px solid #edf2f7; border-radius: var(--radius); padding: 16px;
    box-shadow: var(--shadow);
}
.stats b { display: block; font-size: 24px; }
.stats span, .muted { color: var(--muted); }
.toolbar { display: flex; gap: 12px; align-items: center; margin-bottom: 18px; flex-wrap: wrap; }
input, textarea, select {
    width: 100%; background: #fff; border: 1px solid var(--line);
    color: var(--text); border-radius: 12px; padding: 10px 12px;
}
.toolbar input { max-width: 360px; }
.chips { display: flex; gap: 8px; }
.chip, .pill {
    padding: 8px 14px; border-radius: 999px; border: 0;
    background: #fff; color: #4b5563; box-shadow: 0 6px 16px rgba(15,23,42,.08);
    cursor: pointer;
}
.chip.on, .pager a.on { background: #5b9cf6; color: #fff; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 16px; }
.card { padding: 0; overflow: hidden; color: inherit; display: block; transition: transform .15s ease; }
.card:hover { transform: translateY(-3px); }
.thumb { height: 160px; background: #f1f5f9; display: grid; place-items: center; position: relative; overflow: hidden; }
.thumb img { width: 100%; height: 100%; object-fit: cover; }
.thumb .glyph { font-size: 36px; color: var(--accent); }
.badge {
    position: absolute; top: 10px; left: 10px; font-size: 11px;
    background: rgba(255,255,255,.86); padding: 3px 8px; border-radius: 999px;
}
.meta { padding: 12px 14px; }
.meta strong { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.meta small { color: var(--muted); }
.empty, .login-card { max-width: 520px; margin: 40px auto; text-align: center; }
.pager { display: flex; gap: 8px; margin-top: 24px; flex-wrap: wrap; }
.pager a { padding: 6px 10px; border: 1px solid var(--line); border-radius: 8px; color: inherit; background: #fff; }
.preview { display: grid; grid-template-columns: 1.4fr .8fr; gap: 22px; }
.stage { min-height: 360px; display: grid; place-items: center; overflow: hidden; }
.stage img, .stage video { max-width: 100%; max-height: 72vh; }
.info h1 { margin-top: 0; font-size: 22px; word-break: break-all; }
.kv { list-style: none; padding: 0; margin: 0 0 16px; }
.kv li { display: flex; justify-content: space-between; gap: 12px; padding: 8px 0; border-bottom: 1px solid var(--line); }
.kv span { color: var(--muted); }
.copy-row { display: flex; gap: 8px; margin: 6px 0 14px; }
.copy-row input { flex: 1; }
label { display: block; margin: 10px 0 6px; color: var(--muted); font-size: 13px; }
.alert { padding: 12px 14px; border-radius: 12px; margin: 0 auto 16px; max-width: 520px; }
.alert.ok { background: #ecfdf5; color: #047857; }
.alert.err { background: #fef2f2; color: #b91c1c; }
.foot { color: var(--muted); font-size: 13px; }

body.is-hub {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}
.hub {
    position: relative;
    width: min(560px, calc(100% - 28px));
    margin: 18px auto 40px;
    padding-bottom: 80px;
}
.planets { position: absolute; left: 0; top: 8px; width: 88px; height: 64px; pointer-events: none; }
.p { position: absolute; border-radius: 50%; display: block; }
.p1 { width: 18px; height: 18px; left: 8px; top: 18px; background: radial-gradient(circle at 30% 30%, #fbbf24, #b45309); box-shadow: 0 0 0 4px rgba(251,191,36,.15); }
.p2 { width: 22px; height: 22px; left: 34px; top: 8px; background: radial-gradient(circle at 35% 30%, #93c5fd, #1d4ed8); }
.p3 { width: 12px; height: 12px; left: 22px; top: 2px; background: radial-gradient(circle at 30% 30%, #fdba74, #9a3412); }
.star { position: absolute; width: 4px; height: 4px; background: #fde68a; transform: rotate(45deg); }
.s1 { left: 4px; top: 8px; }
.s2 { left: 58px; top: 4px; }
.s3 { left: 70px; top: 28px; width: 3px; height: 3px; }
.hub-tools { display: flex; justify-content: flex-end; align-items: center; gap: 10px; }
.icon-btn {
    width: 40px; height: 40px; border: 0; border-radius: 999px; background: #fff;
    box-shadow: 0 8px 20px rgba(15,23,42,.08); cursor: pointer; color: #64748b; font-size: 18px;
}
.more { position: relative; }
.more-menu {
    position: absolute; right: 0; top: 48px; background: #fff; border-radius: 14px;
    box-shadow: var(--shadow); min-width: 140px; padding: 8px; z-index: 5;
}
.more-menu a { display: block; padding: 8px 10px; color: var(--text); border-radius: 8px; }
.more-menu a:hover { background: #f1f5f9; }
.hub-title {
    text-align: center; font-size: 34px; margin: 42px 0 28px; font-weight: 700; letter-spacing: -.02em;
}
.hub-title span { color: #7ad3c3; margin-right: 8px; }
.hub-form { margin-bottom: 18px; }
#file { position: absolute; width: 1px; height: 1px; opacity: 0; overflow: hidden; }
.dropzone {
    display: grid; place-items: center; gap: 10px;
    min-height: 168px; padding: 22px;
    border: 2px dashed #8ec5ff; border-radius: 22px;
    color: #5b9cf6; text-align: center; cursor: pointer; background: rgba(255,255,255,.28);
}
.dropzone p { margin: 0; font-size: 16px; }
.dropzone b { font-weight: 800; }
.dropzone small { color: #94a3b8; }
.dropzone.over { background: rgba(91,156,246,.12); border-color: #3b82f6; }
.dropzone.busy { opacity: .7; }
.cam { display: grid; place-items: center; }
.pending { margin-top: 14px; display: grid; gap: 10px; }
.pending-item {
    display: grid; grid-template-columns: 72px 1fr auto; gap: 12px; align-items: center;
    background: #fff; border-radius: 16px; padding: 10px; box-shadow: var(--shadow);
}
.pending-item img, .pending-item video {
    width: 72px; height: 72px; object-fit: cover; border-radius: 12px; background: #f1f5f9;
}
.pending-item .file-chip {
    width: 72px; height: 72px; border-radius: 12px; display: grid; place-items: center;
    background: #eef2ff; color: #4338ca; font-weight: 700;
}
.pending-item strong { display: block; word-break: break-all; }
.pending-item small { color: var(--muted); }
.status { font-size: 12px; color: #5b9cf6; }
.status.err { color: var(--danger); }

.board {
    background: #fff; border-radius: 24px; padding: 16px 14px 18px;
    box-shadow: var(--shadow);
}
.board[hidden], .pending[hidden], .sheet[hidden], .more-menu[hidden] { display: none !important; }
.board-bar {
    display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 12px;
}
.counts { display: flex; gap: 10px; color: #64748b; font-size: 15px; font-weight: 700; }
.counts .ok { color: #16a34a; }
.counts .bad { color: #ef4444; }
.board-actions {
    display: flex; background: #5b9cf6; border-radius: 999px; overflow: hidden; color: #fff;
}
.board-actions button {
    width: 48px; height: 36px; border: 0; background: transparent; color: inherit; cursor: pointer;
    display: grid; place-items: center;
}
.board-actions button + button { border-left: 1px solid rgba(255,255,255,.28); }
.item {
    border: 1px solid #e8eef6; border-radius: 18px; padding: 12px;
    display: grid; grid-template-columns: 64px 1fr 44px; gap: 10px 12px; align-items: start;
}
.item + .item { margin-top: 12px; }
.item .name { grid-column: 1 / -1; text-align: center; font-weight: 700; word-break: break-all; }
.item .thumb-mini {
    width: 64px; height: 64px; border-radius: 8px; object-fit: cover; background: #e5e7eb;
}
.item .links { display: grid; gap: 6px; }
.link-row { display: grid; grid-template-columns: 88px 1fr; gap: 6px; align-items: center; }
.link-row span {
    background: #eaf3ff; color: #3b82f6; border-radius: 8px; font-size: 12px; font-weight: 700;
    padding: 6px 8px; text-align: center;
}
.link-row input {
    height: 32px; padding: 0 8px; border-radius: 8px; background: #f8fafc; font-size: 12px; color: #94a3b8;
}
.item-ops { display: grid; gap: 10px; justify-items: center; padding-top: 4px; }
.round {
    width: 38px; height: 38px; border: 0; border-radius: 50%; color: #fff; cursor: pointer;
    display: grid; place-items: center;
}
.round.copy { background: #5b9cf6; }
.round.del { background: #ef5b67; }
.fab {
    position: fixed; right: 18px; bottom: 22px; width: 52px; height: 52px; border: 0; border-radius: 16px;
    background: #fff; box-shadow: 0 10px 30px rgba(15,23,42,.12); cursor: pointer;
    display: grid; place-items: center; gap: 4px;
}
.fab span { width: 18px; height: 2px; background: #94a3b8; display: block; border-radius: 2px; }
.sheet {
    position: fixed; inset: 0; background: rgba(15,23,42,.28); display: grid; place-items: center; z-index: 20; padding: 20px;
}
.sheet-card { background: #fff; border-radius: 20px; padding: 22px; max-width: 420px; width: 100%; box-shadow: var(--shadow); }
.sheet-card ol { color: var(--muted); line-height: 1.8; }
.toast {
    position: fixed;
    left: 50%;
    top: 18%;
    transform: translate(-50%, -8px);
    background: rgba(31, 41, 55, .88);
    color: #fff;
    padding: 10px 18px;
    border-radius: 999px;
    font-size: 14px;
    z-index: 80;
    opacity: 0;
    pointer-events: none;
    transition: opacity .18s ease, transform .18s ease;
    box-shadow: 0 10px 30px rgba(15, 23, 42, .18);
}
.toast.show {
    opacity: 1;
    transform: translate(-50%, 0);
}
.toast.err { background: rgba(185, 28, 28, .92); }

.admin-shell { display: grid; grid-template-columns: 240px 1fr; min-height: 100vh; }
body.is-admin {
    background: linear-gradient(180deg, #f8fafc, #eef2ff);
}
.sidenav { background: #fff; border-right: 1px solid var(--line); padding: 20px; }
.sidenav nav { display: grid; gap: 6px; margin-top: 24px; }
.sidenav nav a { padding: 10px 12px; border-radius: 10px; color: var(--muted); }
.sidenav nav a.on, .sidenav nav a:hover { background: #eff6ff; color: var(--text); }
.admin-main { padding: 28px; }
.two { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.panel h2 { margin-top: 0; }
.list { list-style: none; padding: 0; margin: 0; }
.list li { padding: 8px 0; border-bottom: 1px solid var(--line); }
.table-wrap { overflow: auto; border: 1px solid var(--line); border-radius: 16px; background: #fff; }
table { width: 100%; border-collapse: collapse; }
th, td { padding: 10px 12px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: middle; }
.mini { width: 48px; height: 36px; object-fit: cover; border-radius: 6px; }
.form-grid { max-width: 680px; }
.help { color: var(--muted); font-size: 13px; }
.check { display: flex; align-items: center; gap: 8px; color: var(--text); }
.check input { width: auto; }
.row-actions { display: flex; gap: 8px; margin: 12px 0; }
.code { background: #f8fafc; padding: 12px; border-radius: 10px; overflow: auto; font-size: 12px; }
.ok-line { color: var(--ok); }
.err-line { color: var(--danger); }
.who { margin-top: 24px; color: var(--muted); font-size: 12px; }
.file-icon { text-align: center; padding: 40px; }
.file-icon span { display: inline-block; background: #eaf3ff; color: #3b82f6; padding: 8px 14px; border-radius: 10px; margin-bottom: 12px; }
.inline { display: flex; gap: 8px; }
.inline input { width: 220px; }
.howto { margin-top: 32px; }
.howto ol { color: var(--muted); line-height: 1.8; }

@media (max-width: 900px) {
    .hero, .preview, .two, .admin-shell, .stats, .stats.wide { grid-template-columns: 1fr; }
    .sidenav { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; }
    .sidenav nav { display: flex; flex-wrap: wrap; margin: 0; }
    .topbar { flex-wrap: wrap; }
    .hub-title { font-size: 28px; margin-top: 52px; }
    .item { grid-template-columns: 56px 1fr 40px; }
    .link-row { grid-template-columns: 76px 1fr; }
}
