:root {
    --bg: #f3efe7;
    --ink: #1c1915;
    --muted: #6f685e;
    --line: #e3dcd0;
    --card: #fffdf9;
    --accent: #9d3b2c;
    --accent-ink: #fffaf6;
    --ok: #1d6b45;
    --danger: #8d2f2f;
    --shadow: 0 12px 40px rgba(48, 36, 22, 0.06);
    color-scheme: light;
}

* { box-sizing: border-box; }

[hidden] { display: none !important; }

body {
    margin: 0;
    min-height: 100vh;
    background: var(--bg);
    color: var(--ink);
    font: 16px/1.5 "PingFang SC", "Hiragino Sans GB", "Noto Sans SC", "Microsoft YaHei", sans-serif;
}

a { color: inherit; }

button, input, select { font: inherit; }

:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

.topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 16px 20px;
    background: #1c1915;
    color: #f6f1e8;
}

.brand {
    color: inherit;
    font-weight: 700;
    text-decoration: none;
    letter-spacing: 0.04em;
}

.topnav, .gallery-title {
    display: flex;
    align-items: center;
    gap: 14px;
}

.topnav a, .linkish {
    color: inherit;
    text-decoration: none;
}

.nav-strong { font-weight: 700; }

.linkish {
    background: none;
    border: 0;
    padding: 0;
    cursor: pointer;
}

.who { color: #d9d0c3; }

.wrap {
    width: min(960px, calc(100% - 32px));
    margin: 28px auto 64px;
}

.is-gallery .wrap {
    width: min(1200px, calc(100% - 16px));
    margin-top: 16px;
}

.hero, .panel {
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: 20px;
    box-shadow: var(--shadow);
    padding: 24px;
}

.hero h1, .page-head h1, .panel h1 {
    margin: 0 0 8px;
    font-size: 34px;
    line-height: 1.2;
    letter-spacing: -0.03em;
}

.panel h2, .page-head h1 { font-size: 28px; }

.eyebrow {
    margin: 0 0 6px;
    color: var(--accent);
    font-size: 13px;
    letter-spacing: 0.08em;
}

.lede, .hint, .foot-note, .when {
    color: var(--muted);
}

.lede { margin-top: 0; }

.row, .manage-actions, .split {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.split > * { flex: 1 1 220px; }

.stack { display: grid; gap: 14px; }

.field { display: grid; gap: 6px; }

.field span, .check { font-size: 14px; }

input[type="text"], input[type="password"], input[type="datetime-local"], select {
    width: 100%;
    min-height: 44px;
    padding: 8px 12px;
    border: 1px solid #d9d0c3;
    border-radius: 12px;
    background: #fff;
    color: var(--ink);
}

.button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 44px;
    padding: 0 16px;
    border: 0;
    border-radius: 999px;
    background: var(--accent);
    color: var(--accent-ink);
    text-decoration: none;
    cursor: pointer;
}

.button-secondary {
    background: transparent;
    color: var(--ink);
    border: 1px solid #cfc6b8;
}

.button-danger {
    background: transparent;
    color: var(--danger);
    border: 1px solid #e3c2c2;
}

.button-small { min-height: 36px; padding: 0 12px; font-size: 14px; }

.check { display: flex; align-items: center; gap: 8px; }

.field small, .error { color: var(--danger); }

.hint { margin: 8px 0 0; font-size: 13px; }

.status, .warn, .empty {
    padding: 12px 14px;
    border-radius: 12px;
}

.status { background: #e7f5ee; color: var(--ok); }

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

.warn, .empty { background: #fff; border: 1px dashed var(--line); }

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

.back { margin: 0 0 8px; }

.back a { color: var(--muted); }

.event-list, .manage-grid, .share-grid {
    display: grid;
    gap: 12px;
    margin-top: 16px;
}

.share-grid { grid-template-columns: 1.4fr 0.8fr; }

.event-card {
    display: flex;
    gap: 14px;
    align-items: center;
    padding: 12px;
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: 16px;
    text-decoration: none;
}

.event-card img, .event-mark {
    width: 72px;
    height: 72px;
    border-radius: 12px;
    object-fit: cover;
    flex: none;
}

.event-mark {
    display: grid;
    place-items: center;
    background: #1c1915;
    color: #f6f1e8;
    font-size: 28px;
}

.event-copy { display: grid; }

.event-copy span { color: var(--muted); font-size: 14px; }

.link-line {
    padding: 10px 12px;
    border-radius: 12px;
    background: #f6f1e8;
    word-break: break-all;
}

#qrcode {
    width: 184px;
    min-height: 184px;
    padding: 8px;
    background: white;
    border-radius: 12px;
}

#qrcode img, #qrcode canvas { display: block; }

.upload-zone {
    position: relative;
    display: grid;
    place-items: center;
    min-height: 112px;
    margin-bottom: 12px;
    padding: 16px;
    border: 1.5px dashed #cfc6b8;
    border-radius: 16px;
    background: #faf7f2;
    text-align: center;
    cursor: pointer;
}

.upload-zone.is-over { border-color: var(--accent); background: #fff; }

.upload-zone input {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
}

.manage-grid { grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); }

.manage-photo {
    position: relative;
    padding: 8px;
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: 16px;
}

.manage-photo img {
    width: 100%;
    aspect-ratio: 1;
    object-fit: cover;
    border-radius: 10px;
    background: #ebe4d8;
}

.manage-photo.is-hidden img { opacity: 0.45; }

.flag {
    position: absolute;
    top: 16px;
    left: 16px;
    padding: 2px 8px;
    border-radius: 999px;
    background: #1c1915;
    color: white;
    font-size: 12px;
}

.manage-meta, .gallery-count {
    display: flex;
    justify-content: space-between;
    color: var(--muted);
    font-size: 13px;
}

.live {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 14px;
}

.live i {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #3ddc84;
    box-shadow: 0 0 0 0 rgba(61, 220, 132, 0.7);
    animation: pulse 1.8s infinite;
}

@keyframes pulse {
    70% { box-shadow: 0 0 0 8px rgba(61, 220, 132, 0); }
    100% { box-shadow: 0 0 0 0 rgba(61, 220, 132, 0); }
}

.waterfall {
    columns: 2;
    column-gap: 8px;
}

.shot {
    display: block;
    margin: 0 0 8px;
    break-inside: avoid;
}

.shot img {
    width: 100%;
    height: auto;
    display: block;
    border-radius: 10px;
    background: #e7e1d6;
}

.lightbox {
    position: fixed;
    inset: 0;
    z-index: 30;
    display: grid;
    place-items: center;
    padding: 48px 56px;
    background: rgba(18, 16, 14, 0.94);
}

.lightbox[hidden] { display: none; }

.lightbox figure { margin: 0; max-width: 100%; text-align: center; }

.lightbox img {
    max-width: 100%;
    max-height: calc(100vh - 96px);
    object-fit: contain;
}

.lightbox figcaption { margin-top: 8px; color: #f6f1e8; font-size: 13px; }

.lightbox-close, .lightbox-nav {
    position: absolute;
    min-height: 40px;
    padding: 0 12px;
    border: 0;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.14);
    color: white;
    cursor: pointer;
}

.lightbox-close { top: 12px; right: 12px; }

.lightbox-nav.prev { left: 12px; top: 50%; }

.lightbox-nav.next { right: 12px; top: 50%; }

body.lightbox-open { overflow: hidden; }

@media (min-width: 800px) {
    .waterfall { columns: 4; }
}

.screen {
    margin: 0;
    min-height: 100vh;
    background: #111;
    color: white;
    display: grid;
    place-items: center;
}

.screen-title { position: fixed; top: 16px; left: 20px; }

.screen img { max-width: 100vw; max-height: 100vh; object-fit: contain; }

.tabs, .filter-row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin: 12px 0; }

.tabs a, .chip {
    padding: 6px 12px;
    border-radius: 999px;
    background: white;
    text-decoration: none;
    border: 1px solid var(--line);
}

.chip.is-on { background: var(--ink); color: white; }

.bib-field { margin: 0; min-width: 120px; }

.shot { position: relative; }

.block { margin-top: 28px; }

.video-card video, .live-player, .post-image { width: 100%; border-radius: 12px; background: #111; }

.layout-grid { columns: auto; display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }

.layout-grid .shot { margin: 0; }

.layout-grid .shot img { aspect-ratio: 1; object-fit: cover; }

.layout-timeline { columns: 1; max-width: 560px; margin: 0 auto; }

.module-row input, .module-row select { min-height: 40px; border: 1px solid #d9d0c3; border-radius: 12px; padding: 0 10px; }

/* 控制台通用 */
input[type="email"], input[type="tel"], input[type="number"], input[type="date"], input[type="url"], input[type="color"], textarea {
    width: 100%;
    min-height: 44px;
    padding: 8px 12px;
    border: 1px solid #d9d0c3;
    border-radius: 12px;
    background: #fff;
    color: var(--ink);
    font: inherit;
}

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

.topnav a.is-on { color: #fff; text-decoration: underline; text-underline-offset: 6px; }

.topnav a:not(.is-on), .topnav .linkish { color: #d9d0c3; }

.panel + .panel, .panel + section, section + .panel { margin-top: 16px; }

.section-title { margin: 28px 0 12px; font-size: 20px; }

.subnav { display: flex; gap: 6px; flex-wrap: wrap; margin: 0 0 18px; }

.subnav a {
    padding: 8px 14px;
    border-radius: 999px;
    border: 1px solid var(--line);
    background: var(--card);
    text-decoration: none;
    font-size: 14px;
}

.subnav a.is-on { background: var(--ink); border-color: var(--ink); color: #fff; }

.tag {
    display: inline-flex;
    align-items: center;
    padding: 2px 8px;
    border-radius: 999px;
    background: #efe8dc;
    color: var(--muted);
    font-size: 12px;
    white-space: nowrap;
}

.tag-ok { background: #e3f3ea; color: var(--ok); }

.tag-warn { background: #fbecd9; color: #8a5a12; }

.tag-danger { background: #f6e1e1; color: var(--danger); }

.tag-dark { background: var(--ink); color: #fff; }

.meter { height: 10px; border-radius: 999px; background: #ebe4d8; overflow: hidden; }

.meter > span { display: block; height: 100%; border-radius: inherit; background: var(--accent); }

.meter.is-full > span { background: var(--danger); }

.stats { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 12px; margin: 0 0 16px; }

.stat { padding: 16px; background: var(--card); border: 1px solid var(--line); border-radius: 16px; }

.stat b { display: block; font-size: 26px; line-height: 1.2; letter-spacing: -0.02em; }

.stat span { color: var(--muted); font-size: 13px; }

.table-wrap { overflow-x: auto; background: var(--card); border: 1px solid var(--line); border-radius: 16px; }

.table { width: 100%; border-collapse: collapse; font-size: 14px; }

.table th, .table td { padding: 10px 12px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }

.table th { color: var(--muted); font-weight: 500; white-space: nowrap; background: #faf6ef; }

.table tr:last-child td { border-bottom: 0; }

.table td.num, .table th.num { text-align: right; white-space: nowrap; }

.inline-form { display: inline-flex; gap: 6px; align-items: center; flex-wrap: wrap; margin: 0; }

.inline-form input, .inline-form select { min-height: 36px; width: auto; padding: 4px 10px; font-size: 14px; }

.toolbar { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin: 0 0 14px; }

.toolbar input[type="search"], .toolbar select {
    min-height: 40px;
    padding: 6px 12px;
    border: 1px solid #d9d0c3;
    border-radius: 12px;
    background: #fff;
    font: inherit;
}

.toolbar input[type="search"] { min-width: 220px; }

.kv { display: grid; grid-template-columns: 110px 1fr; gap: 8px 14px; margin: 0; font-size: 14px; }

.kv dt { color: var(--muted); }

.kv dd { margin: 0; word-break: break-all; }

.ftp-failures { margin: 6px 0 0; padding-left: 18px; font-size: 13px; color: var(--muted); }

.ftp-failures li + li { margin-top: 4px; }

.lock-note { color: #8a5a12; font-size: 13px; }

.lock-note a { color: inherit; }

.danger-zone { border-color: #e9c9c9; }

.pagination { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; margin: 18px 0 0; }

.pagination a, .pagination span {
    min-width: 36px;
    padding: 6px 10px;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: var(--card);
    text-align: center;
    text-decoration: none;
    font-size: 14px;
}

.pagination .is-current { background: var(--ink); border-color: var(--ink); color: #fff; }

.pagination .is-disabled { color: #b5ab9c; }

.price { font-size: 32px; font-weight: 700; letter-spacing: -0.03em; }

.price del { margin-left: 8px; color: var(--muted); font-size: 15px; font-weight: 400; }

.pay-box { display: grid; gap: 12px; padding: 16px; border: 1px dashed #cfc6b8; border-radius: 16px; background: #fffdfa; }

/* 管理后台 */
.admin { display: grid; grid-template-columns: 200px 1fr; min-height: calc(100vh - 56px); }

.admin-side { padding: 18px 12px; border-right: 1px solid var(--line); background: #ece6db; }

.admin-side a {
    display: flex;
    justify-content: space-between;
    padding: 9px 12px;
    border-radius: 10px;
    color: var(--ink);
    text-decoration: none;
    font-size: 14px;
}

.admin-side a.is-on { background: var(--ink); color: #fff; }

.admin-side .side-label { margin: 14px 12px 6px; color: var(--muted); font-size: 12px; letter-spacing: 0.08em; }

.admin-main { min-width: 0; padding: 24px clamp(16px, 3vw, 36px) 64px; }

.admin-main h1 { margin: 0 0 16px; font-size: 26px; }

/* 观众页补充 */
.time-head {
    break-inside: avoid;
    column-span: all;
    margin: 14px 0 8px;
    color: var(--muted);
    font-size: 13px;
    font-weight: 600;
    letter-spacing: 0.04em;
}

.layout-grid .time-head { grid-column: 1 / -1; }

.shot .pin {
    position: absolute;
    top: 8px;
    left: 8px;
    padding: 1px 8px;
    border-radius: 999px;
    background: rgba(28, 25, 21, 0.78);
    color: #fff;
    font-size: 12px;
}

.load-more { display: flex; justify-content: center; margin: 12px 0 4px; }

.lightbox-tools { display: flex; gap: 10px; justify-content: center; margin-top: 10px; }

.lightbox-tools a, .lightbox-tools button {
    min-height: 36px;
    padding: 0 14px;
    border: 0;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.16);
    color: #fff;
    font-size: 14px;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    cursor: pointer;
}

.platform-badge { margin: 36px 0 0; color: var(--muted); font-size: 12px; text-align: center; }

.platform-badge a { color: inherit; }

.video-card + .video-card { margin-top: 16px; }

.report-sheet { position: fixed; inset: auto 0 0 0; z-index: 40; max-height: 80vh; overflow: auto; padding: 20px; background: var(--card); border-radius: 20px 20px 0 0; box-shadow: 0 -12px 40px rgba(0, 0, 0, 0.2); }

.report-sheet[hidden] { display: none; }

@media (max-width: 860px) {
    .admin { grid-template-columns: 1fr; }
    .admin-side { display: flex; gap: 4px; overflow-x: auto; padding: 8px; border-right: 0; border-bottom: 1px solid var(--line); }
    .admin-side .side-label { display: none; }
    .admin-side a { flex: none; }
}

@media (max-width: 720px) {
    .hero h1 { font-size: 28px; }
    .share-grid { grid-template-columns: 1fr; }
    .lightbox { padding: 56px 12px; }
    .lightbox-nav.prev, .lightbox-nav.next { top: auto; bottom: 12px; }
    .layout-grid { grid-template-columns: repeat(2, 1fr); }
    .kv { grid-template-columns: 90px 1fr; }
    .topnav { gap: 10px; font-size: 14px; }
}

/* 活动创建与工作台 */
.console-head, .wizard-heading, .list-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
}

.console-head h1, .wizard-heading h2, .list-heading h2 { margin: 0; }

.create-wizard {
    margin: 24px 0 32px;
    padding: clamp(20px, 4vw, 38px);
    border-radius: 24px;
    background: var(--card);
    border: 1px solid var(--line);
    box-shadow: var(--shadow);
}

.create-wizard[hidden], .wizard-step[hidden] { display: none; }

.wizard-progress {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0;
    margin: 26px 0 30px;
    padding: 0;
    list-style: none;
}

.wizard-progress li {
    display: flex;
    align-items: center;
    gap: 8px;
    color: #aaa095;
    font-size: 13px;
}

.wizard-progress li::after { content: ""; height: 1px; flex: 1; background: var(--line); }
.wizard-progress li:last-child::after { display: none; }
.wizard-progress b { display: grid; place-items: center; width: 28px; height: 28px; border-radius: 50%; background: #ebe5db; }
.wizard-progress .is-on { color: var(--ink); }
.wizard-progress .is-on b { background: var(--ink); color: #fff; }

.wizard-step { margin: 0; padding: 0; border: 0; }
.wizard-step legend { margin-bottom: 4px; padding: 0; font-size: 23px; font-weight: 700; }
.scene-picker { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-top: 18px; }
.scene-option input, .skin-option input { position: absolute; opacity: 0; pointer-events: none; }
.scene-option > span, .skin-option > span { display: grid; gap: 4px; padding: 18px; border: 1px solid var(--line); border-radius: 16px; cursor: pointer; }
.scene-option small, .skin-option small { color: var(--muted); }
.scene-option input:checked + span, .skin-option input:checked + span { border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); }
.skin-picker { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.skin-option i { display: block; height: 82px; margin-bottom: 8px; border-radius: 10px; background: #f3ede3; }
.skin-dark i { background: #171717; }
.wizard-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 22px; }
.wizard-actions .button, .console-head .button { flex: none; white-space: nowrap; }
.field small.hint { color: var(--muted); }
.list-heading { margin: 28px 0 10px; }
.list-heading span { color: var(--muted); font-size: 14px; }

.event-nav {
    position: sticky;
    top: 8px;
    z-index: 20;
    display: flex;
    gap: 4px;
    margin: 0 0 18px;
    padding: 6px;
    overflow-x: auto;
    border: 1px solid var(--line);
    border-radius: 999px;
    background: rgba(255, 253, 249, 0.94);
    backdrop-filter: blur(12px);
}

.event-nav a { flex: none; padding: 8px 13px; border-radius: 999px; text-decoration: none; font-size: 13px; }
.event-nav a:hover { background: #eee7dc; }

.upload-list { display: grid; gap: 6px; margin-top: 12px; }
.upload-item { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; gap: 10px; align-items: center; padding: 9px 12px; border-radius: 10px; background: #f7f3ed; font-size: 13px; }
.upload-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.upload-state { color: var(--muted); }
.upload-item[data-state="success"] .upload-state { color: var(--ok); }
.upload-item[data-state="failed"] .upload-state { color: var(--danger); }

/* 观众相册：主视觉、吸顶分类、无卡片照片墙 */
.gallery-hero {
    position: relative;
    min-height: clamp(260px, 50vw, 520px);
    display: flex;
    align-items: flex-end;
    padding: clamp(22px, 5vw, 56px);
    overflow: hidden;
    background: var(--gallery-cover, linear-gradient(135deg, #765341, #221b18)) center / cover no-repeat;
    color: #fff;
}

.gallery-hero-shade { position: absolute; inset: 0; background: linear-gradient(180deg, rgba(0,0,0,.08) 20%, rgba(0,0,0,.78)); }
.gallery-hero-copy { position: relative; z-index: 1; display: grid; gap: 7px; }
.gallery-name { color: #fff; font-size: clamp(28px, 5vw, 52px); font-weight: 700; line-height: 1.1; text-decoration: none; letter-spacing: -.03em; }
.gallery-meta { color: rgba(255,255,255,.75); }
.gallery-screen-link { position: absolute; z-index: 2; top: 18px; right: 18px; padding: 8px 13px; border: 1px solid rgba(255,255,255,.45); border-radius: 999px; color: #fff; text-decoration: none; font-size: 13px; backdrop-filter: blur(8px); }
.demo-badge { display: inline-flex; width: fit-content; padding: 4px 9px; border-radius: 999px; background: rgba(255,255,255,.18); color: #fff; font-size: 12px; }
.gallery-tabs { flex-wrap: nowrap; overflow-x: auto; }
.gallery-tabs a { flex: none; border: 0; background: transparent; }
.album-bar { position: sticky; top: 0; z-index: 15; display: flex; gap: 20px; margin: 0 0 2px; overflow-x: auto; background: var(--bg); scrollbar-width: none; }
.album-bar::-webkit-scrollbar { display: none; }
.album-bar a { flex: none; padding: 12px 0 10px; border-bottom: 2px solid transparent; color: var(--muted); font-size: 15px; text-decoration: none; white-space: nowrap; }
.album-bar a.is-on { border-color: var(--accent); color: var(--ink); font-weight: 600; }
.is-gallery .waterfall { column-gap: 2px; }
.is-gallery .shot { margin-bottom: 2px; }
.is-gallery .shot img { border-radius: 0; }

.gallery-skin-dark { --bg: #111; --ink: #f5f3ef; --muted: #aaa49c; --line: #333; --card: #1b1b1b; color-scheme: dark; }
.gallery-skin-dark .gallery-tabs, .gallery-skin-dark .tabs a, .gallery-skin-dark .chip { background: #111; color: #eee; }
.gallery-skin-dark .chip.is-on { background: #eee; color: #111; }
.gallery-skin-dark input, .gallery-skin-dark textarea, .gallery-skin-dark select { background: #222; color: #fff; border-color: #444; }

@media (max-width: 720px) {
    .scene-picker { grid-template-columns: 1fr 1fr; }
    .wizard-progress span { display: none; }
    .event-nav { border-radius: 14px; }
    .gallery-hero { min-height: 330px; }
    .is-gallery .wrap { width: 100%; margin-top: 0; }
    .is-gallery .wrap > :not(#photos):not(.gallery-tabs):not(.warn):not(.platform-badge):not(.lightbox):not(.report-sheet) { margin-left: 12px; margin-right: 12px; }
    .is-gallery #photos > :not(.waterfall):not(.album-bar) { margin-left: 12px; margin-right: 12px; }
    .album-bar { padding: 0 12px; }
}
