/* ==========================================================================
   styles.css — 共享相册 · 深色主题 + 响应式（375 / 768 / 1200 断点）
   无外部字体、无 CDN；全部图标为内联 SVG
   ========================================================================== */

:root {
  --bg: #0f1115;
  --bg-soft: #13161c;
  --card: #171a21;
  --card-2: #1d212a;
  --card-hover: #212633;
  --text: #e6e8ee;
  --muted: #9aa3b2;
  --muted-2: #6f7887;
  --accent: #4c8dff;
  --accent-soft: rgba(76, 141, 255, 0.14);
  --accent-strong: #2f6fe0;
  --danger: #ff5c5c;
  --danger-soft: rgba(255, 92, 92, 0.12);
  --ok: #39d98a;
  --warn: #ffb020;
  --line: #262b35;
  --line-soft: #1f232c;
  --radius: 10px;
  --radius-sm: 6px;
  --radius-lg: 14px;
  --nav-h: 56px;
  --tab-h: 58px;
  --shadow: 0 10px 30px rgba(0, 0, 0, 0.45);
  --font: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Hiragino Sans GB',
    'Microsoft YaHei', 'Noto Sans SC', Roboto, Helvetica, Arial, sans-serif;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  background: var(--bg);
}

html.lb-open,
html.up-open {
  overflow: hidden;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  overflow-wrap: anywhere;
}

img,
video,
svg {
  max-width: 100%;
}

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

a:hover {
  text-decoration: underline;
}

button,
input,
select,
textarea {
  font: inherit;
  color: inherit;
}

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: 4px;
}

[hidden] {
  display: none !important;
}

/* 屏幕阅读器文本 */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

.skip-link {
  position: absolute;
  left: -999px;
  top: 8px;
  z-index: 100;
  padding: 8px 14px;
  background: var(--accent);
  color: #fff;
  border-radius: var(--radius-sm);
}

.skip-link:focus {
  left: 8px;
}

.icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
}

/* ==========================================================================
   按钮 / 表单
   ========================================================================== */
.btn {
  --btn-bg: var(--card-2);
  --btn-fg: var(--text);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 38px;
  padding: 8px 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--btn-bg);
  color: var(--btn-fg);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: background-color 0.15s ease, border-color 0.15s ease, opacity 0.15s ease, transform 0.06s ease;
  white-space: nowrap;
}

.btn:hover {
  background: var(--card-hover);
}

.btn:active {
  transform: translateY(1px);
}

.btn[disabled] {
  opacity: 0.5;
  cursor: not-allowed;
}

.btn--primary {
  --btn-bg: var(--accent);
  --btn-fg: #fff;
  border-color: transparent;
  font-weight: 600;
}

.btn--primary:hover {
  background: var(--accent-strong);
}

.btn--danger {
  --btn-bg: transparent;
  --btn-fg: var(--danger);
  border-color: rgba(255, 92, 92, 0.5);
}

.btn--danger:hover {
  background: var(--danger-soft);
}

.btn--ghost-danger {
  --btn-bg: transparent;
  --btn-fg: var(--muted);
  border-color: transparent;
}

.btn--ghost-danger:hover {
  background: var(--danger-soft);
  color: var(--danger);
}

.btn--sm {
  min-height: 32px;
  padding: 5px 10px;
  font-size: 13px;
  border-radius: 8px;
}

.btn--xs {
  min-height: 28px;
  padding: 3px 8px;
  font-size: 12px;
  border-radius: 7px;
  gap: 4px;
}

.btn--full {
  width: 100%;
}

.btn.is-busy {
  pointer-events: none;
  opacity: 0.85;
}

.btn__spinner {
  display: none;
  width: 15px;
  height: 15px;
  border: 2px solid rgba(255, 255, 255, 0.4);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

.btn.is-busy .btn__spinner {
  display: inline-block;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  padding: 0;
  border: 1px solid transparent;
  border-radius: 9px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  transition: background-color 0.15s ease, color 0.15s ease;
}

.icon-btn:hover {
  background: var(--card-2);
  color: var(--text);
}

.input,
.select {
  width: 100%;
  min-height: 40px;
  padding: 9px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--bg-soft);
  color: var(--text);
  font-size: 15px;
  transition: border-color 0.15s ease, background-color 0.15s ease;
}

.input::placeholder {
  color: var(--muted-2);
}

.input:focus,
.select:focus {
  outline: none;
  border-color: var(--accent);
  background: var(--card);
}

.input--area {
  min-height: 84px;
  resize: vertical;
  line-height: 1.5;
}

.select {
  appearance: none;
  background-image: linear-gradient(45deg, transparent 49%, var(--muted) 50%),
    linear-gradient(135deg, var(--muted) 50%, transparent 51%);
  background-position: calc(100% - 18px) 45%, calc(100% - 12px) 45%;
  background-size: 6px 6px, 6px 6px;
  background-repeat: no-repeat;
  padding-right: 34px;
  cursor: pointer;
}

.input-group {
  position: relative;
  display: flex;
  align-items: center;
}

.input-group .input {
  padding-right: 46px;
}

.input-group__btn {
  position: absolute;
  right: 4px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
}

.input-group__btn:hover {
  background: var(--card-2);
  color: var(--text);
}

.field {
  display: block;
  margin-bottom: 14px;
}

.field__label {
  display: block;
  margin-bottom: 6px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 500;
}

.field__hint {
  margin: -6px 0 12px;
  color: var(--muted-2);
  font-size: 12px;
}

.form {
  display: block;
}

.form__actions {
  display: flex;
  gap: 10px;
  margin-top: 16px;
}

.form-error {
  margin: 10px 0 0;
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  background: var(--danger-soft);
  color: #ff9b9b;
  font-size: 13px;
}

.form-ok {
  margin: 10px 0 0;
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  background: rgba(57, 217, 138, 0.12);
  color: #7ce7b0;
  font-size: 13px;
}

.pill {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--card-2);
  color: var(--muted);
  font-size: 12px;
  line-height: 1.6;
  white-space: nowrap;
}

.pill--accent {
  background: var(--accent-soft);
  color: var(--accent);
}

.pill--ok {
  background: rgba(57, 217, 138, 0.12);
  color: var(--ok);
}

.pill--danger {
  background: var(--danger-soft);
  color: var(--danger);
}

/* ==========================================================================
   应用骨架 / 导航
   ========================================================================== */
.app {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.nav {
  position: sticky;
  top: 0;
  z-index: 40;
  display: flex;
  align-items: center;
  gap: 14px;
  height: var(--nav-h);
  padding: 0 16px;
  background: rgba(15, 17, 21, 0.92);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line-soft);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--text);
  font-weight: 600;
  font-size: 15px;
  letter-spacing: 0.2px;
  text-decoration: none;
  flex: 0 0 auto;
}

.brand:hover {
  text-decoration: none;
}

.brand__mark {
  display: inline-flex;
  color: var(--accent);
}

.nav__links {
  display: flex;
  align-items: center;
  gap: 2px;
  margin-left: 6px;
}

.nav__link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 36px;
  padding: 0 11px;
  border-radius: 9px;
  color: var(--muted);
  font-size: 14px;
  text-decoration: none;
  transition: background-color 0.15s ease, color 0.15s ease;
}

.nav__link:hover {
  background: var(--card-2);
  color: var(--text);
  text-decoration: none;
}

.nav__link.is-active {
  background: var(--accent-soft);
  color: var(--accent);
}

.nav__right {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-left: auto;
}

.nav__upload {
  min-height: 34px;
  padding: 6px 12px;
  border-radius: 9px;
}

.nav__user {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  max-width: 160px;
  color: var(--muted);
  font-size: 13px;
}

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

.nav__username {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.tabbar {
  display: none;
}

.view {
  flex: 1 0 auto;
  outline: none;
  padding: 18px 16px 40px;
}

.view[aria-busy='true'] {
  cursor: progress;
}

/* ==========================================================================
   页面通用
   ========================================================================== */
.page {
  max-width: 1080px;
  margin: 0 auto;
}

.page--wide {
  max-width: 1320px;
}

.page--narrow {
  max-width: 680px;
}

.page-head {
  margin-bottom: 18px;
}

.page-head__row {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.page-head__title {
  margin: 0;
  font-size: 21px;
  font-weight: 650;
  letter-spacing: 0.2px;
}

.page-head__sub {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.page-head__actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.link-back {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  margin-bottom: 10px;
  color: var(--muted);
  font-size: 13px;
  text-decoration: none;
}

.link-back:hover {
  color: var(--text);
  text-decoration: none;
}

.card {
  margin-bottom: 16px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--card);
}

.card__title {
  margin: 0 0 12px;
  font-size: 15px;
  font-weight: 600;
}

.card__text {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
}

.kv {
  margin: 0;
  display: grid;
  gap: 10px;
}

.kv__row {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  border-bottom: 1px solid var(--line-soft);
  padding-bottom: 8px;
}

.kv__row:last-child {
  border-bottom: 0;
  padding-bottom: 0;
}

.kv__k {
  color: var(--muted);
  font-size: 13px;
}

.kv__v {
  margin: 0;
  text-align: right;
  font-size: 13px;
  overflow-wrap: anywhere;
}

.empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 56px 20px;
  border: 1px dashed var(--line);
  border-radius: var(--radius-lg);
  color: var(--muted);
  text-align: center;
}

.empty__icon {
  color: var(--muted-2);
}

.empty__title {
  margin: 4px 0 0;
  color: var(--text);
  font-size: 15px;
  font-weight: 600;
}

.empty__text {
  margin: 0;
  max-width: 420px;
  color: var(--muted);
  font-size: 13px;
}

.empty .btn {
  margin-top: 10px;
}

.empty-wrap:empty {
  display: none;
}

/* 骨架屏 */
.sk-card {
  border-radius: var(--radius);
  background: linear-gradient(100deg, #171a21 20%, #1f242e 40%, #171a21 60%);
  background-size: 220% 100%;
  animation: shimmer 1.3s ease-in-out infinite;
  min-height: 120px;
}

@keyframes shimmer {
  0% {
    background-position: 120% 0;
  }
  100% {
    background-position: -20% 0;
  }
}

.sk-line {
  height: 14px;
  width: 180px;
  border-radius: 6px;
  background: #1f242e;
}

.sk-line--lg {
  height: 24px;
  width: 280px;
  max-width: 60vw;
}

.wall-skeleton {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
}

.wall-skeleton .sk-card {
  aspect-ratio: 1;
}

.sentinel {
  height: 1px;
}

.list-footer {
  display: flex;
  justify-content: center;
  padding: 18px 0 8px;
  min-height: 24px;
}

.list-footer__text {
  color: var(--muted-2);
  font-size: 12px;
}

/* ==========================================================================
   相册网格
   ========================================================================== */
.album-grid-wrap {
  min-height: 200px;
}

.album-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 14px;
}

.album-grid--skeleton .sk-card {
  aspect-ratio: 4 / 3;
}

.album-card {
  display: block;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--card);
  overflow: hidden;
  color: inherit;
  text-decoration: none;
  transition: border-color 0.16s ease, transform 0.16s ease, background-color 0.16s ease;
}

.album-card:hover {
  background: var(--card-2);
  border-color: #313847;
  transform: translateY(-1px);
  text-decoration: none;
}

.album-card__cover {
  position: relative;
  aspect-ratio: 4 / 3;
  background: var(--bg-soft);
  overflow: hidden;
}

.album-card__img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.album-card__ph {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  color: var(--muted-2);
}

.album-card__badge {
  position: absolute;
  right: 8px;
  bottom: 8px;
  padding: 2px 8px;
  border-radius: 999px;
  background: rgba(9, 11, 15, 0.72);
  color: #dfe4ee;
  font-size: 11px;
  backdrop-filter: blur(4px);
}

.album-card__body {
  padding: 11px 13px 13px;
}

.album-card__title {
  margin: 0;
  font-size: 15px;
  font-weight: 600;
  line-height: 1.35;
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

.album-card__desc {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 12px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.album-card__meta {
  margin: 6px 0 0;
  color: var(--muted-2);
  font-size: 12px;
}

/* ==========================================================================
   图墙（相册详情 / 时间线共用）
   ========================================================================== */
.media-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 4px;
}

.tile {
  position: relative;
  display: block;
  padding: 0;
  border: 0;
  border-radius: var(--radius-sm);
  background: var(--card);
  aspect-ratio: 1;
  overflow: hidden;
  cursor: pointer;
}

.tile::after {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.04);
  pointer-events: none;
}

.tile__img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 0.25s ease, opacity 0.2s ease;
  opacity: 0.001;
}

.tile__img[src] {
  opacity: 1;
}

.tile:hover .tile__img {
  transform: scale(1.03);
}

.tile__img.is-broken {
  display: none;
}

.tile__ph {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--muted-2);
  background: var(--card);
}

.tile__badge {
  position: absolute;
  left: 6px;
  bottom: 6px;
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 1px 6px;
  border-radius: 999px;
  background: rgba(9, 11, 15, 0.72);
  color: #eef1f6;
  font-size: 10px;
  line-height: 1.7;
  backdrop-filter: blur(4px);
  pointer-events: none;
}

.tile__play {
  display: inline-flex;
}

.tile__dur {
  font-variant-numeric: tabular-nums;
}

/* 多选 */
.tile__check {
  position: absolute;
  top: 6px;
  right: 6px;
  display: none;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.85);
  background: rgba(9, 11, 15, 0.45);
  color: transparent;
  transition: background-color 0.15s ease, color 0.15s ease;
}

.tile.is-checkable .tile__check {
  display: inline-flex;
}

.tile.is-selected .tile__check {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

.tile.is-selected::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  box-shadow: inset 0 0 0 3px var(--accent);
  z-index: 2;
}

.tile.is-selected .tile__img {
  opacity: 0.75;
}

/* 多选底部条 */
.selbar {
  position: fixed;
  left: 50%;
  bottom: calc(12px + env(safe-area-inset-bottom, 0px));
  transform: translateX(-50%);
  z-index: 45;
  display: flex;
  align-items: center;
  gap: 8px;
  width: min(680px, calc(100vw - 24px));
  padding: 9px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: rgba(23, 26, 33, 0.97);
  box-shadow: var(--shadow);
  backdrop-filter: blur(10px);
}

.selbar__count {
  color: var(--text);
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
}

.selbar__spacer {
  flex: 1 1 auto;
}

/* ==========================================================================
   时间线
   ========================================================================== */
.filters {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 12px;
  flex-wrap: wrap;
}

.filters__item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.filters__label {
  color: var(--muted-2);
  font-size: 12px;
  white-space: nowrap;
}

.filters .select {
  width: auto;
  min-width: 116px;
  min-height: 34px;
  padding: 5px 30px 5px 10px;
  font-size: 13px;
  border-radius: 9px;
}

.seg {
  display: inline-flex;
  padding: 2px;
  gap: 2px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--bg-soft);
}

.seg__btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  min-height: 30px;
  padding: 4px 10px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
  font-size: 13px;
  cursor: pointer;
  transition: background-color 0.15s ease, color 0.15s ease;
}

.seg__btn:hover {
  color: var(--text);
}

.seg__btn[aria-pressed='true'] {
  background: var(--accent-soft);
  color: var(--accent);
}

.timeline-groups {
  min-height: 200px;
}

.tl-month {
  position: relative;
  margin-bottom: 8px;
}

.tl-month__title {
  position: sticky;
  top: var(--nav-h);
  z-index: 5;
  display: flex;
  align-items: baseline;
  gap: 8px;
  margin: 0;
  padding: 8px 2px 8px;
  background: linear-gradient(to bottom, var(--bg) 65%, rgba(15, 17, 21, 0));
  color: var(--text);
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 0.3px;
}

.tl-month__count {
  color: var(--muted-2);
  font-size: 11px;
  font-weight: 400;
}

.tl-month__title::after {
  content: '';
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 1px;
  background: var(--line-soft);
}

/* ==========================================================================
   统计卡片 / 表格（管理页）
   ========================================================================== */
.stats {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
  margin-bottom: 20px;
}

.stats__skeleton {
  display: contents;
}

.sk-card--stat {
  min-height: 84px;
}

.stat-card {
  display: grid;
  grid-template-columns: auto 1fr;
  grid-template-rows: auto auto;
  column-gap: 10px;
  align-items: center;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--card);
}

.stat-card__icon {
  grid-row: span 2;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: var(--accent-soft);
  color: var(--accent);
}

.stat-card__body {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.stat-card__value {
  font-size: 19px;
  font-weight: 650;
  line-height: 1.2;
}

.stat-card__label {
  color: var(--muted-2);
  font-size: 12px;
}

.stat-card__sub {
  grid-column: 2;
  color: var(--muted-2);
  font-size: 11px;
}

.table-wrap {
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--card);
  overflow-x: auto;
}

.table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.table th,
.table td {
  padding: 11px 12px;
  text-align: left;
  border-bottom: 1px solid var(--line-soft);
  vertical-align: middle;
}

.table th {
  color: var(--muted-2);
  font-size: 12px;
  font-weight: 500;
  white-space: nowrap;
}

.table tr:last-child td {
  border-bottom: 0;
}

.table tbody tr:hover {
  background: var(--card-2);
}

.table tr.is-disabled td {
  opacity: 0.62;
}

.table__strong {
  font-weight: 600;
}

.table__muted {
  color: var(--muted-2);
}

.ta-right {
  text-align: right !important;
}

.row-actions {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 6px;
  justify-content: flex-end;
}

/* ==========================================================================
   Toast
   ========================================================================== */
.toast-root {
  position: fixed;
  left: 50%;
  bottom: calc(20px + env(safe-area-inset-bottom, 0px));
  transform: translateX(-50%);
  z-index: 90;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  width: min(440px, calc(100vw - 24px));
  pointer-events: none;
}

.toast {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  max-width: 100%;
  padding: 10px 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(29, 33, 42, 0.98);
  color: var(--text);
  font-size: 13px;
  line-height: 1.45;
  box-shadow: var(--shadow);
  pointer-events: auto;
  cursor: pointer;
  opacity: 0;
  transform: translateY(8px);
  transition: opacity 0.2s ease, transform 0.2s ease;
}

.toast.is-in {
  opacity: 1;
  transform: translateY(0);
}

.toast--success {
  border-color: rgba(57, 217, 138, 0.45);
}

.toast--success .icon {
  color: var(--ok);
}

.toast--error {
  border-color: rgba(255, 92, 92, 0.5);
}

.toast--error .icon {
  color: var(--danger);
}

.toast--warn {
  border-color: rgba(255, 176, 32, 0.5);
}

.toast__text {
  overflow-wrap: anywhere;
}

/* ==========================================================================
   弹窗
   ========================================================================== */
dialog.modal {
  width: min(440px, calc(100vw - 28px));
  max-height: calc(100vh - 60px);
  padding: 0;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--card);
  color: var(--text);
  box-shadow: var(--shadow);
  overflow: visible;
}

dialog.modal::backdrop {
  background: rgba(5, 6, 9, 0.68);
  backdrop-filter: blur(3px);
}

.modal__form {
  display: flex;
  flex-direction: column;
  max-height: calc(100vh - 64px);
}

.modal__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px 8px;
}

.modal__title {
  margin: 0;
  font-size: 16px;
  font-weight: 650;
}

.modal__body {
  padding: 4px 16px 8px;
  overflow-y: auto;
}

.modal__text {
  margin: 6px 0 12px;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.6;
}

.modal__foot {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  padding: 12px 16px 16px;
}

/* ==========================================================================
   灯箱
   ========================================================================== */
.lb {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #06070a;
}

.lb__chrome {
  position: relative;
  display: flex;
  flex-direction: column;
  width: 100%;
  height: 100%;
  padding: env(safe-area-inset-top, 0px) 0 env(safe-area-inset-bottom, 0px);
}

.lb__top {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  min-height: 52px;
  z-index: 3;
}

.lb__counter {
  color: #b9c0cd;
  font-size: 13px;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.lb__tools {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-left: auto;
}

.lb__btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  min-width: 36px;
  min-height: 36px;
  padding: 6px 10px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 9px;
  background: rgba(255, 255, 255, 0.06);
  color: #e6e8ee;
  font-size: 13px;
  cursor: pointer;
  transition: background-color 0.15s ease, opacity 0.15s ease;
}

.lb__btn:hover {
  background: rgba(255, 255, 255, 0.14);
}

.lb__btn[disabled] {
  opacity: 0.55;
  cursor: default;
}

.lb__btn.is-busy {
  opacity: 0.75;
}

.lb__stage {
  position: relative;
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 4px 8px;
  touch-action: pan-y;
}

.lb__stage.is-loading::after {
  content: '';
  position: absolute;
  width: 34px;
  height: 34px;
  border: 3px solid rgba(255, 255, 255, 0.22);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

.lb__img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  border-radius: 2px;
  user-select: none;
}

.lb__video {
  max-width: 100%;
  max-height: 100%;
  border-radius: 4px;
  background: #000;
}

.lb__nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  z-index: 4;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 42px;
  height: 42px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 50%;
  background: rgba(20, 22, 28, 0.66);
  color: #dfe4ee;
  cursor: pointer;
  transition: background-color 0.15s ease;
}

.lb__nav:hover {
  background: rgba(255, 255, 255, 0.16);
}

.lb__nav--prev {
  left: 10px;
}

.lb__nav--next {
  right: 10px;
}

.lb__bottom {
  padding: 8px 14px 16px;
  min-height: 58px;
}

.lb__info-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 16px;
}

.lb__info-row {
  display: inline-flex;
  align-items: baseline;
  gap: 5px;
  font-size: 12px;
}

.lb__info-k {
  color: rgba(230, 232, 238, 0.45);
}

.lb__info-v {
  color: #cfd5e1;
}

.lb__info-name {
  margin-top: 4px;
  color: rgba(230, 232, 238, 0.4);
  font-size: 11px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ==========================================================================
   上传
   ========================================================================== */
#upload-root {
  position: fixed;
  inset: 0;
  z-index: 70;
  display: flex;
  align-items: flex-end;
  justify-content: center;
}

#upload-root[hidden] {
  display: none !important;
}

.up-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(5, 6, 9, 0.6);
  backdrop-filter: blur(2px);
}

.up-panel {
  position: relative;
  display: flex;
  flex-direction: column;
  width: min(560px, calc(100vw - 20px));
  max-height: min(88vh, 760px);
  margin-bottom: 10px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--card);
  box-shadow: var(--shadow);
  overflow: hidden;
  animation: sheet-in 0.18s ease-out;
}

@keyframes sheet-in {
  from {
    transform: translateY(10px);
    opacity: 0;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}

.up-panel__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 13px 16px 8px;
}

.up-panel__title {
  margin: 0;
  font-size: 16px;
  font-weight: 650;
}

.up-panel__body {
  padding: 4px 16px;
  overflow-y: auto;
}

.up-panel__album {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
}

.up-panel__album-label {
  color: var(--muted-2);
  font-size: 12px;
  white-space: nowrap;
}

.up-panel__foot {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 16px 14px;
  border-top: 1px solid var(--line-soft);
}

.up-summary {
  flex: 1 1 auto;
  color: var(--muted);
  font-size: 12px;
}

.up-drop {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 22px 14px;
  border: 1px dashed var(--line);
  border-radius: var(--radius-lg);
  background: var(--bg-soft);
  text-align: center;
  transition: border-color 0.15s ease, background-color 0.15s ease;
}

.up-drop.is-hover {
  border-color: var(--accent);
  background: var(--accent-soft);
}

.up-drop.is-disabled {
  opacity: 0.55;
}

.up-drop__icon {
  color: var(--muted-2);
}

.up-drop__hint {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
}

.up-drop__or {
  margin: 0;
  color: var(--muted-2);
  font-size: 12px;
}

.up-progress {
  margin: 12px 0 6px;
}

.up-progress__bar {
  height: 6px;
  border-radius: 999px;
  background: var(--card-2);
  overflow: hidden;
}

.up-progress__fill {
  height: 100%;
  width: 0;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--accent), #6ea8ff);
  transition: width 0.2s ease;
}

.up-progress__label {
  margin-top: 5px;
  color: var(--muted-2);
  font-size: 11px;
  font-variant-numeric: tabular-nums;
}

.up-list {
  list-style: none;
  margin: 10px 0 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.up-item {
  padding: 8px 10px;
  border: 1px solid var(--line-soft);
  border-radius: var(--radius);
  background: var(--bg-soft);
}

.up-item__main {
  min-width: 0;
}

.up-item__name {
  color: var(--text);
  font-size: 13px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.up-item__meta {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  margin-top: 2px;
  color: var(--muted-2);
  font-size: 11px;
}

.up-item__status {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.up-item__track {
  display: block;
  height: 3px;
  margin-top: 6px;
  border-radius: 999px;
  background: var(--card-2);
  overflow: hidden;
}

.up-item__fill {
  display: block;
  height: 100%;
  width: 0;
  background: var(--accent);
  transition: width 0.15s ease;
}

.up-item.is-done .up-item__fill {
  background: var(--ok);
}

.up-item.is-failed .up-item__fill {
  background: var(--danger);
}

.up-item.is-failed .up-item__status {
  color: #ff9b9b;
}

.up-item.is-done .up-item__status {
  color: var(--ok);
}

/* 全窗口拖拽覆盖层 */
.drop-overlay {
  position: fixed;
  inset: 0;
  z-index: 75;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(6, 7, 10, 0.72);
  backdrop-filter: blur(2px);
  pointer-events: none;
}

.drop-overlay__inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  padding: 34px 46px;
  border: 2px dashed var(--accent);
  border-radius: 18px;
  background: rgba(76, 141, 255, 0.08);
  color: var(--accent);
}

.drop-overlay__text {
  margin: 0;
  font-size: 15px;
  font-weight: 600;
}

/* ==========================================================================
   登录页
   ========================================================================== */
.login-body {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 24px 16px;
  background: radial-gradient(1200px 600px at 50% -10%, #1a2130 0%, var(--bg) 60%);
}

.login {
  width: min(380px, 100%);
}

.login__card {
  padding: 28px 24px 22px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--card);
  box-shadow: var(--shadow);
}

.login__brand {
  text-align: center;
  margin-bottom: 22px;
}

.login__mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 48px;
  height: 48px;
  margin-bottom: 10px;
  border-radius: 14px;
  background: var(--accent-soft);
  color: var(--accent);
}

.login__title {
  margin: 0;
  font-size: 20px;
  font-weight: 650;
}

.login__subtitle {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.login__form {
  display: block;
}

.login__submit {
  margin-top: 6px;
  min-height: 42px;
}

.login__footer {
  margin: 18px 0 0;
  color: var(--muted-2);
  font-size: 12px;
  text-align: center;
}

.noscript {
  padding: 20px;
  color: var(--muted);
  text-align: center;
}

/* ==========================================================================
   响应式
   ========================================================================== */

/* 小屏（>= 375px 即目标最小宽度） */
@media (max-width: 767px) {
  .nav__links {
    display: none;
  }

  .nav__username {
    display: none;
  }

  .nav__upload {
    display: none;
  }

  .nav {
    gap: 10px;
    padding: 0 12px;
  }

  .brand__name {
    font-size: 14px;
  }

  .view {
    padding: 14px 12px calc(var(--tab-h) + 26px);
  }

  .tabbar {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 50;
    display: block;
    padding-bottom: env(safe-area-inset-bottom, 0px);
    background: rgba(15, 17, 21, 0.96);
    border-top: 1px solid var(--line-soft);
    backdrop-filter: blur(12px);
  }

  .tabbar__inner {
    display: flex;
    align-items: stretch;
    justify-content: space-around;
    height: var(--tab-h);
  }

  .tab {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    flex: 1 1 0;
    min-width: 0;
    padding: 6px 2px;
    border: 0;
    background: transparent;
    color: var(--muted-2);
    font-size: 10px;
    text-decoration: none;
    cursor: pointer;
  }

  .tab:hover {
    text-decoration: none;
  }

  .tab.is-active {
    color: var(--accent);
  }

  .tab__label {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 100%;
  }

  .tab--primary .tab__fab {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    margin-top: -18px;
    border-radius: 50%;
    background: var(--accent);
    color: #fff;
    box-shadow: 0 6px 16px rgba(76, 141, 255, 0.4);
  }

  .tab--primary .tab__label {
    color: var(--accent);
  }

  .selbar {
    bottom: calc(var(--tab-h) + 10px + env(safe-area-inset-bottom, 0px));
  }

  .toast-root {
    bottom: calc(var(--tab-h) + 14px + env(safe-area-inset-bottom, 0px));
  }

  .page-head__title {
    font-size: 19px;
  }

  .page-head__actions {
    width: 100%;
  }

  .page-head__actions .btn {
    flex: 1 1 auto;
    justify-content: center;
  }

  .lb__nav--prev {
    left: 4px;
  }

  .lb__nav--next {
    right: 4px;
  }

  .lb__bottom {
    padding: 6px 10px 12px;
  }

  .lb__info-row {
    font-size: 11px;
  }

  .lb__btn .lb__btn-label {
    display: none;
  }

  #upload-root {
    align-items: flex-end;
  }

  .up-panel {
    width: 100%;
    max-height: 92vh;
    margin-bottom: 0;
    border-radius: 16px 16px 0 0;
    padding-bottom: env(safe-area-inset-bottom, 0px);
  }

  /* 表格转卡片 */
  .table-wrap {
    border: 0;
    background: transparent;
    overflow: visible;
  }

  .table,
  .table tbody,
  .table tr,
  .table td {
    display: block;
    width: 100%;
  }

  .table thead {
    display: none;
  }

  .table tr {
    margin-bottom: 10px;
    padding: 10px 12px;
    border: 1px solid var(--line);
    border-radius: var(--radius-lg);
    background: var(--card);
  }

  .table td {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 4px 0;
    border: 0;
    text-align: left !important;
  }

  .table td::before {
    content: attr(data-label);
    color: var(--muted-2);
    font-size: 12px;
    flex: 0 0 auto;
  }

  .table td.ta-right {
    justify-content: flex-start;
    padding-top: 8px;
  }

  .table td.ta-right::before {
    content: none;
  }

  .row-actions {
    width: 100%;
    justify-content: flex-start;
  }
}

/* 平板 / 桌面 */
@media (min-width: 768px) {
  .view {
    padding: 22px 24px 52px;
  }

  .album-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
  }

  .media-grid {
    grid-template-columns: repeat(3, 1fr);
    gap: 6px;
  }

  .wall-skeleton {
    grid-template-columns: repeat(4, 1fr);
  }

  .stats {
    grid-template-columns: repeat(4, 1fr);
  }

  .tl-month__title {
    font-size: 15px;
  }
}

@media (min-width: 1200px) {
  .album-grid {
    grid-template-columns: repeat(4, 1fr);
  }

  .media-grid {
    grid-template-columns: repeat(6, 1fr);
    gap: 7px;
  }

  .wall-skeleton {
    grid-template-columns: repeat(6, 1fr);
  }

  .view {
    padding: 26px 32px 60px;
  }
}

/* 横屏手机：底部 tab 与安全区 */
@media (max-height: 480px) and (max-width: 767px) {
  :root {
    --tab-h: 50px;
  }

  .tab--primary .tab__fab {
    width: 34px;
    height: 34px;
    margin-top: -14px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
    scroll-behavior: auto !important;
  }
}

/* 打印（管理员偶尔打印名单） */
@media print {
  .nav,
  .tabbar,
  .toast-root,
  .selbar {
    display: none !important;
  }

  body {
    background: #fff;
    color: #000;
  }
}
