/* 自定义布局 · 2×2 小组件 · 吧唧 / 黑胶 / 卡套 */

.wg-2x2 {
  box-sizing: border-box;
  font-family: 'Noto Sans SC', 'DM Sans', sans-serif;
  color: #2a2a2e;
  -webkit-font-smoothing: antialiased;
}

.wg-2x2 *,
.wg-2x2 *::before,
.wg-2x2 *::after {
  box-sizing: border-box;
}

/* ── 共享 · 图片占位 ── */
.wg-2x2-badge__main-photo,
.wg-2x2-badge__mini-photo,
.wg-2x2-vinyl__label,
.wg-2x2-sleeve__photo,
.wg-2x2-framephoto__photo,
.wg-2x2-postcard__photo,
.wg-2x2-folder__photo {
  background: linear-gradient(145deg, #f0f0f4 0%, #e2e2e8 100%);
  background-size: cover;
  background-position: center;
}

.wg-2x2-badge__main-photo.has-custom-photo,
.wg-2x2-badge__mini-photo.has-custom-photo,
.wg-2x2-vinyl__label.has-custom-photo,
.wg-2x2-sleeve__photo.has-custom-photo,
.wg-2x2-framephoto__photo.has-custom-photo,
.wg-2x2-postcard__photo.has-custom-photo,
.wg-2x2-folder__photo.has-custom-photo {
  background-color: transparent;
}

/* ── 1 · 吧唧相 · 缶バッジ ── */
.wg-2x2-badge {
  position: relative;
  width: 100%;
  height: 100%;
  padding: 4px 6px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.wg-2x2-badge__scene {
  position: relative;
  width: 100%;
  max-width: 168px;
  height: 158px;
}

.wg-2x2-badge__sparkle {
  position: absolute;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: radial-gradient(circle, #fff 0%, rgba(255,255,255,0) 70%);
  opacity: 0.85;
  pointer-events: none;
}

.wg-2x2-badge__sparkle--1 {
  top: 28px;
  right: 28px;
  animation: wg2x2BadgeSpark 3.2s ease-in-out infinite;
}

.wg-2x2-badge__sparkle--2 {
  top: 52px;
  left: 18px;
  width: 4px;
  height: 4px;
  animation: wg2x2BadgeSpark 3.2s ease-in-out 1.1s infinite;
}

@keyframes wg2x2BadgeSpark {
  0%, 100% { opacity: 0.3; transform: scale(0.8); }
  50% { opacity: 1; transform: scale(1.2); }
}

.wg-2x2-badge__mini {
  position: absolute;
  top: 10px;
  left: 14px;
  z-index: 3;
  width: 52px;
  height: 52px;
  transform: rotate(-12deg);
}

.wg-2x2-badge__mini-face {
  position: relative;
  width: 100%;
  height: 100%;
  border-radius: 50%;
  padding: 2px;
  background: linear-gradient(135deg, #e8e8ee 0%, #fff 40%, #d0d0d8 100%);
  box-shadow:
    0 3px 10px rgba(30,34,42,0.12),
    0 0 0 1px rgba(255,255,255,0.8) inset;
}

.wg-2x2-badge__mini-photo {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  overflow: hidden;
}

.wg-2x2-badge__mini-pin {
  position: absolute;
  bottom: -3px;
  left: 50%;
  width: 8px;
  height: 8px;
  margin-left: -4px;
  border-radius: 50%;
  background: linear-gradient(145deg, #c8c8d0, #9898a2);
  box-shadow: 0 1px 3px rgba(0,0,0,0.15);
}

.wg-2x2-badge__main {
  position: absolute;
  top: 50%;
  left: 50%;
  z-index: 2;
  width: 118px;
  height: 118px;
  margin: -59px 0 0 -42px;
  transform: rotate(4deg);
}

.wg-2x2-badge__main-face {
  position: relative;
  width: 100%;
  height: 100%;
  border-radius: 50%;
  padding: 3px;
  background:
    conic-gradient(from 210deg,
      #f8d4e8 0deg, #d4e8f8 60deg, #e8f8d4 120deg,
      #f8e8d4 180deg, #e8d4f8 240deg, #d4f8e8 300deg, #f8d4e8 360deg);
  box-shadow:
    0 8px 24px rgba(30,34,42,0.14),
    0 0 0 1px rgba(255,255,255,0.6) inset;
}

.wg-2x2-badge__main-photo {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  overflow: hidden;
  border: 2px solid rgba(255,255,255,0.92);
}

.wg-2x2-badge__shine {
  position: absolute;
  top: 8%;
  left: 12%;
  width: 38%;
  height: 28%;
  border-radius: 50%;
  background: linear-gradient(135deg, rgba(255,255,255,0.72) 0%, rgba(255,255,255,0) 100%);
  pointer-events: none;
  transform: rotate(-18deg);
}

.wg-2x2-badge__pinback {
  position: absolute;
  bottom: -6px;
  left: 50%;
  width: 14px;
  height: 14px;
  margin-left: -7px;
  border-radius: 50%;
  background:
    radial-gradient(circle at 35% 35%, #e8e8ee 0%, #a8a8b2 100%);
  box-shadow:
    0 2px 6px rgba(0,0,0,0.18),
    0 0 0 1px rgba(255,255,255,0.4) inset;
}

.wg-2x2-badge__pinback::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 4px;
  height: 4px;
  margin: -2px 0 0 -2px;
  border-radius: 50%;
  background: #787880;
}

/* ── 2 · 黑胶碟 · 唱片机 ── */
.wg-2x2-vinyl {
  position: relative;
  width: 100%;
  height: 100%;
  padding: 6px 8px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.wg-2x2-vinyl__deck {
  position: relative;
  width: 100%;
  max-width: 168px;
  height: 156px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.wg-2x2-vinyl__platter {
  position: relative;
  width: 140px;
  height: 140px;
}

.wg-2x2-vinyl__disc {
  position: relative;
  width: 100%;
  height: 100%;
  border-radius: 50%;
  background:
    radial-gradient(circle at center, transparent 0 28%, rgba(255,255,255,0.03) 28% 29%, transparent 29% 31%, rgba(0,0,0,0.04) 31% 32%, transparent 32% 34%),
    repeating-radial-gradient(circle at center, #1e1e22 0 1.5px, #28282e 1.5px 3px);
  box-shadow:
    0 6px 20px rgba(0,0,0,0.22),
    0 0 0 1px rgba(255,255,255,0.08) inset;
}

.wg-2x2-vinyl__label {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 38%;
  height: 38%;
  margin: -19% 0 0 -19%;
  border-radius: 50%;
  border: 2px solid rgba(255,255,255,0.15);
  box-shadow: 0 0 0 1px rgba(0,0,0,0.2) inset;
  overflow: hidden;
}

.wg-2x2-vinyl__spindle {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 8px;
  height: 8px;
  margin: -4px 0 0 -4px;
  border-radius: 50%;
  background: linear-gradient(145deg, #e0e0e6, #9898a0);
  box-shadow: 0 1px 3px rgba(0,0,0,0.3);
  z-index: 2;
}

.wg-2x2-vinyl__tonearm {
  position: absolute;
  top: -4px;
  right: 24px;
  width: 4px;
  height: 68px;
  border-radius: 2px;
  background: linear-gradient(180deg, #c8c8d0, #9898a0);
  transform-origin: top center;
  transform: rotate(22deg);
  box-shadow: 1px 2px 6px rgba(0,0,0,0.12);
  z-index: 3;
}

.wg-2x2-vinyl__tonearm-head {
  position: absolute;
  bottom: -4px;
  left: 50%;
  width: 10px;
  height: 6px;
  margin-left: -5px;
  border-radius: 2px;
  background: #787880;
}

/* ── 3 · 透明卡套 · 小卡 ── */
.wg-2x2-sleeve {
  position: relative;
  width: 100%;
  height: 100%;
  padding: 4px 10px 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
}

.wg-2x2-sleeve__clip {
  position: absolute;
  top: 2px;
  left: 50%;
  width: 18px;
  height: 10px;
  margin-left: -9px;
  border-radius: 3px 3px 1px 1px;
  background: linear-gradient(180deg, #b8b8c0, #888890);
  box-shadow: 0 2px 4px rgba(0,0,0,0.12);
  z-index: 4;
}

.wg-2x2-sleeve__clip::after {
  content: '';
  position: absolute;
  bottom: -3px;
  left: 50%;
  width: 12px;
  height: 4px;
  margin-left: -6px;
  border-radius: 0 0 2px 2px;
  background: #787880;
}

.wg-2x2-sleeve__pouch {
  position: relative;
  flex: 0 0 auto;
  width: 72px;
  height: 108px;
  margin-top: 6px;
  padding: 5px 4px 8px;
  border-radius: 4px;
  background:
    linear-gradient(145deg, rgba(255,255,255,0.55) 0%, rgba(240,242,248,0.35) 100%);
  border: 1px solid rgba(200,206,214,0.55);
  box-shadow:
    0 6px 18px rgba(30,34,42,0.08),
    0 0 0 1px rgba(255,255,255,0.6) inset;
  backdrop-filter: blur(2px);
  -webkit-backdrop-filter: blur(2px);
}

.wg-2x2-sleeve__card {
  width: 100%;
  height: 100%;
  border-radius: 2px;
  overflow: hidden;
  background: #fff;
  box-shadow: 0 1px 4px rgba(30,34,42,0.06);
}

.wg-2x2-sleeve__photo {
  width: 100%;
  height: 100%;
}

.wg-2x2-sleeve__tape {
  position: absolute;
  top: 14px;
  right: -6px;
  width: 28px;
  height: 10px;
  transform: rotate(32deg);
  background: rgba(248, 228, 210, 0.75);
  border: 1px solid rgba(220, 200, 180, 0.4);
  box-shadow: 0 1px 3px rgba(0,0,0,0.06);
  z-index: 2;
}

.wg-2x2-sleeve__sheen {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(125deg, rgba(255,255,255,0.45) 0%, transparent 42%, rgba(255,255,255,0.12) 58%, transparent 100%);
  pointer-events: none;
  z-index: 3;
}

.wg-2x2-sleeve__note {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding-top: 12px;
}

.wg-2x2-sleeve__tag {
  display: inline-block;
  align-self: flex-start;
  padding: 2px 6px;
  border-radius: 999px;
  font-size: 7px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: #aaa;
  background: rgba(255,255,255,0.7);
  border: 1px solid rgba(200,206,214,0.4);
}

.wg-2x2-sleeve__name {
  margin: 0;
  font-family: 'Outfit', 'Noto Sans SC', sans-serif;
  font-size: 13px;
  font-weight: 400;
  letter-spacing: 0.02em;
  line-height: 1.2;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.wg-2x2-sleeve__caption {
  margin: 0;
  font-size: 9px;
  letter-spacing: 0.06em;
  color: #9a9aa3;
  line-height: 1.35;
}

.wg-2x2-sleeve__holes {
  position: absolute;
  top: 8px;
  left: 50%;
  display: flex;
  gap: 14px;
  margin-left: -11px;
  z-index: 1;
}

.wg-2x2-sleeve__holes span {
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: rgba(200,206,214,0.5);
  border: 1px solid rgba(180,186,194,0.4);
}

/* ── 6 · 纯照片 · 正方相框 ── */
.wg-2x2-framephoto {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  padding: 6px;
  background: transparent;
  overflow: visible;
}

.wg-2x2-framephoto__frame {
  position: relative;
  flex: 0 0 auto;
  width: 148px;
  height: 148px;
  padding: 5px;
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.94);
  border: 1px solid rgba(200, 206, 214, 0.55);
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.85) inset;
}

.wg-2x2-framephoto__frame::before {
  content: '';
  position: absolute;
  inset: 3px;
  border-radius: 17px;
  border: 1px solid rgba(220, 224, 232, 0.35);
  pointer-events: none;
  z-index: 2;
}

.wg-2x2-framephoto__photo {
  position: relative;
  z-index: 1;
  width: 100%;
  height: 100%;
  border-radius: 15px;
  overflow: hidden;
}

.wg-2x2-framephoto__photo.has-custom-photo {
  filter: saturate(0.84) brightness(1.02);
}

.wg-2x2-framephoto__hint {
  position: absolute;
  inset: 5px;
  z-index: 3;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 5px;
  border-radius: 15px;
  pointer-events: none;
  transition: opacity 0.2s ease;
}

.wg-2x2-framephoto__hint-icon {
  position: relative;
  width: 18px;
  height: 18px;
  opacity: 0.35;
}

.wg-2x2-framephoto__hint-icon::before,
.wg-2x2-framephoto__hint-icon::after {
  content: '';
  position: absolute;
  background: #9a9aa3;
  border-radius: 1px;
}

.wg-2x2-framephoto__hint-icon::before {
  top: 50%;
  left: 0;
  width: 100%;
  height: 1px;
  margin-top: -0.5px;
}

.wg-2x2-framephoto__hint-icon::after {
  top: 0;
  left: 50%;
  width: 1px;
  height: 100%;
  margin-left: -0.5px;
}

.wg-2x2-framephoto__hint-text {
  font-size: 7px;
  letter-spacing: 0.12em;
  color: #aaa;
}

.wg-2x2-framephoto__photo.has-custom-photo ~ .wg-2x2-framephoto__hint {
  opacity: 0;
}

/* ── 7 · 明信片 · 叠卡 polaroid 式 ── */
.wg-2x2-postcard {
  position: relative;
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 4px 0;
  background: transparent;
  overflow: visible;
}

.wg-2x2-postcard__stack {
  position: relative;
  width: 118px;
  height: 150px;
}

.wg-2x2-postcard__card {
  position: absolute;
  left: 50%;
  width: 108px;
  background: #fafafa;
  border-radius: 2px;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.9);
  transform-origin: center center;
}

.wg-2x2-postcard__card--back {
  top: 10px;
  margin-left: -50px;
  height: 128px;
  transform: rotate(8deg) translateX(6px);
  z-index: 1;
  opacity: 0.72;
}

.wg-2x2-postcard__card--front {
  top: 0;
  margin-left: -54px;
  padding: 7px 7px 16px;
  z-index: 2;
  transform: rotate(-3deg);
}

.wg-2x2-postcard__stamp {
  position: absolute;
  top: 6px;
  right: 6px;
  width: 12px;
  height: 14px;
  border: 1px solid rgba(200, 200, 210, 0.65);
  border-radius: 1px;
  opacity: 0.75;
}

.wg-2x2-postcard__photo {
  width: 100%;
  aspect-ratio: 1 / 0.88;
  margin-bottom: 6px;
  border-radius: 1px;
  box-shadow: inset 0 1px 3px rgba(80, 90, 100, 0.06);
}

.wg-2x2-postcard__photo.has-custom-photo {
  box-shadow: none;
  filter: saturate(0.82) brightness(1.02);
}

.wg-2x2-postcard__message {
  margin: 0;
  font-family: 'Instrument Serif', 'Noto Serif SC', serif;
  font-size: 8px;
  font-weight: 400;
  font-style: italic;
  letter-spacing: 0.02em;
  line-height: 1.45;
  color: var(--ink-soft, #9a9aa3);
  text-align: center;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.wg-2x2-postcard__to {
  display: block;
  margin-top: 5px;
  font-size: 7px;
  font-weight: 300;
  letter-spacing: 0.1em;
  color: var(--ink-soft, #9a9aa3);
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ── 8 · 文件夹 · 透明底 + 浮层文件夹 ── */
.wg-2x2-folder {
  position: relative;
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 8px 10px;
  background: transparent;
  overflow: visible;
}

.wg-2x2-folder__body {
  position: relative;
  width: 124px;
  height: 132px;
}

.wg-2x2-folder__tab {
  position: absolute;
  top: 0;
  left: 8px;
  z-index: 2;
  padding: 3px 10px 2px;
  background: rgba(255, 255, 255, 0.88);
  border: 1px solid rgba(230, 230, 238, 0.85);
  border-bottom: none;
  border-radius: 4px 4px 0 0;
  box-shadow: 0 -1px 0 rgba(255, 255, 255, 0.9) inset;
}

.wg-2x2-folder__label {
  font-size: 7px;
  letter-spacing: 0.12em;
  text-transform: lowercase;
  color: #888;
  white-space: nowrap;
}

.wg-2x2-folder__pocket {
  position: absolute;
  top: 16px;
  left: 0;
  right: 0;
  bottom: 0;
  padding: 8px 8px 6px;
  background: rgba(255, 255, 255, 0.78);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border: 1px solid rgba(255, 255, 255, 0.9);
  border-radius: 0 6px 6px 6px;
  box-shadow: 0 6px 20px rgba(30, 34, 42, 0.06);
}

.wg-2x2-folder__slip {
  width: 100%;
  height: 100%;
  padding: 3px;
  background: #fff;
  border-radius: 2px;
  box-shadow: 0 1px 4px rgba(30, 34, 42, 0.05);
  transform: rotate(-1.5deg);
}

.wg-2x2-folder__photo {
  width: 100%;
  height: 100%;
  min-height: 78px;
  border-radius: 1px;
}

.wg-2x2-folder__photo.has-custom-photo {
  filter: saturate(0.82) brightness(1.02);
}

/* ── 自定义布局 · 2×2 缩放 ── */
.desk-custom__wg--badgepin,
.desk-custom__wg--vinyl,
.desk-custom__wg--sleeve,
.desk-custom__wg--framephoto,
.desk-custom__wg--postcard,
.desk-custom__wg--folder {
  --dc-wg-design-h: 168px;
  width: 100%;
  height: var(--dc-wg-design-h);
  transform-origin: top center;
  transform: scale(calc(100cqh / var(--dc-wg-design-h)));
  background: transparent;
}

.desk-custom__wg--framephoto.wg-2x2--framephoto {
  --dc-wg-design-h: 168px;
  --dc-wg-design-w: 168px;
  height: var(--dc-wg-design-h);
  transform-origin: center center;
  transform: scale(min(calc(100cqh / var(--dc-wg-design-h)), calc(100cqw / var(--dc-wg-design-w))));
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  margin: 0 auto;
}

.desk-custom__wg--framephoto .wg-2x2-framephoto__frame {
  width: 148px;
  height: 148px;
}

.desk-custom__wg--postcard.wg-2x2--postcard {
  --dc-wg-design-h: 158px;
  --dc-wg-design-w: 118px;
  height: var(--dc-wg-design-h);
  transform-origin: center center;
  transform: scale(min(calc(100cqh / var(--dc-wg-design-h)), calc(100cqw / var(--dc-wg-design-w))));
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  margin: 0 auto;
}

.desk-custom__wg--postcard .wg-2x2-postcard__stack {
  width: 118px;
  height: 150px;
}

.desk-custom__wg--badgepin.wg-2x2--badgepin,
.desk-custom__wg--vinyl.wg-2x2--vinyl,
.desk-custom__wg--sleeve.wg-2x2--sleeve,
.desk-custom__wg--folder.wg-2x2--folder {
  padding: 0;
}

@supports not (container-type: size) {
  .desk-custom__wg--badgepin,
  .desk-custom__wg--vinyl,
  .desk-custom__wg--sleeve,
  .desk-custom__wg--framephoto,
  .desk-custom__wg--postcard,
  .desk-custom__wg--folder {
    transform: none;
    height: 100%;
  }

  .desk-custom__wg--framephoto.wg-2x2--framephoto {
    width: 100%;
    transform: none;
  }

  .desk-custom__wg--framephoto .wg-2x2-framephoto__frame {
    width: min(148px, calc(100% - 12px));
    height: min(148px, calc(100% - 12px));
  }

  .desk-custom__wg--postcard.wg-2x2--postcard {
    width: 100%;
  }

  .desk-custom__wg--postcard .wg-2x2-postcard__stack {
    width: 118px;
    height: 150px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .wg-2x2-badge__sparkle {
    animation: none !important;
  }
}
