* { box-sizing: border-box; }
:root {
  --bg: #f4f2e9;
  --paper: #fffef9;
  --paper-soft: #f9f8f2;
  --paper-deep: #e9e7dc;
  --ink: #17332e;
  --muted: #4f625e;
  --ink-faint: #7b8985;
  --line: rgba(23, 51, 46, 0.13);
  --line-strong: rgba(23, 51, 46, 0.23);
  --blue: #146f61;
  --blue-bright: #2d927f;
  --blue-soft: #dcece6;
  --coral: #e77352;
  --coral-pale: #f9e3db;
  --red: #c94c31;
  --shadow: 0 20px 56px rgba(28, 55, 48, 0.08);
  --font: "Noto Sans SC", "PingFang SC", "Microsoft YaHei", "Helvetica Neue", Arial, sans-serif;
  --font-serif: Georgia, "Songti SC", "STSong", serif;
}
body {
  margin: 0;
  background: radial-gradient(circle at 88% -10%, rgba(45, 146, 127, 0.11), transparent 28rem), var(--bg);
  font: 14px/1.65 var(--font);
  color: var(--ink);
  min-height: 100vh;
}
button, input, textarea, select { font: inherit; }
button { cursor: pointer; border: 0; }
button:disabled { opacity: 0.45; cursor: not-allowed; }
input, textarea, select {
  border: 1px solid var(--line-strong);
  border-radius: 12px;
  padding: 10px 12px;
  background: var(--paper);
  color: var(--ink);
  width: 100%;
}
input:focus, textarea:focus, select:focus {
  outline: 0;
  border-color: var(--blue);
  box-shadow: 0 0 0 3px var(--blue-soft);
}
textarea { resize: vertical; min-height: 74px; line-height: 1.7; }
label { display: block; font-size: 13px; font-weight: 600; margin: 12px 0 6px; }
h1, h2, h3, p { margin: 0; }
h1 { font-family: var(--font-serif); font-size: 24px; font-weight: 600; }
h2 { font-size: 18px; }
.hint { font-size: 12.5px; color: var(--muted); }
.row { display: flex; gap: 10px; align-items: center; }
.wrap { flex-wrap: wrap; }
.grow { flex: 1; }
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 9px 15px;
  border-radius: 999px;
  background: var(--paper);
  color: var(--ink);
  border: 1px solid var(--line-strong);
  font-weight: 600;
  font-size: 13px;
  transition: transform 0.12s ease, background 0.15s ease;
}
.btn:hover { background: var(--paper-soft); }
.btn.primary { background: var(--blue); color: #fff; border-color: transparent; }
.btn.primary:hover { background: #105a4e; }
.btn.ghost { background: transparent; border-color: var(--line); }
.btn.danger { background: var(--coral-pale); color: var(--red); border-color: rgba(201, 76, 49, 0.25); }
.btn.small { padding: 6px 12px; font-size: 12.5px; }
.pill {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  background: var(--paper-deep);
  color: var(--ink);
}
.pill.blue { background: var(--blue-soft); color: var(--blue); }
.panel {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 18px;
  box-shadow: 0 6px 24px rgba(23, 51, 46, 0.04);
}
.panel-head {
  padding: 16px 20px;
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}
.panel-body { padding: 18px 20px; }
.notice {
  background: var(--paper-soft);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 10px 14px;
  font-size: 13px;
}
.notice.warn { background: var(--coral-pale); border-color: rgba(231, 115, 82, 0.35); color: #7a2d1b; }

.boot {
  display: grid;
  place-content: center;
  text-align: center;
  min-height: 100vh;
  font-size: 28px;
  letter-spacing: 4px;
  color: var(--ink);
}
.boot span { font-size: 13px; letter-spacing: 0; color: var(--muted); margin-top: 10px; }
.boot-logo {
  margin: 0 auto 12px;
  width: 54px;
  height: 54px;
  border-radius: 15px;
  overflow: hidden;
  box-shadow: 0 8px 22px rgba(20, 111, 97, 0.22);
}
.boot-logo img { width: 100%; height: 100%; display: block; }

.site-header {
  position: sticky;
  top: 0;
  z-index: 30;
  background: rgba(244, 242, 233, 0.9);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--line);
}
.site-header-inner {
  max-width: 1480px;
  margin: 0 auto;
  padding: 10px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.brand { display: flex; align-items: center; gap: 11px; }
.brand-mark {
  width: 36px;
  height: 36px;
  border-radius: 11px;
  overflow: hidden;
  box-shadow: 0 4px 12px rgba(20, 111, 97, 0.22);
  flex: 0 0 auto;
}
.brand-mark img { width: 100%; height: 100%; display: block; }
.brand strong { font-size: 18px; letter-spacing: 0.04em; color: var(--ink); }

.gallery-main { max-width: 1480px; margin: 0 auto; padding: 18px 24px 48px; }
.login-wrap { max-width: 430px; margin: 64px auto; padding: 0 16px; }
.pin-input { text-align: center; font-size: 20px; letter-spacing: 8px; font-weight: 700; }

.cloud-tabs { display: inline-flex; gap: 4px; background: var(--paper-deep); padding: 4px; border-radius: 999px; flex-wrap: wrap; }
.cloud-tab { padding: 7px 14px; border-radius: 999px; background: transparent; color: var(--muted); font-weight: 600; font-size: 13px; }
.cloud-tab.active { background: var(--paper); color: var(--blue); box-shadow: 0 1px 4px rgba(23, 51, 46, 0.1); }
.hist-pill { padding: 5px 12px; border-radius: 999px; border: 1px solid var(--line); background: var(--paper); color: var(--muted); font-size: 12.5px; }
.hist-pill:hover, .hist-pill.active { background: var(--blue-soft); border-color: var(--blue); color: var(--blue); }

.album-page.drag-over { outline: 2px dashed var(--blue); outline-offset: 6px; border-radius: 16px; }
.album-breadcrumbs { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.album-folder-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 12px; }
.album-folder-card { position: relative; background: var(--paper); border: 1px solid var(--line); border-radius: 16px; overflow: hidden; transition: transform 0.14s ease, border-color 0.14s ease; }
.album-folder-card:hover { transform: translateY(-2px); border-color: var(--blue); }
.album-folder-btn { display: flex; flex-direction: column; width: 100%; background: none; padding: 0; text-align: left; }
.album-folder-cover { width: 100%; height: 134px; background: var(--paper-deep); display: flex; align-items: center; justify-content: center; overflow: hidden; }
.album-folder-cover img { width: 100%; height: 100%; object-fit: cover; }
.album-folder-ico { font-size: 38px; }
.album-folder-meta { padding: 10px 12px; display: flex; flex-direction: column; gap: 2px; }
.album-folder-meta strong { font-size: 14px; color: var(--ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.album-folder-edit { position: absolute; top: 8px; right: 8px; width: 28px; height: 28px; border-radius: 999px; background: rgba(255, 254, 249, 0.9); border: 1px solid var(--line); font-size: 13px; display: grid; place-items: center; }

.album-timeline-group { margin-bottom: 18px; }
.album-timeline-head { font-family: var(--font-serif); font-size: 16px; margin-bottom: 10px; color: var(--ink); }
.album-media-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(178px, 1fr)); gap: 10px; }
.album-media-card { position: relative; background: var(--paper); border: 1px solid var(--line); border-radius: 14px; overflow: hidden; display: flex; flex-direction: column; }
.album-media-card.is-selected { border-color: var(--blue); box-shadow: 0 0 0 2px var(--blue-soft); }
.album-media-thumb { position: relative; width: 100%; aspect-ratio: 1 / 1; background: var(--paper-deep); padding: 0; overflow: hidden; display: block; }
.album-media-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.album-vid-placeholder { width: 100%; height: 100%; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; font-size: 28px; padding: 10px; color: var(--muted); }
.album-vid-placeholder span { font-size: 11px; max-width: 100%; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.album-vid-badge { position: absolute; left: 8px; bottom: 8px; padding: 2px 7px; border-radius: 999px; background: rgba(23, 51, 46, 0.82); color: #fff; font-size: 11px; font-weight: 600; }
.album-cat-badge { position: absolute; right: 8px; bottom: 8px; padding: 2px 7px; border-radius: 999px; background: rgba(255, 254, 249, 0.9); color: var(--ink); font-size: 10.5px; font-weight: 600; }
.album-fav-btn { position: absolute; top: 8px; right: 8px; width: 28px; height: 28px; border-radius: 999px; background: rgba(255, 254, 249, 0.88); border: 1px solid var(--line); font-size: 13px; display: grid; place-items: center; z-index: 2; }
.album-fav-btn.active { background: var(--coral-pale); border-color: rgba(231, 115, 82, 0.45); }
.album-sel-check { position: absolute; top: 8px; left: 8px; width: 26px; height: 26px; border-radius: 8px; background: rgba(255, 254, 249, 0.92); border: 1px solid var(--line-strong); font-weight: 700; color: var(--blue); display: grid; place-items: center; z-index: 2; }
.album-sel-check.checked { background: var(--blue); border-color: var(--blue); color: #fff; }
.album-media-foot { padding: 8px 10px; }
.album-media-title { font-size: 12.5px; font-weight: 600; color: var(--ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.album-filter-box { background: var(--paper); border: 1px solid var(--line); border-radius: 14px; padding: 8px 12px; margin-bottom: 12px; }
.album-filter-toggle-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; flex-wrap: wrap; }
.album-filter-drawer { margin-top: 10px; padding-top: 10px; border-top: 1px dashed var(--line); }
.album-active-chip { background: var(--blue-soft); border-color: var(--blue); color: var(--blue); }

.album-upload-dock { position: fixed; right: 22px; bottom: 22px; z-index: 45; width: min(360px, calc(100vw - 32px)); }
.album-dock-inner { background: var(--paper); border: 1px solid var(--line-strong); border-radius: 16px; padding: 12px 14px; box-shadow: var(--shadow); }
.storage-bar { width: 100%; height: 8px; border-radius: 999px; background: var(--paper-deep); overflow: hidden; }
.storage-bar-fill { height: 100%; background: linear-gradient(90deg, var(--blue), var(--blue-bright)); }

.album-lightbox-backdrop { position: fixed; inset: 0; z-index: 80; background: rgba(15, 28, 25, 0.78); backdrop-filter: blur(6px); display: flex; align-items: center; justify-content: center; padding: 16px; }
.album-modal-card { width: min(480px, 100%); max-height: 90vh; overflow-y: auto; }
.album-lightbox { width: min(1160px, 100%); height: min(88vh, 780px); background: var(--paper); border-radius: 20px; overflow: hidden; display: grid; grid-template-columns: 1fr 330px; box-shadow: 0 28px 80px rgba(0, 0, 0, 0.35); }
.album-lb-stage { position: relative; background: #101e1b; display: flex; align-items: center; justify-content: center; min-width: 0; min-height: 0; overflow: hidden; }
.album-lb-img-wrap { position: relative; width: 100%; height: 100%; display: flex; align-items: center; justify-content: center; }
.album-lb-img, .album-lb-video { max-width: 100%; max-height: 100%; object-fit: contain; }
.album-lb-img.is-thumb-bg { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; filter: blur(4px); transform: scale(1.01); }
.album-lb-img.is-hd { position: relative; z-index: 1; opacity: 0; transition: opacity 0.16s ease; }
.album-lb-img.is-hd.is-loaded { opacity: 1; }
.album-lb-badge, .album-lb-counter { position: absolute; z-index: 2; padding: 4px 10px; border-radius: 999px; background: rgba(16, 30, 27, 0.72); color: rgba(255, 254, 249, 0.94); font-size: 11.5px; backdrop-filter: blur(4px); pointer-events: none; }
.album-lb-badge { top: 12px; left: 12px; }
.album-lb-counter { bottom: 12px; left: 50%; transform: translateX(-50%); }
.album-lb-nav { position: absolute; top: 50%; transform: translateY(-50%); z-index: 4; width: 40px; height: 40px; border-radius: 999px; background: rgba(16, 30, 27, 0.5); backdrop-filter: blur(4px); color: #fff; font-size: 26px; line-height: 1; display: grid; place-items: center; }
.album-lb-nav:hover { background: rgba(16, 30, 27, 0.75); }
.album-lb-nav.prev { left: 12px; }
.album-lb-nav.next { right: 12px; }
.album-lb-close { position: absolute; top: 12px; right: 12px; z-index: 4; width: 34px; height: 34px; border-radius: 999px; background: rgba(16, 30, 27, 0.5); backdrop-filter: blur(4px); color: #fff; font-size: 22px; line-height: 1; display: grid; place-items: center; }
.album-lb-close:hover { background: rgba(16, 30, 27, 0.75); }
.album-lb-side { padding: 16px; overflow-y: auto; border-left: 1px solid var(--line); }

#toast {
  position: fixed;
  left: 50%;
  bottom: 24px;
  transform: translate(-50%, 16px);
  background: var(--ink);
  color: #fff;
  padding: 10px 18px;
  border-radius: 999px;
  font-size: 13px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s, transform 0.2s;
  z-index: 120;
  max-width: min(92vw, 520px);
}
#toast.show { opacity: 1; transform: translate(-50%, 0); }
#toast.error { background: var(--red); }

@media (max-width: 860px) {
  .site-header-inner, .gallery-main { padding-left: 14px; padding-right: 14px; }
  .album-lightbox { grid-template-columns: 1fr; grid-template-rows: 46vh 1fr; height: 92vh; }
  .album-lb-side { border-left: 0; border-top: 1px solid var(--line); }
}
