:root {
  --bg: #0f1115;
  --bg-soft: #171a21;
  --line: #262b35;
  --text: #e8ecf3;
  --muted: #98a2b3;
  --accent: #4f8cff;
  --radius: 14px;
  --safe-b: env(safe-area-inset-bottom, 0px);
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", "Segoe UI", Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
  overscroll-behavior-y: contain;
}

a { color: var(--accent); text-decoration: none; }

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: calc(env(safe-area-inset-top, 0px) + 12px) 16px 12px;
  background: rgba(15, 17, 21, .82);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--line);
}
.topbar h1 {
  font-size: 17px;
  font-weight: 600;
  margin: 0;
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.topbar .sub { font-size: 12px; color: var(--muted); font-weight: 400; }
.back {
  border: 0;
  background: var(--bg-soft);
  color: var(--text);
  width: 34px;
  height: 34px;
  border-radius: 50%;
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
  flex: 0 0 auto;
}

main {
  padding: 14px 14px calc(28px + var(--safe-b));
}

/* ---------- 相册列表 ---------- */
.album-list { display: grid; gap: 14px; }
@media (min-width: 620px) { .album-list { grid-template-columns: 1fr 1fr; } }
@media (min-width: 980px) { .album-list { grid-template-columns: repeat(3, 1fr); } }

.album-card {
  display: flex;
  gap: 12px;
  align-items: center;
  padding: 10px;
  background: var(--bg-soft);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  color: inherit;
  transition: transform .15s ease, border-color .15s ease;
}
.album-card:active { transform: scale(.985); }
.album-cover {
  width: 74px;
  height: 74px;
  flex: 0 0 auto;
  border-radius: 10px;
  background: #222833 center/cover no-repeat;
  object-fit: cover;
}
.album-info { min-width: 0; flex: 1; }
.album-title { font-size: 15px; font-weight: 600; margin: 0 0 4px; }
.album-meta { font-size: 12px; color: var(--muted); }

/* ---------- 媒体网格 ---------- */
.grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 3px;
}
@media (min-width: 560px) { .grid { grid-template-columns: repeat(5, 1fr); } }
@media (min-width: 900px) { .grid { grid-template-columns: repeat(7, 1fr); } }

.tile {
  position: relative;
  padding: 0;
  border: 0;
  aspect-ratio: 1 / 1;
  overflow: hidden;
  border-radius: 4px;
  background: #1c2029;
  cursor: pointer;
  display: block;
}
.tile img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.tile .badge {
  position: absolute;
  right: 4px;
  bottom: 4px;
  display: flex;
  align-items: center;
  gap: 3px;
  padding: 2px 6px;
  font-size: 11px;
  line-height: 1.3;
  color: #fff;
  background: rgba(0, 0, 0, .62);
  border-radius: 6px;
  backdrop-filter: blur(2px);
}
.tile .play {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: rgba(0, 0, 0, .5);
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
}
.tile .play::after {
  content: "";
  border-style: solid;
  border-width: 7px 0 7px 11px;
  border-color: transparent transparent transparent #fff;
  margin-left: 3px;
}

.section-title {
  font-size: 13px;
  color: var(--muted);
  margin: 18px 2px 10px;
  font-weight: 500;
}

/* ---------- 灯箱 ---------- */
.lb {
  position: fixed;
  inset: 0;
  z-index: 100;
  background: #000;
  display: flex;
  flex-direction: column;
  touch-action: pan-y;
}
.lb.hidden { display: none; }
.lb-top {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  z-index: 3;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: calc(env(safe-area-inset-top, 0px) + 10px) 14px 10px;
  background: linear-gradient(to bottom, rgba(0,0,0,.72), rgba(0,0,0,0));
  color: #fff;
}
.lb-counter { flex: 1; font-size: 13px; color: #cfd6e2; }
.lb-btn {
  border: 0;
  background: rgba(255, 255, 255, .12);
  color: #fff;
  height: 34px;
  padding: 0 14px;
  border-radius: 17px;
  font-size: 13px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 5px;
}
.lb-stage {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}
.lb-stage img, .lb-stage video {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  display: block;
}
.lb-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  z-index: 2;
  width: 40px;
  height: 40px;
  border: 0;
  border-radius: 50%;
  background: rgba(255,255,255,.1);
  color: #fff;
  font-size: 24px;
  line-height: 1;
  cursor: pointer;
  display: none;
}
@media (hover: hover) { .lb-nav { display: block; } }
.lb-prev { left: 12px; }
.lb-next { right: 12px; }
.lb-bottom {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 3;
  padding: 10px 16px calc(14px + var(--safe-b));
  background: linear-gradient(to top, rgba(0,0,0,.75), rgba(0,0,0,0));
  display: flex;
  align-items: center;
  gap: 12px;
}
.lb-name { flex: 1; min-width: 0; font-size: 12px; color: #cfd6e2; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---------- 密码页 ---------- */
.pwd-wrap {
  max-width: 380px;
  margin: 12vh auto 0;
  padding: 0 18px;
  text-align: center;
}
.pwd-icon { font-size: 40px; margin-bottom: 14px; }
.pwd-wrap h2 { font-size: 18px; margin: 0 0 8px; }
.pwd-wrap p { font-size: 13px; color: var(--muted); margin: 0 0 22px; line-height: 1.6; }
.pwd-wrap input {
  width: 100%;
  height: 48px;
  padding: 0 16px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: var(--bg-soft);
  color: var(--text);
  font-size: 17px;
  letter-spacing: .18em;
  text-align: center;
  outline: none;
}
.pwd-wrap input:focus { border-color: var(--accent); }
.pwd-wrap button {
  width: 100%;
  height: 48px;
  margin-top: 12px;
  border: 0;
  border-radius: 12px;
  background: var(--accent);
  color: #fff;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
}
.pwd-wrap button:disabled { opacity: .55; }
.pwd-err { color: #ff6b6b; font-size: 13px; height: 18px; margin-top: 12px; }

.empty {
  text-align: center;
  color: var(--muted);
  font-size: 14px;
  padding: 60px 20px;
  line-height: 1.7;
}
.footer-note { text-align: center; color: #566072; font-size: 11px; padding: 26px 0 6px; }
