/* GalleryApp — 排版对齐手绘草图；配色为常规风格（非仿黑白线框） */

:root {
  --bg: #f2f4f7;
  --card: #ffffff;
  --ink: #1f2329;
  --sub: #838a94;
  --line: #e4e7ec;
  --line-strong: #cfd5dd;
  --accent: #2f6bff;
  --accent-soft: #eaf1ff;
  --danger: #e5484d;
  --ok: #1f9d61;
  --radius: 12px;
  --fs: 16px;
  --shadow: 0 1px 3px rgba(20, 24, 32, .06);
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
[hidden] { display: none !important; }

img {
  -webkit-touch-callout: none;
  -webkit-user-drag: none;
  -khtml-user-drag: none;
  -moz-user-drag: none;
  user-select: none;
  -webkit-user-select: none;
}

html, body {
  margin: 0; padding: 0;
  background: var(--bg); color: var(--ink);
  font-size: var(--fs);
  touch-action: pan-x pan-y;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", "Segoe UI", Roboto, sans-serif;
  line-height: 1.5;
}
#app { min-height: 100vh; }
a { color: var(--accent); text-decoration: none; }

/* ---------- 基础控件（形状对齐草图的方框） ---------- */
button {
  font: inherit; cursor: pointer;
  border: 1.5px solid var(--accent);
  border-radius: 10px;
  padding: 11px 16px;
  background: var(--accent); color: #fff;
  box-shadow: var(--shadow);
  transition: transform .12s ease, background .18s ease, color .18s ease, opacity .18s ease, box-shadow .18s ease;
}
button:active { transform: scale(.96); }
button.primary { background: var(--accent); color: #fff; border-color: var(--accent); }
button.outline, button.plain { background: #fff; color: var(--ink); border-color: var(--line-strong); }
button.ghost { background: var(--accent-soft); color: var(--accent); border-color: transparent; }
button.danger { background: #fff; color: var(--danger); border-color: var(--danger); }
button.small { padding: 6px 12px; font-size: .82em; border-radius: 8px; }
button.icon { padding: 6px 12px; font-size: .92em; background: #fff; color: var(--ink); border-color: var(--line-strong); }
button:disabled { opacity: .5; transform: none; cursor: not-allowed; }

input, select, textarea {
  font: inherit; width: 100%;
  padding: 11px 14px;
  border: 1.5px solid var(--line-strong);
  border-radius: 10px;
  background: #fff; color: var(--ink);
  outline: none;
  transition: border-color .18s ease, box-shadow .18s ease;
}
input:focus, select:focus, textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
label.field { display: block; margin-bottom: 14px; }
label.field > span { display: block; font-size: .82em; color: var(--sub); margin-bottom: 6px; }

/* ---------- 页头： ‹返回 | 标题 ---------- */
.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; gap: 10px;
  padding: 12px 14px; background: rgba(255,255,255,.96);
  backdrop-filter: blur(10px); border-bottom: 1.5px solid var(--line);
}
.topbar .back {
  display: inline-flex; align-items: center; gap: 4px;
  background: #fff; border: 1.5px solid var(--line-strong); color: var(--ink);
  padding: 6px 12px; border-radius: 9px; font-size: .9em;
}
.topbar .divider { width: 1.5px; height: 22px; background: var(--line-strong); }
.topbar h1 { font-size: 1.02em; margin: 0; flex: 1; font-weight: 600; text-align: center; }
.topbar .right { display: flex; gap: 8px; min-width: 4px; }

.content { padding: 14px; padding-bottom: calc(88px + env(safe-area-inset-bottom)); max-width: 980px; margin: 0 auto; }

.page { animation: fadeIn .24s ease both; }
.content { animation: viewIn .28s cubic-bezier(.2,.7,.3,1) both; }
@keyframes viewIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }

.card { background: var(--card); border: 1.5px solid var(--line); border-radius: var(--radius); padding: 16px; margin-bottom: 14px; box-shadow: var(--shadow); }
.card h2 { font-size: 1em; margin: 0 0 12px; font-weight: 600; }

.list-item { display: flex; align-items: center; gap: 12px; padding: 14px 2px; border-bottom: 1px solid var(--line); animation: rowIn .3s ease both; }
.list-item:last-child { border-bottom: none; }
.list-item:active { background: #f6f8fb; }
@keyframes rowIn { from { opacity: 0; transform: translateX(-8px); } to { opacity: 1; transform: none; } }
.stagger > .list-item:nth-child(1) { animation-delay: .02s; }
.stagger > .list-item:nth-child(2) { animation-delay: .06s; }
.stagger > .list-item:nth-child(3) { animation-delay: .10s; }
.stagger > .list-item:nth-child(4) { animation-delay: .14s; }
.stagger > .list-item:nth-child(5) { animation-delay: .18s; }
.stagger > .list-item:nth-child(6) { animation-delay: .22s; }
.stagger > .list-item:nth-child(7) { animation-delay: .26s; }
.list-item .grow { flex: 1; min-width: 0; }
.list-item .title { font-weight: 500; }
.list-item .sub { font-size: .8em; color: var(--sub); margin-top: 2px; }
.list-item .chev { color: var(--line-strong); font-size: 1.2em; }

.avatar { width: 40px; height: 40px; border-radius: 50%; background: var(--accent-soft); color: var(--accent); display: flex; align-items: center; justify-content: center; font-weight: 600; }

/* ---------- 登录 / 注册 ---------- */
.auth-wrap { max-width: 420px; margin: 0 auto; padding: 16px 16px 40px; }
.chip { display: inline-block; padding: 6px 16px; border: 1.5px solid var(--line-strong); border-radius: 9px; font-size: .85em; color: var(--ink); background: #fff; }
.chip:active { transform: scale(.96); }
.auth-title { text-align: center; font-size: 2.2em; font-weight: 700; letter-spacing: .14em; margin: 20px 0 18px; animation: titleIn .4s cubic-bezier(.2,.8,.3,1) both; }
@keyframes titleIn { from { opacity: 0; transform: translateY(-10px) scale(.96); } to { opacity: 1; transform: none; } }

.auth-input { display: block; width: 100%; margin-bottom: 14px; padding: 13px 15px; border: 1.5px solid var(--line-strong); border-radius: 11px; font-size: 1em; }

.tabs { display: flex; border: 1.5px solid var(--line-strong); border-radius: 10px; overflow: hidden; margin-bottom: 16px; }
.tabs button { flex: 1; border: none; border-radius: 0; background: #fff; color: var(--sub); box-shadow: none; padding: 11px; }
.tabs button.active { background: var(--accent); color: #fff; }
.tabs button + button { border-left: 1.5px solid var(--line-strong); }

.checkbox { display: flex; align-items: flex-start; gap: 8px; font-size: .88em; color: var(--ink); }
.checkbox input { width: auto; margin-top: 3px; }
.btn-row { display: flex; gap: 10px; margin-top: 16px; }
.btn-row button { flex: 1; }
.helper { text-align: center; margin-top: 14px; font-size: .88em; }
.error { color: var(--danger); font-size: .85em; min-height: 1.2em; margin-top: 8px; }
.notice { border: 1.5px dashed var(--line-strong); border-radius: 10px; padding: 10px 12px; font-size: .82em; color: var(--sub); background: #fff; }

/* ---------- 缩略图 ---------- */
.hscroll { display: flex; gap: 10px; overflow-x: auto; padding: 4px 2px 8px; scroll-snap-type: x mandatory; -webkit-overflow-scrolling: touch; }
.hscroll .thumb { flex: 0 0 calc((100% - 20px) / 3); aspect-ratio: 1/1; border: 1.5px solid var(--line); border-radius: 10px; overflow: hidden; background: #e9ebef; scroll-snap-align: start; position: relative; animation: pop .3s ease both; }
@keyframes pop { from { opacity: 0; transform: scale(.86); } to { opacity: 1; transform: none; } }
.hscroll .thumb:active { transform: scale(.95); }
.hscroll .thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.play-badge { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; color: #fff; font-size: 1.3em; text-shadow: 0 0 8px rgba(0,0,0,.7); }

.grid { display: grid; gap: 8px; grid-template-columns: repeat(auto-fill, minmax(104px, 1fr)); }
.grid .cell { position: relative; aspect-ratio: 1/1; border-radius: 10px; overflow: hidden; border: 1.5px solid var(--line); background: #e9ebef; animation: pop .34s ease both; }
.grid .cell:active { transform: scale(.96); }
.grid .cell img { width: 100%; height: 100%; object-fit: cover; display: block; }
.grid .cell .caption { position: absolute; left: 0; right: 0; bottom: 0; padding: 16px 6px 5px; font-size: .72em; color: #fff; background: linear-gradient(transparent, rgba(0,0,0,.68)); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.grid .cell .dl { position: absolute; top: 4px; right: 4px; background: rgba(0,0,0,.55); color: #fff; font-size: .68em; padding: 2px 7px; border-radius: 10px; }

.load-more { text-align: center; color: var(--sub); font-size: .82em; padding: 16px 0 8px; }

.section-head { display: flex; align-items: center; justify-content: space-between; margin: 4px 0 10px; }
.section-head h2 { display: flex; align-items: center; gap: 4px; font-size: 1em; margin: 0; font-weight: 600; }
.section-head h2[data-latest-cat] { cursor: pointer; }
.section-head h2[data-latest-cat]:active { opacity: .65; }
.section-head .chev { color: var(--sub); font-weight: 400; }
.section-empty { padding: 14px 4px; color: var(--sub); font-size: .86em; }
.view-all { display: block; width: 100%; margin-top: 10px; background: #fff; color: var(--accent); border: 1.5px solid var(--line-strong); border-radius: 10px; padding: 11px; font-size: .9em; }
.section-head .more { font-size: .84em; color: var(--accent); background: var(--accent-soft); border-radius: 8px; padding: 5px 11px; }
.section-head .more:active { transform: scale(.95); }
.divider-line { height: 1.5px; background: var(--line); margin: 14px 0; }

/* ---------- 底部导航（圆形） ---------- */
.tabbar { position: fixed; left: 0; right: 0; bottom: 0; z-index: 30; display: flex; background: rgba(255,255,255,.97); backdrop-filter: blur(10px); border-top: 1.5px solid var(--line); padding-bottom: env(safe-area-inset-bottom); }
.tabbar button { flex: 1; background: transparent; border: none; box-shadow: none; color: var(--sub); border-radius: 0; padding: 8px 0 11px; font-size: .72em; display: flex; flex-direction: column; align-items: center; gap: 3px; position: relative; }
.tabbar button .ico { width: 30px; height: 30px; border-radius: 50%; display: flex; align-items: center; justify-content: center; border: 1.5px solid var(--line-strong); background: #fff; font-size: 1em; transition: transform .25s cubic-bezier(.2,.8,.3,1), background .25s ease, color .25s ease, border-color .25s ease; }
.tabbar button.active { color: var(--accent); }
.tabbar button.active .ico { background: var(--accent); color: #fff; border-color: var(--accent); transform: translateY(-3px) scale(1.06); }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--danger); position: absolute; top: 6px; right: calc(50% - 22px); animation: pulse 1.6s ease-in-out infinite; }
@keyframes pulse { 0%,100% { transform: scale(1); opacity: 1; } 50% { transform: scale(1.35); opacity: .55; } }

/* ---------- 进度条 ---------- */
.progress { height: 12px; border-radius: 7px; background: #e9ebef; overflow: hidden; }
.progress > i { display: block; height: 100%; background: linear-gradient(90deg, var(--accent), #6ea0ff); width: 0; transition: width .8s cubic-bezier(.2,.8,.3,1); }
.muted { color: var(--sub); }
.hint { font-size: .82em; color: var(--sub); }
.center { text-align: center; }
.mt { margin-top: 14px; } .mb { margin-bottom: 14px; }
.pill { font-size: .72em; padding: 2px 9px; border-radius: 10px; background: var(--accent-soft); color: var(--accent); }
.pill.gray { background: #eef0f3; color: var(--sub); }
.pill.red { background: #fdecec; color: var(--danger); }
.pill.green { background: #e7f6ee; color: var(--ok); }
.empty { text-align: center; color: var(--sub); padding: 40px 10px; font-size: .9em; }
.row { display: flex; align-items: center; gap: 10px; }
.spacer { flex: 1; }

/* ---------- 弹窗 ---------- */
.modal { position: fixed; top: 0; left: 0; right: 0; bottom: 0; width: 100%; height: 100%; inset: 0; z-index: 60; background: rgba(18,20,24,.5); display: flex; align-items: center; justify-content: center; padding: 18px; animation: fadeIn .2s ease both; }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
.modal .sheet { background: #fff; border-radius: 16px; padding: 18px; width: 100%; max-width: 420px; max-height: 86vh; overflow-y: auto; animation: sheetIn .26s cubic-bezier(.2,.8,.3,1) both; }
@keyframes sheetIn { from { opacity: 0; transform: translateY(16px) scale(.96); } to { opacity: 1; transform: none; } }
.modal .sheet h3 { margin: 0 0 14px; font-size: 1.05em; }
.modal.viewer { background: rgba(0,0,0,.92); padding: 0; }
.modal.viewer .stage { width: 100%; height: 100%; display: flex; align-items: center; justify-content: center; overflow: auto; animation: fadeIn .25s ease both; }
.modal.viewer img, .modal.viewer video { max-width: 100%; max-height: 100%; transition: transform .28s cubic-bezier(.2,.8,.3,1); }
.modal.viewer img.zoomed { max-width: none; max-height: none; transform: scale(2); }
.viewer-close { position: fixed; top: 14px; right: 14px; z-index: 61; background: rgba(255,255,255,.2); color: #fff; border: none; border-radius: 50%; width: 42px; height: 42px; font-size: 1.2em; }
.viewer-bar { position: fixed; left: 0; right: 0; bottom: 0; z-index: 61; display: flex; gap: 10px; justify-content: center; align-items: center; padding: 14px; background: linear-gradient(transparent, rgba(0,0,0,.72)); flex-wrap: wrap; }
.viewer-bar button { background: rgba(255,255,255,.16); color: #fff; border-color: transparent; }

/* ---------- 群聊 ---------- */
.chat-wrap { display: flex; flex-direction: column; height: calc(100vh - 58px); }
.chat-list { flex: 1; overflow-y: auto; padding: 14px; }
.msg { margin-bottom: 12px; display: flex; flex-direction: column; align-items: flex-start; animation: rowIn .28s ease both; }
.msg.me { align-items: flex-end; }
.msg .who { font-size: .72em; color: var(--sub); margin-bottom: 3px; }
.msg .bubble { max-width: 76%; padding: 9px 12px; border-radius: 12px; background: #fff; border: 1.5px solid var(--line); word-break: break-word; }
.msg.me .bubble { background: var(--accent); color: #fff; border-color: var(--accent); }
.chat-input { display: flex; gap: 8px; padding: 10px 14px; border-top: 1.5px solid var(--line); background: #fff; }
.chat-input input { flex: 1; }

.toast { position: fixed; left: 50%; top: 38%; transform: translate(-50%, -50%); background: rgba(0,0,0,.82); color: #fff; padding: 11px 20px; border-radius: 10px; z-index: 90; font-size: .9em; max-width: 82vw; animation: toastIn .24s cubic-bezier(.2,.8,.3,1) both; }
@keyframes toastIn { from { opacity: 0; transform: translate(-50%,-62%) scale(.94); } to { opacity: 1; transform: translate(-50%,-50%); } }

/* ---------- 管理表格 ---------- */
.table { width: 100%; border-collapse: collapse; font-size: .84em; min-width: 680px; }
.table th, .table td { text-align: left; padding: 9px 8px; border-bottom: 1px solid var(--line); vertical-align: top; white-space: nowrap; }
.table th { color: var(--sub); font-weight: 500; }
.table .actions { display: flex; flex-wrap: wrap; gap: 6px; }

@media (min-width: 720px) {
  .grid { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); }
  .hscroll .thumb { flex: 0 0 calc((100% - 40px) / 5); }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; transition-duration: .001ms !important; }
}

/* ========== 作品画廊（照片墙） ========== */
.gallery-page .topbar h1 { text-align: left; }
.gallery-page .content { padding-left: 8px; padding-right: 8px; }
.gallery-bar { padding: 10px 12px 4px; max-width: 1120px; margin: 0 auto; }
.cat-chips { display: flex; gap: 8px; overflow-x: auto; padding: 2px 2px 8px; -webkit-overflow-scrolling: touch; scrollbar-width: none; }
.cat-chips::-webkit-scrollbar { display: none; }
.cat-chips .chip { flex: 0 0 auto; white-space: nowrap; box-shadow: none; }
.chip.active { background: var(--accent); color: #fff; border-color: var(--accent); }
.filter-row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.fchip { padding: 6px 14px; border-radius: 999px; font-size: .82em; background: #fff; color: var(--sub); border: 1.5px solid var(--line-strong); box-shadow: none; }
.fchip.active { background: var(--accent-soft); color: var(--accent); border-color: var(--accent); }
.author-select { padding: 7px 12px; border-radius: 999px; font-size: .82em; background: #fff; color: var(--sub); border: 1.5px solid var(--line-strong); max-width: 50vw; }
.guest-note { padding: 6px 0 22px; }

/* 手机优先：两列大图，图片尽量占满屏宽 */
.wall { display: grid; gap: 6px; grid-template-columns: repeat(2, 1fr); }
.wall .photo { position: relative; aspect-ratio: 1 / 1; border-radius: 10px; overflow: hidden; background: #e9ebef; box-shadow: 0 1px 5px rgba(15,23,42,.10); animation: pop .34s ease both; }
.wall .photo:active { transform: scale(.97); }
.wall .photo img { width: 100%; height: 100%; object-fit: cover; display: block; }
/* 首图作为展示大图，突出“展示”功能 */
.wall .photo.hero { grid-column: 1 / -1; aspect-ratio: 16 / 10; border-radius: 14px; }
.wall .photo-info { position: absolute; left: 0; right: 0; bottom: 0; padding: 22px 10px 8px; color: #fff; background: linear-gradient(transparent, rgba(0,0,0,.74)); display: flex; flex-direction: column; gap: 1px; }
.wall .photo-title { font-size: .8em; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.wall .photo-stat { font-size: .66em; color: rgba(255,255,255,.82); }
.wall .photo.hero .photo-title { font-size: 1.05em; font-weight: 600; }
.wall .photo.hero .photo-stat { font-size: .78em; }
.wall-empty { grid-column: 1 / -1; text-align: center; color: var(--sub); padding: 56px 16px; font-size: .9em; line-height: 1.8; }

.cat-entries { margin-top: 6px; }
.cat-entries .list-item { cursor: pointer; }
.cat-card { cursor: pointer; }
.cat-preview { display: flex; align-items: center; gap: 8px; }
.cat-mini { width: 64px; height: 64px; border-radius: 8px; overflow: hidden; background: #e9ebef; flex: 0 0 auto; box-shadow: 0 1px 4px rgba(15,23,42,.10); }
.cat-mini img { width: 100%; height: 100%; object-fit: cover; display: block; }
.cat-more { font-size: .8em; color: var(--sub); }

/* 全屏查看器：沉浸式展示，点按切换工具栏 */
.modal.viewer { height: 100vh; height: 100dvh; }
.viewer-close, .viewer-nav, .viewer-bar { transition: opacity .25s ease; }
.modal.viewer.chrome-hidden .viewer-close,
.modal.viewer.chrome-hidden .viewer-nav,
.modal.viewer.chrome-hidden .viewer-bar { opacity: 0; pointer-events: none; }
.viewer-nav { position: fixed; top: 50%; transform: translateY(-50%); z-index: 61; width: 46px; height: 46px; padding: 0; border: none; border-radius: 50%; background: rgba(255,255,255,.18); color: #fff; font-size: 1.7em; line-height: 1; display: flex; align-items: center; justify-content: center; }
.viewer-nav.prev { left: 10px; }
.viewer-nav.next { right: 10px; }
.viewer-nav:active { transform: translateY(-50%) scale(.94); }
.viewer-bar { justify-content: space-between; padding-bottom: calc(14px + env(safe-area-inset-bottom)); }
.viewer-info { display: flex; flex-direction: column; gap: 2px; min-width: 0; margin-right: auto; color: #fff; }
.viewer-title { font-size: .9em; font-weight: 600; max-width: 70vw; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.viewer-stats { font-size: .72em; color: rgba(255,255,255,.78); }

/* 桌面：简单适配，更多列 + 悬停反馈 */
@media (min-width: 720px) {
  .gallery-page .content { padding-left: 14px; padding-right: 14px; }
  .wall { grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 12px; }
  .wall .photo { border-radius: 12px; }
  .wall .photo.hero { aspect-ratio: 21 / 9; }
  .wall .photo:hover img { transform: scale(1.04); }
  .wall .photo img { transition: transform .4s ease; }
  .wall .photo-info { opacity: .96; }
}
@media (min-width: 1100px) {
  .wall { grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); }
}
