:root {
  --bg: #f5f6f8;
  --card: #ffffff;
  --text: #1f2937;
  --muted: #6b7280;
  --primary: #3b82f6;
  --primary-dark: #2563eb;
  --border: #e5e7eb;
  --danger: #ef4444;
  --radius: 14px;
  --shadow: 0 1px 3px rgba(0,0,0,.06), 0 1px 2px rgba(0,0,0,.04);
  --shadow-lg: 0 10px 30px rgba(0,0,0,.15);
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html { -webkit-text-size-adjust: 100%; }

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

/* 顶栏 */
.header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(255,255,255,.92);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
}
.header-inner {
  max-width: 1080px;
  margin: 0 auto;
  padding: 12px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}
.logo { font-size: 20px; font-weight: 700; }
.tabs { display: flex; gap: 4px; background: #eef0f3; padding: 4px; border-radius: 999px; }
.tab {
  border: none; background: transparent; padding: 8px 18px; border-radius: 999px;
  font-size: 15px; cursor: pointer; color: var(--muted); transition: all .15s; white-space: nowrap;
}
.tab.active { background: #fff; color: var(--text); font-weight: 600; box-shadow: var(--shadow); }

/* 布局 */
.container { max-width: 1080px; margin: 0 auto; padding: 20px 16px 80px; }
.section { display: none; }
.section.active { display: block; animation: fade .25s ease; }
@keyframes fade { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

.section-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 16px; }
.hint { color: var(--muted); font-size: 13px; }

/* 按钮 */
.btn {
  border: none; cursor: pointer; border-radius: 10px; padding: 10px 18px;
  font-size: 15px; transition: all .15s; background: #eef0f3; color: var(--text);
}
.btn:hover { filter: brightness(.97); }
.btn:disabled { opacity: .6; cursor: not-allowed; }
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); }
.btn-danger { background: #fee2e2; color: var(--danger); }
.btn-block { width: 100%; }

/* 照片墙 */
.photo-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 12px;
}
.photo-card {
  position: relative; border-radius: var(--radius); overflow: hidden;
  background: var(--card); box-shadow: var(--shadow); cursor: pointer;
  transition: transform .15s, box-shadow .15s;
}
.photo-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-lg); }
.photo-card img { width: 100%; aspect-ratio: 1; object-fit: cover; display: block; }
.photo-placeholder {
  width: 100%; aspect-ratio: 1; display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 6px;
  background: linear-gradient(135deg, #eef0f3, #e0e3e8);
  color: var(--muted); font-size: 13px;
}
.ph-icon { font-size: 28px; line-height: 1; }
.photo-card figcaption {
  display: flex; justify-content: space-between; align-items: center; gap: 6px;
  padding: 8px 10px; font-size: 12px; color: var(--muted);
}
.photo-time { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* 卡片与输入 */
.card { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); }
.composer { padding: 16px; margin-bottom: 16px; display: flex; flex-direction: column; gap: 10px; }
.composer input[type="text"], .composer textarea {
  border: 1px solid var(--border); border-radius: 10px; padding: 10px 12px;
  font-size: 15px; font-family: inherit; resize: vertical; width: 100%; color: var(--text);
}
.composer input[type="text"]:focus, .composer textarea:focus { outline: none; border-color: var(--primary); }
.composer-foot { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.composer-sm { padding: 12px; margin-bottom: 0; }

/* 留言 */
.message { padding: 14px 16px; margin-bottom: 12px; }
.message-head, .comment-head { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; margin-bottom: 4px; }
.message-name, .comment-name { font-weight: 600; color: var(--primary-dark); font-size: 14px; }
.message-time, .comment-time { font-size: 12px; color: var(--muted); white-space: nowrap; }
.message-body, .comment-body { font-size: 15px; word-break: break-word; white-space: pre-wrap; }

.loading, .empty { text-align: center; color: var(--muted); padding: 40px 16px; font-size: 15px; }
.hidden { display: none !important; }

/* 弹窗 */
.modal { position: fixed; inset: 0; z-index: 100; display: flex; align-items: center; justify-content: center; padding: 16px; }
.modal-mask { position: absolute; inset: 0; background: rgba(0,0,0,.5); }
.modal-card {
  position: relative; background: var(--card); border-radius: var(--radius);
  width: 100%; max-width: 420px; max-height: 90vh; overflow-y: auto; padding: 20px;
  box-shadow: var(--shadow-lg);
}
.modal-card h2 { margin-bottom: 14px; font-size: 18px; }
.modal-photo { max-width: 560px; }
.modal-close {
  position: absolute; top: 10px; right: 10px; border: none; background: #eef0f3;
  width: 32px; height: 32px; border-radius: 50%; font-size: 20px; line-height: 1; cursor: pointer; color: var(--muted);
}
.modal-close:hover { background: #e5e7eb; }

.file-drop {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  border: 2px dashed var(--border); border-radius: var(--radius); padding: 24px; margin-bottom: 12px;
  cursor: pointer; text-align: center; color: var(--muted); min-height: 160px; transition: border-color .15s;
}
.file-drop:hover { border-color: var(--primary); }
.file-drop small { font-size: 12px; color: var(--muted); }
.file-preview { max-width: 100%; max-height: 240px; border-radius: 10px; object-fit: contain; }

.photo-stage { border-radius: var(--radius); overflow: hidden; margin-bottom: 10px; background: #000; }
.photo-stage img { width: 100%; max-height: 55vh; object-fit: contain; display: block; }
.photo-meta { color: var(--muted); font-size: 13px; margin-bottom: 12px; }
.comment-title { font-size: 16px; margin-bottom: 6px; }
.comment-list { max-height: 280px; overflow-y: auto; margin-bottom: 12px; }
.comment { padding: 8px 0; border-bottom: 1px solid var(--border); }
.comment:last-child { border-bottom: none; }

.form-error { color: var(--danger); font-size: 13px; margin-top: 8px; }

/* Toast */
.toast {
  position: fixed; left: 50%; bottom: 40px; transform: translateX(-50%);
  background: rgba(17,24,39,.92); color: #fff; padding: 10px 20px; border-radius: 999px;
  font-size: 14px; z-index: 200; transition: opacity .2s; opacity: 0; pointer-events: none; max-width: 90vw;
}
.toast.show { opacity: 1; }
.toast.error { background: rgba(220,38,38,.95); }

/* 桌面端 */
@media (min-width: 640px) {
  .photo-grid { grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 16px; }
  .container { padding-top: 28px; }
  .logo { font-size: 22px; }
}
