/* ==========================================================================
   张涵冰 × 孔杜威｜两周年小狗日记 - UI-v8 全面升级样式
   包含：多主题配色系统、音频药丸、恋爱 100 件清单、拍立得弹窗、全屏幻灯片、小狗互动彩蛋
   ========================================================================== */

/* --------------------------------------------------------------------------
   1. 多主题变量系统 (Themes)
   -------------------------------------------------------------------------- */

/* 🍑 落日微醺 (Sunset Rose) */
:root[data-theme="sunset-rose"] {
  --paper: #fff5ef;
  --paper-soft: #ffede3;
  --paper-card: rgba(255, 248, 244, 0.88);
  --paper-lift: #ffffff;
  --ink: #38241f;
  --ink-soft: #63473f;
  --ink-whisper: #9c7b72;
  --accent: #e85d46;
  --accent-soft: rgba(232, 93, 70, 0.12);
  --accent-strong: #c9442e;
  --secondary: #f48c74;
  --gold: #f29e4c;
  --sky: #f7a072;
  --border: rgba(156, 123, 114, 0.22);
  --border-light: rgba(156, 123, 114, 0.12);
  --shadow: 0 16px 36px rgba(180, 70, 50, 0.08);
}

/* 🌌 星空宇宙 (Midnight Galaxy) */
:root[data-theme="midnight-galaxy"] {
  --paper: #121420;
  --paper-soft: #1a1e30;
  --paper-card: rgba(26, 30, 48, 0.85);
  --paper-lift: #242942;
  --ink: #f0f2ff;
  --ink-soft: #b8c0e0;
  --ink-whisper: #7a84ab;
  --accent: #ff8e71;
  --accent-soft: rgba(255, 142, 113, 0.18);
  --accent-strong: #ffa48d;
  --secondary: #70c2de;
  --gold: #fcd34d;
  --sky: #818cf8;
  --border: rgba(255, 255, 255, 0.12);
  --border-light: rgba(255, 255, 255, 0.06);
  --shadow: 0 16px 36px rgba(0, 0, 0, 0.35);
}

:root[data-theme="midnight-galaxy"] .entry-gate,
:root[data-theme="midnight-galaxy"] body {
  background-color: #121420;
}

:root[data-theme="midnight-galaxy"] .global-nav,
:root[data-theme="midnight-galaxy"] .memory-mark {
  background: rgba(18, 20, 32, 0.88);
}

/* 🌸 春日樱花 (Spring Blossom) */
:root[data-theme="spring-blossom"] {
  --paper: #fdf6f8;
  --paper-soft: #faebf0;
  --paper-card: rgba(255, 250, 252, 0.88);
  --paper-lift: #ffffff;
  --ink: #332228;
  --ink-soft: #5e434e;
  --ink-whisper: #997886;
  --accent: #e65c84;
  --accent-soft: rgba(230, 92, 132, 0.12);
  --accent-strong: #c74068;
  --secondary: #6ec4b8;
  --gold: #f5b041;
  --sky: #85c1e9;
  --border: rgba(153, 120, 134, 0.2);
  --border-light: rgba(153, 120, 134, 0.1);
  --shadow: 0 16px 36px rgba(180, 80, 120, 0.08);
}

/* --------------------------------------------------------------------------
   2. 全局浮动音乐药丸 (Romantic Audio Pill)
   -------------------------------------------------------------------------- */

.audio-pill {
  position: fixed;
  right: 20px;
  bottom: 24px;
  z-index: 998;
  display: flex;
  align-items: center;
  background: var(--paper-card, rgba(255, 255, 255, 0.9));
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--border, rgba(0, 0, 0, 0.1));
  border-radius: 999px;
  padding: 4px;
  box-shadow: 0 12px 32px rgba(45, 36, 30, 0.12), 0 2px 6px rgba(45, 36, 30, 0.04);
  transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1), box-shadow 0.3s ease;
}

.audio-pill:hover {
  transform: translateY(-2px);
  box-shadow: 0 16px 36px rgba(45, 36, 30, 0.16);
}

.audio-pill__disc {
  position: relative;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  border: none;
  background: #222;
  color: #fff;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  overflow: hidden;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.2);
  flex-shrink: 0;
}

.audio-pill__vinyl {
  width: 38px;
  height: 38px;
  color: #ff8e71;
  transform-origin: center center;
}

.audio-pill.is-playing .audio-pill__vinyl {
  animation: spinVinyl 6s linear infinite;
}

.audio-pill__note {
  position: absolute;
  font-size: 13px;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.audio-pill.is-playing .audio-pill__note {
  opacity: 1;
  animation: noteFloat 2s ease-in-out infinite alternate;
}

@keyframes spinVinyl {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

@keyframes noteFloat {
  0% { transform: translateY(0) scale(0.9); }
  100% { transform: translateY(-3px) scale(1.1); }
}

.audio-pill__panel {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 10px 0 12px;
  max-width: 0;
  overflow: hidden;
  opacity: 0;
  pointer-events: none;
  white-space: nowrap;
  transition: max-width 0.4s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.3s ease, padding 0.3s ease;
}

.audio-pill:hover .audio-pill__panel,
.audio-pill:focus-within .audio-pill__panel,
.audio-pill.is-playing .audio-pill__panel {
  max-width: 320px;
  opacity: 1;
  pointer-events: auto;
}

.audio-pill__title {
  font-size: 13px;
  font-weight: 500;
  color: var(--ink, #2d241e);
  max-width: 130px;
  overflow: hidden;
  text-overflow: ellipsis;
}

.audio-pill__controls {
  display: flex;
  align-items: center;
  gap: 4px;
}

.audio-pill__btn {
  background: transparent;
  border: none;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--ink-soft, #55483d);
  padding: 0;
  transition: background-color 0.2s, color 0.2s, transform 0.15s;
}

.audio-pill__btn svg {
  width: 16px;
  height: 16px;
  fill: currentColor;
}

.audio-pill__btn:hover {
  background: var(--accent-soft, rgba(255, 142, 113, 0.15));
  color: var(--accent, #ff8e71);
  transform: scale(1.08);
}

.audio-pill__btn--main {
  background: var(--accent, #ff8e71);
  color: #fff !important;
}

.audio-pill__btn--main:hover {
  background: var(--accent-strong, #e67355);
}

.audio-pill__btn .icon-pause,
.audio-pill__btn .icon-muted {
  display: none;
}

.audio-pill.is-playing .audio-pill__btn .icon-play {
  display: none;
}

.audio-pill.is-playing .audio-pill__btn .icon-pause {
  display: block;
}

.audio-pill.is-muted .audio-pill__btn .icon-unmuted {
  display: none;
}

.audio-pill.is-muted .audio-pill__btn .icon-muted {
  display: block;
}

/* --------------------------------------------------------------------------
   3. 主题切换器面板 (Theme Dropdown)
   -------------------------------------------------------------------------- */

.theme-switch-widget {
  display: inline-flex;
  align-items: center;
  position: relative;
}

.theme-dropdown {
  position: relative;
}

.theme-dropdown__trigger {
  list-style: none;
  cursor: pointer;
  padding: 6px 12px;
  border-radius: 999px;
  background: var(--paper-soft, rgba(0, 0, 0, 0.04));
  border: 1px solid var(--border-light, rgba(0, 0, 0, 0.08));
  font-size: 13px;
  font-weight: 500;
  color: var(--ink-soft, #55483d);
  display: inline-flex;
  align-items: center;
  gap: 4px;
  user-select: none;
  transition: all 0.2s ease;
}

.theme-dropdown__trigger::-webkit-details-marker {
  display: none;
}

.theme-dropdown__trigger:hover {
  background: var(--accent-soft, rgba(255, 142, 113, 0.12));
  color: var(--accent, #ff8e71);
}

.theme-dropdown__menu {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  background: var(--paper-card, #ffffff);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--border, rgba(0, 0, 0, 0.1));
  border-radius: 14px;
  padding: 6px;
  box-shadow: 0 14px 36px rgba(0, 0, 0, 0.12);
  min-width: 170px;
  z-index: 1000;
  display: flex;
  flex-direction: column;
  gap: 4px;
  animation: dropdownIn 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes dropdownIn {
  from { opacity: 0; transform: translateY(-6px) scale(0.96); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.theme-option-btn {
  background: transparent;
  border: none;
  border-radius: 8px;
  padding: 8px 10px;
  text-align: left;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 2px;
  transition: background-color 0.15s;
}

.theme-option-btn span {
  font-size: 13px;
  font-weight: 600;
  color: var(--ink, #2d241e);
}

.theme-option-btn small {
  font-size: 11px;
  color: var(--ink-whisper, #8c7c6e);
}

.theme-option-btn:hover {
  background: var(--paper-soft, rgba(0, 0, 0, 0.05));
}

.theme-option-btn[aria-pressed="true"] {
  background: var(--accent-soft, rgba(255, 142, 113, 0.14));
}

.theme-option-btn[aria-pressed="true"] span {
  color: var(--accent, #ff8e71);
}

/* --------------------------------------------------------------------------
   4. 小狗点击彩蛋与爱心粒子 (Puppy Easter Egg)
   -------------------------------------------------------------------------- */

.puppy-bounce {
  animation: puppyBounce 0.6s cubic-bezier(0.28, 0.84, 0.42, 1.4);
}

@keyframes puppyBounce {
  0% { transform: scale(1); }
  30% { transform: scale(1.15) rotate(-3deg); }
  60% { transform: scale(0.95) rotate(2deg); }
  100% { transform: scale(1); }
}

.puppy-heart-burst {
  position: fixed;
  pointer-events: none;
  z-index: 9999;
}

.puppy-burst-particle {
  position: absolute;
  left: 0;
  top: 0;
  font-size: 18px;
  animation: burstParticle 1.1s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

@keyframes burstParticle {
  0% {
    opacity: 1;
    transform: translate(0, 0) scale(0.6);
  }
  50% {
    opacity: 0.9;
    transform: translate(var(--tx), var(--ty)) scale(1.2);
  }
  100% {
    opacity: 0;
    transform: translate(calc(var(--tx) * 1.3), calc(var(--ty) - 30px)) scale(0.8);
  }
}

.puppy-bubble-toast {
  position: fixed;
  z-index: 9999;
  background: var(--paper-card, #ffffff);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--border, rgba(0, 0, 0, 0.1));
  border-radius: 12px;
  padding: 8px 14px;
  font-size: 13px;
  font-weight: 500;
  color: var(--ink, #2d241e);
  box-shadow: 0 8px 24px rgba(45, 36, 30, 0.12);
  pointer-events: none;
  opacity: 0;
  transform: translateY(10px) scale(0.92);
  transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.puppy-bubble-toast.is-active {
  opacity: 1;
  transform: translateY(0) scale(1);
}

/* --------------------------------------------------------------------------
   5. 恋爱 100 件小事 (Love Bucket List) 样式
   -------------------------------------------------------------------------- */

.memories-bucket {
  margin-top: 36px;
  background: var(--paper-card, rgba(255, 255, 255, 0.8));
  border: 1px solid var(--border, rgba(0, 0, 0, 0.08));
  border-radius: 20px;
  padding: 28px;
  box-shadow: var(--shadow, 0 10px 30px rgba(0, 0, 0, 0.04));
}

.memories-bucket__head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  flex-wrap: wrap;
  gap: 16px;
  margin-bottom: 20px;
}

.memories-bucket__progress-wrap {
  display: flex;
  align-items: center;
  gap: 16px;
  background: var(--paper-soft, rgba(0, 0, 0, 0.03));
  border-radius: 16px;
  padding: 14px 18px;
  margin-bottom: 24px;
}

.memories-bucket__bar {
  flex: 1;
  height: 10px;
  background: rgba(0, 0, 0, 0.06);
  border-radius: 999px;
  overflow: hidden;
  position: relative;
}

.memories-bucket__bar-fill {
  height: 100%;
  background: linear-gradient(90deg, #ff8e71, #f2c64d);
  border-radius: 999px;
  transition: width 0.6s cubic-bezier(0.16, 1, 0.3, 1);
}

.memories-bucket__progress-text {
  font-size: 14px;
  font-weight: 600;
  color: var(--ink, #2d241e);
  white-space: nowrap;
}

.memories-bucket__tabs {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 20px;
}

.bucket-tab-btn {
  background: var(--paper-soft, rgba(0, 0, 0, 0.04));
  border: 1px solid transparent;
  border-radius: 999px;
  padding: 6px 14px;
  font-size: 13px;
  font-weight: 500;
  color: var(--ink-soft, #55483d);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: all 0.2s ease;
}

.bucket-tab-btn:hover {
  background: var(--accent-soft, rgba(255, 142, 113, 0.1));
}

.bucket-tab-btn[aria-pressed="true"] {
  background: var(--accent, #ff8e71);
  color: #fff;
  border-color: var(--accent, #ff8e71);
}

.memories-bucket__list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 12px;
}

.bucket-item {
  background: var(--paper-lift, #ffffff);
  border: 1px solid var(--border-light, rgba(0, 0, 0, 0.08));
  border-radius: 14px;
  padding: 12px 14px;
  display: flex;
  align-items: flex-start;
  gap: 12px;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

.bucket-item:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.06);
  border-color: var(--border, rgba(0, 0, 0, 0.16));
}

.bucket-item.is-completed {
  background: var(--paper-soft, rgba(255, 142, 113, 0.05));
  border-color: rgba(255, 142, 113, 0.25);
}

.bucket-item__checkbox {
  appearance: none;
  -webkit-appearance: none;
  width: 20px;
  height: 20px;
  border: 2px solid var(--ink-whisper, #999);
  border-radius: 6px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-top: 2px;
  flex-shrink: 0;
  transition: all 0.2s;
}

.bucket-item__checkbox:checked {
  background: var(--accent, #ff8e71);
  border-color: var(--accent, #ff8e71);
}

.bucket-item__checkbox:checked::after {
  content: '✓';
  color: #fff;
  font-size: 13px;
  font-weight: bold;
}

.bucket-item__content {
  flex: 1;
}

.bucket-item__title {
  font-size: 14px;
  font-weight: 500;
  color: var(--ink, #2d241e);
  margin-bottom: 4px;
}

.bucket-item.is-completed .bucket-item__title {
  text-decoration: line-through;
  color: var(--ink-whisper, #8c7c6e);
}

.bucket-item__meta {
  font-size: 12px;
  color: var(--ink-whisper, #8c7c6e);
  display: flex;
  align-items: center;
  gap: 8px;
}

.bucket-item__note {
  font-size: 12px;
  color: var(--accent-strong, #c9442e);
  background: var(--accent-soft, rgba(255, 142, 113, 0.1));
  padding: 2px 6px;
  border-radius: 4px;
  margin-top: 4px;
}

/* --------------------------------------------------------------------------
   6. 拍立得明信片弹窗 (Polaroid Modal)
   -------------------------------------------------------------------------- */

.polaroid-modal {
  border: none;
  background: transparent;
  padding: 0;
  max-width: 90vw;
}

.polaroid-modal::backdrop {
  background: rgba(18, 15, 12, 0.72);
  backdrop-filter: blur(8px);
}

.polaroid-modal__dialog {
  background: var(--paper-card, #ffffff);
  border: 1px solid var(--border, rgba(0, 0, 0, 0.1));
  border-radius: 20px;
  width: 580px;
  max-width: calc(100vw - 32px);
  padding: 24px;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.25);
  animation: modalScaleIn 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes modalScaleIn {
  from { opacity: 0; transform: scale(0.94); }
  to { opacity: 1; transform: scale(1); }
}

.polaroid-modal__header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
}

.polaroid-modal__header h2 {
  font-size: 18px;
  margin: 0;
  color: var(--ink, #2d241e);
}

.polaroid-modal__preview-box {
  width: 100%;
  aspect-ratio: 1200 / 1520;
  background: #fbf9f4;
  border-radius: 12px;
  overflow: hidden;
  border: 1px solid rgba(0, 0, 0, 0.08);
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
}

.polaroid-modal__preview-img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  transition: opacity 0.2s ease;
}

.polaroid-modal__loading {
  position: absolute;
  font-size: 13px;
  color: var(--ink-whisper, #999);
}

.polaroid-modal__form {
  margin-top: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.polaroid-modal__field {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.polaroid-modal__field span {
  font-size: 12px;
  font-weight: 500;
  color: var(--ink-soft, #55483d);
}

.polaroid-modal__field input {
  background: var(--paper-soft, rgba(0, 0, 0, 0.03));
  border: 1px solid var(--border-light, rgba(0, 0, 0, 0.1));
  border-radius: 8px;
  padding: 8px 12px;
  font-size: 14px;
  color: var(--ink, #2d241e);
}

.polaroid-modal__actions {
  margin-top: 8px;
  display: flex;
  justify-content: flex-end;
}

/* --------------------------------------------------------------------------
   7. 全屏幻灯片放映 (Gallery Slideshow)
   -------------------------------------------------------------------------- */

.gallery-slideshow {
  position: fixed;
  inset: 0;
  z-index: 10000;
  background: #0f0f14;
  display: flex;
  flex-direction: column;
  color: #fff;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.4s ease;
}

.gallery-slideshow.is-active {
  opacity: 1;
  pointer-events: auto;
}

.gallery-slideshow__stage {
  flex: 1;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  padding: 40px;
}

.gallery-slideshow__img {
  max-width: 90vw;
  max-height: 75vh;
  object-fit: contain;
  border-radius: 8px;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.6);
  animation: slideFadeIn 0.8s ease;
}

@keyframes slideFadeIn {
  from { opacity: 0; transform: scale(0.96); }
  to { opacity: 1; transform: scale(1); }
}

.gallery-slideshow__caption {
  position: absolute;
  bottom: 24px;
  text-align: center;
  max-width: 80vw;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(10px);
  padding: 10px 20px;
  border-radius: 999px;
  font-size: 15px;
  font-weight: 500;
}

.gallery-slideshow__controls {
  height: 70px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  background: rgba(0, 0, 0, 0.4);
}

/* --------------------------------------------------------------------------
   8. 移动端自适应微调 (Mobile responsiveness)
   -------------------------------------------------------------------------- */

@media (max-width: 620px) {
  .audio-pill {
    right: 14px;
    bottom: 80px; /* 避开移动端底部导航栏 */
  }

  .audio-pill__panel {
    max-width: 0 !important;
  }

  .audio-pill.is-expanded .audio-pill__panel {
    max-width: 240px !important;
  }

  .memories-bucket {
    padding: 18px;
  }

  .memories-bucket__list {
    grid-template-columns: 1fr;
  }
}
