/* ========== 基础 ========== */
* { margin: 0; padding: 0; box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Helvetica Neue', 'PingFang SC', 'Microsoft YaHei', sans-serif;
  background: #f6f7fb;
  color: #1f2329;
  font-size: 15px;
  min-height: 100vh;
}

img { display: block; }

.hidden { display: none !important; }

/* ========== 通用组件 ========== */
.btn {
  display: inline-block;
  padding: 8px 16px;
  border: none;
  border-radius: 20px;
  font-size: 14px;
  cursor: pointer;
  background: #eef0f4;
  color: #1f2329;
  line-height: 1.4;
  text-decoration: none;
  white-space: nowrap;
}
.btn.primary { background: #07c160; color: #fff; }
.btn.ghost { background: #fff; color: #3370ff; box-shadow: 0 0 0 1px #d9e3ff inset; }
.btn.danger { background: #fff3f2; color: #e64340; box-shadow: 0 0 0 1px #ffd9d6 inset; }
.btn.block { display: block; width: 100%; margin-top: 12px; padding: 11px 16px; border-radius: 22px; font-size: 16px; }

.empty {
  text-align: center;
  color: #9aa0a8;
  padding: 72px 24px;
  font-size: 15px;
}

/* ========== 顶部栏 ========== */
.top {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 14px 16px;
  background: #fff;
  box-shadow: 0 1px 0 rgba(31, 35, 41, 0.06);
}
.top h1 { font-size: 21px; font-weight: 700; }
.top .sub { margin-top: 3px; font-size: 12px; color: #8a9099; }
.top-actions { display: flex; gap: 8px; flex-shrink: 0; }
.title-wrap { flex: 1; min-width: 0; text-align: center; }
.title-wrap h1 { font-size: 18px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.body { padding: 16px; min-height: 60vh; }

/* ========== 登录页 ========== */
.login { display: flex; align-items: center; justify-content: center; min-height: 88vh; padding: 24px; }
.login-card {
  width: 100%;
  max-width: 360px;
  background: #fff;
  border-radius: 16px;
  padding: 32px 24px;
  box-shadow: 0 8px 32px rgba(31, 35, 41, 0.08);
  text-align: center;
}
.login-card h1 { font-size: 24px; margin-bottom: 8px; }
.login-card .sub { font-size: 13px; color: #8a9099; margin-bottom: 20px; }
.login-card input {
  width: 100%;
  padding: 12px 14px;
  border: 1px solid #e0e3e8;
  border-radius: 12px;
  font-size: 15px;
  outline: none;
}
.login-card input:focus { border-color: #07c160; }

/* ========== 相册网格 ========== */
.album-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 14px;
}
.album-card {
  display: block;
  background: #fff;
  border-radius: 14px;
  overflow: hidden;
  box-shadow: 0 3px 14px rgba(31, 35, 41, 0.06);
  text-decoration: none;
  color: inherit;
}
.album-card .cover {
  width: 100%;
  aspect-ratio: 1 / 1;
  object-fit: cover;
  background: #eef0f4;
}
.album-card .cover.empty {
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 34px;
  color: #c0c6cf;
}
.album-card .info { padding: 10px 12px 12px; }
.album-card .name {
  font-size: 15px;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.album-card .meta { margin-top: 4px; font-size: 12px; color: #8a9099; }

/* ========== 照片网格 ========== */
.photo-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  gap: 6px;
}
.photo-cell { position: relative; }
.photo-cell img {
  width: 100%;
  aspect-ratio: 1 / 1;
  object-fit: cover;
  border-radius: 8px;
  background: #eef0f4;
  cursor: zoom-in;
}
.photo-del {
  position: absolute;
  top: 6px;
  right: 6px;
  width: 24px;
  height: 24px;
  border: none;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.55);
  color: #fff;
  font-size: 14px;
  line-height: 1;
  cursor: pointer;
}

/* ========== 轮播查看器 ========== */
.viewer {
  position: fixed;
  inset: 0;
  z-index: 100;
  background: #000;
  display: flex;
  align-items: center;
  justify-content: center;
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
}
.viewer img, .viewer canvas {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  user-select: none;
  -webkit-user-drag: none;
  -webkit-touch-callout: none;
}
.viewer-top {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  color: #fff;
  font-size: 14px;
  background: linear-gradient(rgba(0,0,0,.55), transparent);
}
#viewer-close {
  width: 34px;
  height: 34px;
  border: none;
  border-radius: 50%;
  background: rgba(255,255,255,.18);
  color: #fff;
  font-size: 16px;
  cursor: pointer;
}
.vbtn {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 44px;
  height: 44px;
  border: none;
  border-radius: 50%;
  background: rgba(255,255,255,.16);
  color: #fff;
  font-size: 26px;
  line-height: 1;
  cursor: pointer;
}
.vbtn.prev { left: 12px; }
.vbtn.next { right: 12px; }
.viewer-bottom {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  background: linear-gradient(transparent, rgba(0,0,0,.55));
}
.vlink { color: #fff; font-size: 14px; text-decoration: none; padding: 8px 14px; background: rgba(255,255,255,.18); border-radius: 18px; }
.vhint { color: rgba(255,255,255,.75); font-size: 12px; }

/* 照片网格：禁止保存/拖拽（访客仅查看） */
.photo-grid img, .album-card .cover {
  -webkit-user-drag: none;
  -webkit-touch-callout: none;
  user-select: none;
  pointer-events: none;
}

/* ========== 弹窗 ========== */
.modal {
  position: fixed;
  inset: 0;
  z-index: 90;
  background: rgba(0, 0, 0, 0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}
.modal .card {
  width: 100%;
  max-width: 360px;
  background: #fff;
  border-radius: 16px;
  padding: 24px;
}
.modal h2 { font-size: 19px; margin-bottom: 16px; }
.modal label { display: block; font-size: 13px; color: #6b7280; margin: 12px 0 6px; }
.modal input {
  width: 100%;
  padding: 11px 13px;
  border: 1px solid #e0e3e8;
  border-radius: 10px;
  font-size: 15px;
  outline: none;
}
.modal input:focus { border-color: #07c160; }
.modal .row { display: flex; justify-content: flex-end; gap: 10px; margin-top: 20px; }

/* ========== 提示 & 加载 ========== */
#toast {
  position: fixed;
  left: 50%;
  bottom: 90px;
  transform: translateX(-50%);
  z-index: 200;
  max-width: 80vw;
  padding: 10px 18px;
  border-radius: 20px;
  background: rgba(31, 35, 41, 0.88);
  color: #fff;
  font-size: 14px;
  opacity: 0;
  transition: opacity .25s;
  pointer-events: none;
}
#toast.show { opacity: 1; }
#toast.err { background: rgba(230, 67, 64, 0.92); }

#loading {
  position: fixed;
  inset: 0;
  z-index: 150;
  background: rgba(0, 0, 0, 0.35);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 15px;
}
