/* Karin · Memories Album — 世界书同款清爽蓝（冷灰蓝底 + 白卡 + 唯一强调蓝）
 * 配色令牌对齐 karin-worldbook.css：--wb-bg #F5F8FC / --wb-card #FFF /
 * --wb-ink #1C2026 / --wb-blue #4B8BF5 / --wb-border #E5EAF0。
 * 相册自己的衬线标题 + 手写体装饰保留，只换色系。 */

.mi-album-app {
  --alb-bg: #F5F8FC;
  --alb-cream: #FFFFFF;
  --alb-white: #ffffff;
  --alb-ink: #1C2026;
  --alb-brown: #4B8BF5;
  --alb-brown-soft: #5AA0F2;
  --alb-muted: #6B7480;
  --alb-line: #E5EAF0;
  --alb-shadow: 0 12px 40px rgba(28, 32, 38, 0.08);
  --alb-shadow-soft: 0 8px 24px rgba(28, 32, 38, 0.06);
  --alb-r: 22px;
  --alb-r-lg: 28px;
  --alb-serif: "Cormorant Garamond", "Noto Serif SC", serif;
  --alb-script: "Great Vibes", cursive;
  --alb-sans: "Jost", "Noto Sans SC", sans-serif;

  position: relative;
  display: flex;
  flex-direction: column;
  min-height: 100%;
  height: 100%;
  background: var(--alb-bg);
  color: var(--alb-ink);
  font-family: var(--alb-sans);
  overflow: hidden;
  -webkit-tap-highlight-color: transparent;
}

.mi-album-app__scroll {
  flex: 1;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  padding-bottom: calc(100px + env(safe-area-inset-bottom, 0px));
}

/* ── Header ── */
.mi-album-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: calc(12px + env(safe-area-inset-top, 0px)) 20px 8px;
}

.mi-album-header--detail {
  align-items: center;
  padding-bottom: 12px;
}

.mi-album-header__side {
  width: 40px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.mi-album-header__brand {
  flex: 1;
  min-width: 0;
}

.mi-album-header__title {
  margin: 0;
  font-family: var(--alb-serif);
  font-size: 32px;
  font-weight: 600;
  line-height: 1;
  letter-spacing: -0.01em;
}

.mi-album-header__script {
  display: block;
  margin-top: -4px;
  font-family: var(--alb-script);
  font-size: 34px;
  font-weight: 400;
  color: var(--alb-brown-soft);
  line-height: 1.1;
}

.mi-album-header__center {
  flex: 1;
  text-align: center;
  min-width: 0;
}

.mi-album-header__album-title {
  margin: 0;
  font-family: var(--alb-serif);
  font-size: 26px;
  font-weight: 600;
  line-height: 1.1;
}

.mi-album-header__album-date {
  display: block;
  margin-top: 2px;
  font-family: var(--alb-script);
  font-size: 22px;
  color: var(--alb-brown-soft);
}

.mi-album-header__avatar {
  width: 44px;
  height: 44px;
  padding: 0;
  border: 2px solid rgba(255, 255, 255, 0.9);
  border-radius: 50%;
  background: #E5EAF0 center/cover no-repeat;
  box-shadow: var(--alb-shadow-soft);
  cursor: pointer;
  flex-shrink: 0;
}

.mi-album-icon-btn {
  width: 40px;
  height: 40px;
  padding: 0;
  border: none;
  border-radius: 50%;
  background: transparent;
  color: var(--alb-ink);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.18s ease, background 0.18s ease;
}

.mi-album-icon-btn svg {
  width: 22px;
  height: 22px;
}

.mi-album-icon-btn:active {
  transform: scale(0.92);
}

.mi-album-icon-btn--ghost {
  background: rgba(255, 255, 255, 0.55);
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.05);
}

/* ── Featured Carousel ── */
.mi-album-carousel-wrap {
  position: relative;
  padding: 8px 20px 0;
}

.mi-album-carousel {
  display: flex;
  gap: 16px;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  padding-bottom: 8px;
}

.mi-album-carousel::-webkit-scrollbar {
  display: none;
}

.mi-album-carousel__slide {
  flex: 0 0 calc(100% - 36px);
  scroll-snap-align: center;
  position: relative;
}

.mi-album-carousel__stack {
  position: relative;
  min-height: 280px;
}

.mi-album-carousel__card {
  position: relative;
  border: none;
  padding: 0;
  border-radius: var(--alb-r-lg);
  overflow: hidden;
  background: var(--alb-cream);
  box-shadow: var(--alb-shadow);
  cursor: pointer;
  text-align: left;
  width: 100%;
  display: block;
}

.mi-album-carousel__card--back {
  position: absolute;
  right: -14px;
  bottom: -10px;
  width: 92%;
  height: 92%;
  z-index: 0;
  transform: rotate(2.5deg);
  pointer-events: none;
  opacity: 0.55;
}

.mi-album-carousel__card--front {
  position: relative;
  z-index: 2;
}

.mi-album-carousel__card--front::after {
  content: "";
  position: absolute;
  right: 0;
  bottom: 0;
  width: 48px;
  height: 48px;
  background: linear-gradient(135deg, transparent 50%, rgba(245, 248, 252, 0.95) 50%);
  border-bottom-right-radius: var(--alb-r-lg);
  pointer-events: none;
}

.mi-album-carousel__img {
  display: block;
  width: 100%;
  aspect-ratio: 4 / 5;
  object-fit: cover;
  background: #E5EAF0;
}

.mi-album-carousel__overlay {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  padding: 18px;
  background: linear-gradient(180deg, transparent 45%, rgba(0, 0, 0, 0.42) 100%);
  pointer-events: none;
}

.mi-album-carousel__overlay-row {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 12px;
  pointer-events: auto;
}

.mi-album-carousel__name {
  margin: 0 0 4px;
  font-family: var(--alb-serif);
  font-size: 26px;
  font-weight: 600;
  color: #fff;
  line-height: 1.1;
}

.mi-album-carousel__meta {
  margin: 0;
  font-size: 11px;
  font-weight: 400;
  letter-spacing: 0.04em;
  color: rgba(255, 255, 255, 0.82);
}

.mi-album-carousel__arrow {
  width: 36px;
  height: 36px;
  border: none;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.22);
  backdrop-filter: blur(8px);
  color: #fff;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: transform 0.18s ease, background 0.18s ease;
}

.mi-album-carousel__arrow svg {
  width: 18px;
  height: 18px;
}

.mi-album-carousel__arrow:active {
  transform: scale(0.92);
  background: rgba(255, 255, 255, 0.35);
}

.mi-album-carousel__dots {
  display: flex;
  justify-content: center;
  gap: 6px;
  margin-top: 14px;
}

.mi-album-carousel__dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  border: none;
  padding: 0;
  background: rgba(0, 0, 0, 0.12);
  cursor: pointer;
  transition: background 0.2s, transform 0.2s;
}

.mi-album-carousel__dot.is-active {
  background: var(--alb-ink);
  transform: scale(1.15);
}

/* ── Quote ── */
.mi-album-quote {
  position: relative;
  text-align: center;
  padding: 28px 32px 20px;
  overflow: hidden;
}

.mi-album-quote__text {
  margin: 0;
  font-family: var(--alb-serif);
  font-size: 22px;
  font-weight: 400;
  line-height: 1.45;
  color: var(--alb-ink);
}

.mi-album-quote__text em {
  font-family: var(--alb-script);
  font-style: normal;
  font-size: 28px;
  color: var(--alb-brown-soft);
}

.mi-album-quote__flower {
  position: absolute;
  right: 18px;
  top: 50%;
  transform: translateY(-50%);
  width: 72px;
  height: 72px;
  opacity: 0.18;
  pointer-events: none;
}

/* ── Category Nav ── */
.mi-album-cats {
  display: flex;
  align-items: stretch;
  justify-content: space-around;
  gap: 4px;
  margin: 8px 20px 0;
  padding: 14px 8px 12px;
  background: var(--alb-white);
  border-radius: 999px;
  box-shadow: var(--alb-shadow-soft);
}

.mi-album-cats__item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 4px 2px;
  border: none;
  background: none;
  cursor: pointer;
  color: var(--alb-muted);
  transition: color 0.2s;
}

.mi-album-cats__item svg {
  width: 20px;
  height: 20px;
  opacity: 0.55;
}

.mi-album-cats__item span {
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0.02em;
}

.mi-album-cats__item.is-active {
  color: var(--alb-ink);
}

.mi-album-cats__item.is-active svg {
  opacity: 1;
}

.mi-album-cats__item.is-active::after {
  content: "";
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: var(--alb-ink);
  margin-top: -2px;
}

/* ── Album Grid (home grid mode) ── */
.mi-album-albums {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
  padding: 20px;
}

.mi-album-albums__card {
  border: none;
  padding: 0;
  border-radius: var(--alb-r);
  overflow: hidden;
  background: var(--alb-white);
  box-shadow: var(--alb-shadow-soft);
  cursor: pointer;
  text-align: left;
}

.mi-album-albums__img {
  display: block;
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
  background: #E5EAF0;
}

.mi-album-albums__info {
  padding: 10px 12px 12px;
}

.mi-album-albums__name {
  margin: 0 0 2px;
  font-family: var(--alb-serif);
  font-size: 17px;
  font-weight: 600;
}

.mi-album-albums__count {
  margin: 0;
  font-size: 11px;
  color: var(--alb-muted);
}

/* ── Bottom Dock ── */
.mi-album-dock {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 28px;
  padding: 12px 24px calc(14px + env(safe-area-inset-bottom, 0px));
  background: linear-gradient(180deg, transparent, rgba(245, 248, 252, 0.92) 28%, var(--alb-bg) 100%);
  pointer-events: none;
}

.mi-album-dock > * {
  pointer-events: auto;
}

.mi-album-dock__side {
  width: 44px;
  height: 44px;
  border: none;
  border-radius: 50%;
  background: var(--alb-white);
  box-shadow: var(--alb-shadow-soft);
  color: var(--alb-ink);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.18s ease;
}

.mi-album-dock__side svg {
  width: 20px;
  height: 20px;
}

.mi-album-dock__side.is-active {
  background: var(--alb-ink);
  color: #fff;
}

.mi-album-dock__side:active {
  transform: scale(0.94);
}

.mi-album-dock__cam {
  width: 58px;
  height: 58px;
  border: none;
  border-radius: 50%;
  background: linear-gradient(145deg, var(--alb-brown-soft), var(--alb-brown));
  box-shadow: 0 10px 28px rgba(75, 139, 245, 0.35);
  color: #fff;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.18s ease;
}

.mi-album-dock__cam svg {
  width: 26px;
  height: 26px;
}

.mi-album-dock__cam:active {
  transform: scale(0.94);
}

/* ── Detail View Toggle ── */
.mi-album-view-toggle {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 20px 12px;
}

.mi-album-view-toggle__pill {
  display: flex;
  padding: 4px;
  background: var(--alb-white);
  border-radius: 999px;
  box-shadow: var(--alb-shadow-soft);
}

.mi-album-view-toggle__btn {
  width: 36px;
  height: 32px;
  border: none;
  border-radius: 999px;
  background: transparent;
  color: var(--alb-muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s, color 0.2s;
}

.mi-album-view-toggle__btn svg {
  width: 16px;
  height: 16px;
}

.mi-album-view-toggle__btn.is-active {
  background: var(--alb-ink);
  color: #fff;
}

/* ── Masonry Grid ── */
.mi-album-masonry {
  columns: 2;
  column-gap: 10px;
  padding: 0 16px;
}

.mi-album-masonry__item {
  break-inside: avoid;
  margin-bottom: 10px;
  position: relative;
}

.mi-album-masonry__btn {
  display: block;
  width: 100%;
  padding: 0;
  border: none;
  border-radius: var(--alb-r);
  overflow: hidden;
  background: #E5EAF0;
  cursor: pointer;
  position: relative;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.06);
}

.mi-album-masonry__btn img {
  display: block;
  width: 100%;
  object-fit: cover;
}

.mi-album-masonry__item--tall .mi-album-masonry__btn img {
  aspect-ratio: 3 / 4;
}

.mi-album-masonry__item--sq .mi-album-masonry__btn img {
  aspect-ratio: 1;
}

.mi-album-masonry__item--wide .mi-album-masonry__btn img {
  aspect-ratio: 4 / 5;
}

.mi-album-masonry__heart {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 28px;
  height: 28px;
  border: none;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.78);
  backdrop-filter: blur(6px);
  color: var(--alb-ink);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2;
  transition: transform 0.18s ease, background 0.18s ease;
}

.mi-album-masonry__heart svg {
  width: 14px;
  height: 14px;
}

.mi-album-masonry__heart.is-on {
  background: rgba(255, 255, 255, 0.92);
  color: #c45c5c;
}

.mi-album-masonry__heart.is-on svg {
  fill: currentColor;
}

.mi-album-masonry__pick {
  position: absolute;
  top: 10px;
  left: 10px;
  z-index: 3;
}

.mi-album-masonry__pick input {
  width: 20px;
  height: 20px;
  accent-color: var(--alb-ink);
}

.mi-album-masonry__item.is-selected .mi-album-masonry__btn {
  box-shadow: 0 0 0 2px var(--alb-brown);
}

/* Polaroid decorative */
.mi-album-polaroid {
  break-inside: avoid;
  margin-bottom: 10px;
  padding: 8px 8px 28px;
  background: #fff;
  border-radius: 4px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.1);
  transform: rotate(4deg);
}

.mi-album-polaroid__inner {
  position: relative;
  border-radius: 2px;
  overflow: hidden;
  background: #E5EAF0;
  aspect-ratio: 1;
}

.mi-album-polaroid__inner img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.mi-album-polaroid__play {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.18);
  color: #fff;
}

.mi-album-polaroid__play svg {
  width: 28px;
  height: 28px;
  opacity: 0.9;
}

/* ── List View ── */
.mi-album-list {
  padding: 0 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.mi-album-list__row {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 8px;
  border: none;
  border-radius: var(--alb-r);
  background: var(--alb-white);
  box-shadow: var(--alb-shadow-soft);
  cursor: pointer;
  text-align: left;
}

.mi-album-list__thumb {
  width: 64px;
  height: 64px;
  border-radius: 14px;
  object-fit: cover;
  background: #E5EAF0;
  flex-shrink: 0;
}

.mi-album-list__info {
  flex: 1;
  min-width: 0;
}

.mi-album-list__date {
  margin: 0 0 2px;
  font-size: 11px;
  color: var(--alb-muted);
}

.mi-album-list__tag {
  margin: 0;
  font-size: 12px;
  color: var(--alb-ink);
}

.mi-album-list__heart {
  width: 32px;
  height: 32px;
  border: none;
  border-radius: 50%;
  background: transparent;
  color: var(--alb-muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.mi-album-list__heart.is-on {
  color: #c45c5c;
}

.mi-album-list__heart.is-on svg {
  fill: currentColor;
}

/* ── Detail Footer ── */
.mi-album-detail-foot {
  text-align: center;
  padding: 24px 20px 12px;
  color: var(--alb-muted);
  font-size: 12px;
  letter-spacing: 0.02em;
}

.mi-album-detail-foot svg {
  display: block;
  width: 16px;
  height: 16px;
  margin: 8px auto 0;
  opacity: 0.4;
}

/* ── Empty ── */
.mi-album-empty {
  text-align: center;
  padding: 48px 28px 24px;
}

.mi-album-empty__script {
  margin: 0 0 8px;
  font-family: var(--alb-script);
  font-size: 42px;
  color: var(--alb-brown-soft);
  opacity: 0.5;
}

.mi-album-empty__hint {
  margin: 0 0 20px;
  font-size: 13px;
  color: var(--alb-muted);
  line-height: 1.55;
}

.mi-album-empty__btn {
  padding: 12px 28px;
  border: none;
  border-radius: 999px;
  background: var(--alb-ink);
  color: #fff;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
}

/* ── Sheets (menu / photo) ── */
.mi-album-sheet-backdrop {
  position: absolute;
  inset: 0;
  z-index: 30;
  background: rgba(16, 20, 26, 0.32);
  backdrop-filter: blur(4px);
  animation: mi-alb-fade-in 0.22s ease;
}

.mi-album-sheet {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 40;
  max-height: 88%;
  background: var(--alb-cream);
  border-radius: 24px 24px 0 0;
  box-shadow: 0 -12px 48px rgba(0, 0, 0, 0.12);
  display: flex;
  flex-direction: column;
  animation: mi-alb-slide-up 0.32s cubic-bezier(0.22, 1, 0.36, 1);
  overflow: hidden;
}

.mi-album-sheet__handle {
  width: 36px;
  height: 4px;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.12);
  margin: 10px auto 0;
  flex-shrink: 0;
}

.mi-album-sheet__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 20px 8px;
}

.mi-album-sheet__title {
  margin: 0;
  font-family: var(--alb-serif);
  font-size: 20px;
  font-weight: 600;
}

.mi-album-sheet__close {
  width: 32px;
  height: 32px;
  border: none;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.06);
  font-size: 18px;
  cursor: pointer;
  color: var(--alb-muted);
}

.mi-album-sheet__body {
  flex: 1;
  overflow-y: auto;
  padding: 0 20px calc(20px + env(safe-area-inset-bottom, 0px));
}

.mi-album-sheet__preview {
  width: 100%;
  max-height: 240px;
  object-fit: contain;
  border-radius: var(--alb-r);
  background: #E5EAF0;
  margin-bottom: 16px;
}

.mi-album-sheet__row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 0;
  border-bottom: 1px solid var(--alb-line);
}

.mi-album-sheet__row strong {
  display: block;
  font-size: 14px;
  font-weight: 500;
  margin-bottom: 2px;
}

.mi-album-sheet__row span {
  display: block;
  font-size: 11px;
  color: var(--alb-muted);
  line-height: 1.4;
}

.mi-album-sheet__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 16px 0;
}

.mi-album-sheet__act {
  padding: 8px 14px;
  border: 1px solid var(--alb-line);
  border-radius: 999px;
  background: var(--alb-white);
  font-size: 12px;
  color: var(--alb-ink);
  cursor: pointer;
  transition: background 0.18s;
}

.mi-album-sheet__act.is-on {
  background: var(--alb-ink);
  color: #fff;
  border-color: var(--alb-ink);
}

.mi-album-sheet__act--danger {
  color: #6B7480;
}

.mi-album-sheet__vision {
  width: 100%;
  box-sizing: border-box;
  min-height: 88px;
  padding: 12px;
  border: 1px solid var(--alb-line);
  border-radius: 14px;
  background: var(--alb-white);
  font-size: 12px;
  line-height: 1.55;
  resize: none;
  font-family: var(--alb-sans);
  margin-bottom: 10px;
}

.mi-album-sheet__groups {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 8px 0 12px;
}

.mi-album-sheet__grp {
  padding: 6px 12px;
  border: 1px solid var(--alb-line);
  border-radius: 999px;
  background: var(--alb-white);
  font-size: 11px;
  cursor: pointer;
}

.mi-album-sheet__grp.is-active {
  background: var(--alb-ink);
  color: #fff;
  border-color: var(--alb-ink);
}

.mi-album-grp-panel {
  margin: 12px 0;
  padding: 14px 16px;
  background: var(--alb-white);
  border-radius: var(--alb-r);
  box-shadow: var(--alb-shadow-soft);
}

.mi-album-grp-panel__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 10px;
}

.mi-album-grp-panel__head strong {
  font-size: 13px;
}

.mi-album-grp-panel__close {
  padding: 0 4px;
  border: none;
  background: none;
  font-size: 18px;
  line-height: 1;
  color: #939CA6;
  cursor: pointer;
}

.mi-album-grp-contact {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 0;
  font-size: 13px;
  cursor: pointer;
}

.mi-album-grp-contact--all {
  padding-bottom: 8px;
  margin-bottom: 4px;
  border-bottom: 1px solid var(--alb-line);
  font-weight: 500;
}

.mi-album-grp-contacts {
  max-height: 160px;
  overflow-y: auto;
  margin-bottom: 12px;
}

.mi-album-grp-contacts.is-disabled {
  opacity: 0.45;
  pointer-events: none;
}

.mi-album-grp-empty {
  margin: 8px 0 12px;
  font-size: 12px;
  color: var(--alb-muted);
}

.mi-album-batch-bar {
  position: absolute;
  left: 16px;
  right: 16px;
  bottom: calc(88px + env(safe-area-inset-bottom, 0px));
  z-index: 15;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  background: var(--alb-white);
  border-radius: 999px;
  box-shadow: var(--alb-shadow);
}

.mi-album-batch-bar span {
  flex: 1;
  font-size: 11px;
  color: var(--alb-muted);
}

.mi-album-batch-bar button {
  padding: 6px 12px;
  border: none;
  border-radius: 999px;
  background: var(--alb-ink);
  color: #fff;
  font-size: 11px;
  cursor: pointer;
}

.mi-album-batch-bar button[data-mq-alb-batch-toggle] {
  background: transparent;
  color: var(--alb-muted);
  border: 1px solid var(--alb-line);
}

.mi-album-app.is-batch .mi-album-dock {
  opacity: 0.35;
  pointer-events: none;
}

@keyframes mi-alb-fade-in {
  from { opacity: 0; }
  to { opacity: 1; }
}

.mi-me-page--album .mi-album-app {
  flex: 1;
  min-height: 0;
  width: 100%;
}

.mi-album-app .mi-album-grp-panel {
  position: absolute;
  left: 16px;
  right: 16px;
  bottom: calc(92px + env(safe-area-inset-bottom, 0px));
  z-index: 50;
  max-height: 46%;
  overflow-y: auto;
}

/* ── 「设为头像」目标选择面板 ──────────────────────────────────────────
 * 这个面板是从 .mi-album-sheet（照片操作面板，z-index 40）里点出来的。
 *
 * z-index 给 60 而不是 50：必须**明确高于** .mi-album-grp-panel(50)。
 * 若恰好同层，谁在上就取决于 DOM 插入顺序 —— 太脆，改一处顺序就翻车。
 *
 * 定位：从屏幕底部起浮（bottom:0），但**不能整屏高**。
 * 首版踩过两个坑，都是实测截图才发现的：
 *   1. 放在 bottom:92px 居中浮着 → 正好盖住照片预览和「保存到相册」那排按钮；
 *   2. 改成 bottom:0 但给了 62% 上限 → 5 个角色就长到 369px，
 *      照样把操作按钮压在下面，用户设完想接着保存得先手动关面板。
 * 现在压到 46% + 行高收紧：常见 3~5 个角色能在不遮挡预览的范围内显示完，
 * 角色多时面板内部滚动（只留一层滚动条，避免嵌套滚动手感变差）。
 */
.mi-album-avatar-panel {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 60;
  max-height: 46%;
  overflow-y: auto;
  margin: 0;
  padding: 12px 14px calc(14px + env(safe-area-inset-bottom, 0px));
  border-radius: 22px 22px 0 0;
  box-shadow: 0 -12px 48px rgba(0, 0, 0, 0.18);
  animation: mi-alb-slide-up 0.28s cubic-bezier(0.22, 1, 0.36, 1);
  box-sizing: border-box;
  -webkit-overflow-scrolling: touch;
}

/* ── 目标行 ──
 * 刻意**不复用** .mi-album-grp-contact：
 * 那个类是为「<label> + checkbox + 文字」的横排标签设计的（内含 padding
 * 和 display:flex 的对齐假设）。直接套在 <button> 上，实测会渲染成
 * 一列带边框的方块、纵向堆叠，长名字还会撑破容器。
 * 这里独立定义一套按钮行样式 —— 语义不同（这里是可点的行动项，
 * 不是勾选项），硬复用只会把两边的样式需求搅在一起。
 */
.mi-album-avatar-row {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  box-sizing: border-box;
  padding: 8px 10px;
  margin: 0 0 2px;
  border: none;
  border-radius: 12px;
  background: transparent;
  font-family: inherit;
  font-size: 14px;
  color: var(--alb-ink);
  text-align: left;
  cursor: pointer;
  transition: background 0.16s;
}

.mi-album-avatar-row:last-child {
  margin-bottom: 0;
}

.mi-album-avatar-row:active {
  background: rgba(0, 0, 0, 0.06);
}

/* 当前正用着这张图当头像的那一行，给个视觉反馈，
 * 避免用户重复点同一个目标却不知道其实已经设过了 */
.mi-album-avatar-row.is-current {
  background: rgba(0, 0, 0, 0.04);
}

.mi-album-avatar-row__avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
  background: #E5EAF0;
}

.mi-album-avatar-row__avatar--empty {
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  color: var(--alb-muted);
}

.mi-album-avatar-row__name {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.mi-album-avatar-row__tag {
  flex-shrink: 0;
  padding: 2px 8px;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.06);
  font-size: 11px;
  color: var(--alb-muted);
}

.mi-album-avatar-row.is-current .mi-album-avatar-row__tag {
  background: var(--alb-ink);
  color: #fff;
}

/* 面板头部沿用 grp-panel 的 14px/16px 内边距，与面板自身的 padding 叠起来
 * 会显得过于空旷；这里把头部内边距收掉，交给面板统一控制 */
.mi-album-avatar-panel .mi-album-grp-panel__head {
  padding: 0 0 10px;
  border-bottom: 1px solid var(--alb-line);
  margin-bottom: 8px;
}

.mi-album-avatar-panel .mi-album-grp-panel__head strong {
  font-family: var(--alb-serif);
  font-size: 16px;
  flex: 1;
}

/* 返回照片操作的入口。面板是**替换**照片面板出现的，
 * 需要一条明确的路回去（右上角的「×」语义是「关掉就走」，不够用）。 */
.mi-album-avatar-panel__back {
  width: 28px;
  height: 28px;
  padding: 0;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  border: none;
  border-radius: 50%;
  background: none;
  color: var(--alb-ink);
  cursor: pointer;
}

.mi-album-avatar-panel__back svg {
  width: 18px;
  height: 18px;
}

/* 目标列表本身也要能滚：角色多的时候（十几个）不能把面板撑爆。
 * 面板外层已经 max-height:62% + overflow-y:auto，这里不再设限，
 * 让滚动条只出现一条（嵌套两层滚动容器在手机上手感很糟）。 */
.mi-album-avatar-panel__list {
  max-height: none;
  margin: 0;
}

/* ═══════════════════════════════════════════════════════════════
   相册选图器（浮层）· 供「自由生图 → 垫图 → 我的相册」使用
   ═══════════════════════════════════════════════════════════════
   设计取舍：
   · 走的是**底部浮层**而不是内联展开。设置面板本身已经很长，
     内联再插一个网格会把「生成图片」按钮推到很远；
     浮层即用即走，不改变原面板的滚动长度。
   · z-index 给到 **600**。
     一开始写的是 90，理由是「要盖住设置面板（面板里有 z-index 60 的
     相册头像面板先例）」—— 这个推理漏了最要紧的一层：
     浮层挂在 document.body 上，而 .karin-chat-app 本身是
     position:fixed; inset:0; **z-index:500**。
     于是 90 被整个 App 容器盖住，肉眼完全看不见 ——
     而 DOM 层面它是正常的（hidden=false、is-open、rect 占满屏），
     纯逻辑断言全部通过，**只有截图能发现**。
     600 > 500 才能浮在 App 之上；同时远低于全局对话框（12000）
     与 toast（120000），不会被自己的提示语压住。 */

.karin-album-picker {
  position: fixed;
  inset: 0;
  z-index: 600;
  display: flex;
  align-items: flex-end;
  justify-content: center;
}

.karin-album-picker[hidden] {
  display: none;
}

.karin-album-picker__mask {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0);
  transition: background 0.2s ease;
}

.karin-album-picker.is-open .karin-album-picker__mask {
  background: rgba(0, 0, 0, 0.42);
}

.karin-album-picker__sheet {
  position: relative;
  width: 100%;
  max-width: 520px;
  max-height: 72vh;
  display: flex;
  flex-direction: column;
  background: var(--alb-paper, #fff);
  border-radius: 16px 16px 0 0;
  box-shadow: 0 -8px 28px rgba(0, 0, 0, 0.18);
  transform: translateY(100%);
  transition: transform 0.24s ease;
  /* 底部留白：手势条/圆角屏在浮层贴底时会吃掉一行按钮 */
  padding-bottom: env(safe-area-inset-bottom, 0);
}

.karin-album-picker.is-open .karin-album-picker__sheet {
  transform: translateY(0);
}

.karin-album-picker__head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px 10px;
  border-bottom: 1px solid var(--alb-line, rgba(0, 0, 0, 0.08));
  flex-shrink: 0;
}

.karin-album-picker__title {
  flex: 1;
  font-size: 15px;
  font-family: var(--alb-serif, serif);
}

.karin-album-picker__close {
  width: 30px;
  height: 30px;
  padding: 0;
  border: none;
  border-radius: 50%;
  background: none;
  color: var(--alb-ink, #333);
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
}

.karin-album-picker__body {
  flex: 1;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 12px 14px 16px;
  min-height: 120px;
}

.karin-album-picker__empty {
  margin: 24px 0;
  text-align: center;
  font-size: 13px;
  line-height: 1.7;
  color: var(--alb-muted, #8a8a8a);
}

.karin-album-picker__grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
}

.karin-album-picker__cell {
  position: relative;
  aspect-ratio: 1 / 1;
  padding: 0;
  border: none;
  border-radius: 10px;
  background-color: rgba(0, 0, 0, 0.05);
  background-size: cover;
  background-position: center;
  cursor: pointer;
  overflow: hidden;
}

.karin-album-picker__cell:active {
  opacity: 0.72;
}
