/* polish: misty blue-pink, wider layout, florals, page-flip, ambient motion */
:root {
  --mist: #c9d9ec;
  --mist-deep: #9eb6d4;
  --sky: #e8f0fa;
  --sky-deep: #d4e3f4;
  --blush: #f7dde6;
  --blush-deep: #ecc0d0;
  --rose: #c989a3;
  --rose-soft: #d9a8bb;
  --cream: #fff8fb;
  --cream-deep: #f3e8f0;
  --paper: #fffcfe;
  --ink: #3d4558;
  --ink-soft: #5a6478;
  --ink-muted: #8791a6;
  --gold: #a8b8d0;
  --gold-soft: #c5d2e6;
  --accent: #7f9fc4;
  --shadow: rgba(90, 110, 140, 0.14);
  --shadow-deep: rgba(70, 90, 120, 0.24);
}

body {
  background-color: var(--sky);
  background-image:
    radial-gradient(ellipse at 12% 8%, rgba(255, 248, 251, 0.95) 0%, transparent 42%),
    radial-gradient(ellipse at 88% 12%, rgba(201, 217, 236, 0.85) 0%, transparent 48%),
    radial-gradient(ellipse at 50% 100%, rgba(247, 221, 230, 0.55) 0%, transparent 55%),
    radial-gradient(circle at 20% 70%, rgba(158, 182, 212, 0.22) 0%, transparent 35%),
    linear-gradient(165deg, #f7fbff 0%, #e8f0fa 35%, #f7e8ef 70%, #e4eef8 100%);
  background-attachment: fixed;
  line-height: 1.65;
  position: relative;
}

body::before,
body::after {
  content: "";
  pointer-events: none;
  position: fixed;
  z-index: 0;
  width: min(360px, 48vw);
  height: min(360px, 48vw);
  opacity: 0.62;
  background-repeat: no-repeat;
  background-size: contain;
  will-change: transform;
}

body::before {
  top: -28px;
  left: -18px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 240 240' fill='none'%3E%3Cpath d='M18 210C42 145 78 120 108 72C122 108 158 128 210 48' stroke='%239eb6d4' stroke-width='1.3' opacity='0.95'/%3E%3Cpath d='M32 188C60 150 82 112 112 88' stroke='%23ecc0d0' stroke-width='1.1' opacity='0.85'/%3E%3Ccircle cx='110' cy='68' r='5' fill='%23c989a3' opacity='0.55'/%3E%3Ccircle cx='82' cy='108' r='3.5' fill='%237f9fc4' opacity='0.5'/%3E%3Cellipse cx='100' cy='62' rx='7' ry='4' fill='%23f7dde6' opacity='0.35' transform='rotate(-25 100 62)'/%3E%3C/svg%3E");
  animation: vineDriftA 28s ease-in-out infinite alternate;
}

body::after {
  right: -22px;
  bottom: -16px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 240 240' fill='none'%3E%3Cpath d='M22 208C48 140 88 118 118 70C132 102 168 126 214 46' stroke='%23ecc0d0' stroke-width='1.3' opacity='0.9'/%3E%3Cpath d='M40 180C68 142 98 118 128 80' stroke='%239eb6d4' stroke-width='1.1' opacity='0.8'/%3E%3Ccircle cx='122' cy='72' r='5.5' fill='%237f9fc4' opacity='0.42'/%3E%3Ccircle cx='90' cy='116' r='3.8' fill='%23c989a3' opacity='0.48'/%3E%3Cellipse cx='115' cy='66' rx='8' ry='4.5' fill='%23f7dde6' opacity='0.38' transform='rotate(-18 115 66)'/%3E%3C/svg%3E");
  animation: vineDriftB 36s ease-in-out infinite alternate;
}

@keyframes vineDriftA {
  0% { transform: translate(0, 0) rotate(0deg); }
  50% { transform: translate(10px, 8px) rotate(2.2deg); }
  100% { transform: translate(4px, -6px) rotate(-1.5deg); }
}

@keyframes vineDriftB {
  0% { transform: scaleX(-1) rotate(8deg) translate(0, 0); }
  50% { transform: scaleX(-1) rotate(10deg) translate(-8px, -10px); }
  100% { transform: scaleX(-1) rotate(6deg) translate(6px, 4px); }
}

/* Single faint rice-paper film. */
#xuan-paper {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none !important;
  opacity: 0.18;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 256 256'%3E%3Cfilter id='n' x='0' y='0' width='100%25' height='100%25'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.8' numOctaves='4' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 0.46 0 0 0 0 0.42 0 0 0 0 0.36 0 0 0 0.5 0'/%3E%3C/filter%3E%3Crect width='256' height='256' filter='url(%23n)'/%3E%3C/svg%3E");
  background-size: 240px 240px;
  animation: xuanPaperDrift 32s ease-in-out infinite alternate;
}

@keyframes xuanPaperDrift {
  from { background-position: 0 0; }
  to { background-position: 18px 12px; }
}

#app {
  max-width: 1100px;
  padding: 0.85rem 1.5rem 2.75rem;
  z-index: 2;
}

#app::before {
  content: "";
  pointer-events: none;
  position: absolute;
  inset: 0.35rem 0.15rem 1rem;
  border: 1px solid rgba(158, 182, 212, 0.45);
  border-radius: 18px;
  box-shadow: inset 0 0 0 6px rgba(255, 252, 254, 0.35), inset 0 0 0 7px rgba(201, 137, 163, 0.18);
  z-index: -1;
}

#app::after {
  content: "✦  ·  ✦  ·  ✦";
  pointer-events: none;
  position: absolute;
  top: 0.55rem;
  left: 50%;
  transform: translateX(-50%);
  font-size: 0.65rem;
  letter-spacing: 0.55em;
  color: rgba(127, 159, 196, 0.55);
  z-index: -1;
}

.topbar {
  background: linear-gradient(180deg, rgba(247, 251, 255, 0.92) 55%, transparent);
}

.view { animation-duration: 0.28s; animation-timing-function: cubic-bezier(0.33, 0.1, 0.25, 1); }
.view.album,
.view.album.active { animation: none; }

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

.cover { position: relative; }

.cover::before {
  content: "";
  position: absolute;
  width: min(640px, 92vw);
  height: min(640px, 92vw);
  top: 50%;
  left: 50%;
  transform: translate(-50%, -52%);
  pointer-events: none;
  z-index: -1;
  background:
    radial-gradient(circle, rgba(255, 252, 254, 0.75) 0%, rgba(201, 217, 236, 0.28) 42%, transparent 68%),
    radial-gradient(circle at 70% 60%, rgba(247, 221, 230, 0.35) 0%, transparent 50%);
  animation: mistPulse 22s ease-in-out infinite alternate;
}

@keyframes mistPulse {
  0% { opacity: 0.7; transform: translate(-50%, -52%) scale(1); }
  100% { opacity: 1; transform: translate(-50%, -52%) scale(1.06); }
}

.cover-ornament {
  width: min(160px, 55%);
  height: 18px;
  margin: 0.85rem auto 1.1rem;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 160 18' fill='none'%3E%3Cpath d='M4 9h58M98 9h58' stroke='%23a8b8d0' stroke-width='1' opacity='0.7'/%3E%3Ccircle cx='80' cy='9' r='3.2' fill='%23c989a3' opacity='0.55'/%3E%3Cellipse cx='68' cy='9' rx='5' ry='2.6' fill='%23ecc0d0' opacity='0.45'/%3E%3Cellipse cx='92' cy='9' rx='5' ry='2.6' fill='%239eb6d4' opacity='0.45'/%3E%3C/svg%3E") center / contain no-repeat;
}

.cover-frame {
  width: min(100%, 480px);
  padding: 2.85rem 2.35rem 2.35rem;
  background:
    radial-gradient(ellipse at 50% 0%, rgba(232, 240, 250, 0.9) 0%, transparent 55%),
    radial-gradient(ellipse at 80% 100%, rgba(247, 221, 230, 0.55) 0%, transparent 50%),
    linear-gradient(155deg, #fffcfe 0%, #f4f8fc 45%, #faf0f5 100%);
  border: 1px solid rgba(158, 182, 212, 0.65);
  border-radius: 8px;
  box-shadow:
    0 1px 0 rgba(197, 210, 230, 0.85),
    0 18px 52px var(--shadow),
    inset 0 0 0 12px rgba(201, 217, 236, 0.42),
    inset 0 0 0 13px rgba(236, 192, 208, 0.32);
  overflow: hidden;
}

.cover-frame::before {
  content: "";
  position: absolute;
  inset: 16px;
  border: 1px solid rgba(158, 182, 212, 0.45);
  border-radius: 4px;
  pointer-events: none;
  box-shadow: inset 0 0 0 1px rgba(236, 192, 208, 0.2);
  background:
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='120' height='120' viewBox='0 0 120 120' fill='none'%3E%3Cpath d='M8 112C22 80 40 70 58 40' stroke='%239eb6d4' stroke-width='1' opacity='0.55'/%3E%3Ccircle cx='58' cy='38' r='3' fill='%23c989a3' opacity='0.4'/%3E%3C/svg%3E") top left / 88px 88px no-repeat,
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='120' height='120' viewBox='0 0 120 120' fill='none'%3E%3Cpath d='M112 8C90 28 78 48 48 62' stroke='%23ecc0d0' stroke-width='1' opacity='0.5'/%3E%3Ccircle cx='48' cy='62' r='2.8' fill='%237f9fc4' opacity='0.4'/%3E%3C/svg%3E") top right / 80px 80px no-repeat,
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='120' height='120' viewBox='0 0 120 120' fill='none'%3E%3Cpath d='M8 8C30 30 38 55 70 78' stroke='%23a8b8d0' stroke-width='0.95' opacity='0.45'/%3E%3Ccircle cx='70' cy='78' r='2.5' fill='%23d9a8bb' opacity='0.4'/%3E%3C/svg%3E") bottom left / 84px 84px no-repeat,
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='120' height='120' viewBox='0 0 120 120' fill='none'%3E%3Cpath d='M112 112C88 90 70 78 42 55' stroke='%239eb6d4' stroke-width='1' opacity='0.5'/%3E%3Ccircle cx='42' cy='55' r='3' fill='%23c989a3' opacity='0.35'/%3E%3C/svg%3E") bottom right / 92px 92px no-repeat;
}

.cover-frame::after {
  content: "❀  ·  ✦  ·  ❀";
  position: absolute;
  bottom: 1.15rem;
  left: 50%;
  transform: translateX(-50%);
  color: rgba(127, 159, 196, 0.62);
  font-size: 0.72rem;
  letter-spacing: 0.35em;
  pointer-events: none;
}

.cover-dedication { color: var(--accent); opacity: 0.85; }
.cover-title {
  font-size: clamp(2.15rem, 7.5vw, 3.05rem);
  letter-spacing: 0.02em;
}
.cover-subtitle {
  font-size: clamp(1.3rem, 4vw, 1.75rem);
  color: var(--accent);
  opacity: 0.92;
}
.cover-names { color: var(--ink-soft); }
.cover-date { color: var(--mist-deep); }

.cover-avatars {
  gap: 0.95rem;
  margin: 0.35rem 0 1.15rem;
}
.cover-avatar {
  width: 96px;
  height: 96px;
  border: 2.5px solid rgba(158, 182, 212, 0.75);
  box-shadow: 0 6px 18px var(--shadow), 0 0 0 4px rgba(247, 221, 230, 0.45);
}
.cover-avatar-heart {
  font-size: 1.15rem;
  opacity: 0.9;
  text-shadow: 0 0 12px rgba(201, 137, 163, 0.35);
}

.cover-open,
.password-btn {
  background: linear-gradient(180deg, #fffcfe, #e4eef8);
  border-color: var(--mist-deep);
  color: var(--accent);
}

.password-btn {
  appearance: none;
  border: 1px solid var(--mist-deep);
  border-radius: 999px;
  padding: 0.72rem 1.4rem;
  cursor: pointer;
  font-size: 1.05rem;
  letter-spacing: 0.12em;
}

.book-page {
  max-width: 580px;
  padding: 1.65rem 1.4rem 1.9rem;
  background: linear-gradient(165deg, #fffcfe 0%, #f8f4fa 55%, #eef4fb 100%);
  border: 1px solid rgba(158, 182, 212, 0.5);
  box-shadow:
    4px 0 0 rgba(201, 217, 236, 0.55),
    8px 0 0 rgba(236, 192, 208, 0.28),
    10px 16px 40px var(--shadow);
  transform-style: preserve-3d;
  transition: transform 0.7s cubic-bezier(0.33, 0.1, 0.25, 1), opacity 0.55s ease;
}

.book-page.flip-next,
.book-page.flip-prev {
  animation: none;
  transition: none;
}

@keyframes flipNext {
  0% { transform: rotateY(0deg) scale(1); opacity: 1; }
  38% { transform: rotateY(-92deg) scale(0.97); opacity: 0.35; }
  39% { transform: rotateY(92deg) scale(0.97); opacity: 0.28; }
  72% { transform: rotateY(12deg) scale(0.995); opacity: 0.85; }
  100% { transform: rotateY(0deg) scale(1); opacity: 1; }
}

@keyframes flipPrev {
  0% { transform: rotateY(0deg) scale(1); opacity: 1; }
  38% { transform: rotateY(92deg) scale(0.97); opacity: 0.35; }
  39% { transform: rotateY(-92deg) scale(0.97); opacity: 0.28; }
  72% { transform: rotateY(-12deg) scale(0.995); opacity: 0.85; }
  100% { transform: rotateY(0deg) scale(1); opacity: 1; }
}

.story-card {
  background: linear-gradient(180deg, rgba(255, 252, 254, 0.98), rgba(248, 240, 246, 0.95));
  border: 1px solid rgba(158, 182, 212, 0.55);
  box-shadow: 0 10px 36px var(--shadow), inset 0 0 0 1px rgba(236, 192, 208, 0.25);
}

.nav-pills button.active {
  background: linear-gradient(180deg, #fffcfe, #e8f0fa);
  border-color: var(--mist-deep);
  color: var(--accent);
}

.lang-toggle button.active {
  background: linear-gradient(180deg, var(--accent), var(--mist-deep));
}

.password-gate {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 400;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  background:
    radial-gradient(ellipse at 25% 15%, rgba(255, 252, 254, 0.96) 0%, transparent 50%),
    radial-gradient(ellipse at 80% 85%, rgba(201, 217, 236, 0.78) 0%, transparent 55%),
    linear-gradient(165deg, #f7fbff 0%, #e8f0fa 45%, #f7e8ef 100%);
}

#ambient-petals {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  overflow: hidden;
}

.ambient-petal {
  position: absolute;
  border-radius: 50% 50% 45% 55%;
  opacity: 0.28;
  will-change: transform, opacity;
  animation-name: petalFloat;
  animation-timing-function: ease-in-out;
  animation-iteration-count: infinite;
  animation-direction: alternate;
}

.ambient-petal:nth-child(odd) {
  background: radial-gradient(circle at 30% 30%, rgba(247, 221, 230, 0.95), rgba(201, 137, 163, 0.35));
}
.ambient-petal:nth-child(even) {
  background: radial-gradient(circle at 35% 30%, rgba(232, 240, 250, 0.95), rgba(127, 159, 196, 0.35));
}

@keyframes petalFloat {
  0% { transform: translate(0, 0) rotate(0deg) scale(1); opacity: 0.18; }
  50% { transform: translate(12px, -18px) rotate(18deg) scale(1.08); opacity: 0.32; }
  100% { transform: translate(-8px, 10px) rotate(-12deg) scale(0.95); opacity: 0.2; }
}

@media (min-width: 900px) {
  #app { padding-left: 2.25rem; padding-right: 2.25rem; }
  .book-page { max-width: 640px; padding: 2rem 1.75rem 2.15rem; }
  .cover-frame { width: min(100%, 520px); padding: 3.1rem 2.6rem 2.6rem; }
  .cover-title { font-size: 3.15rem; }
  .cover-avatar { width: 88px; height: 88px; }
}

@media (prefers-reduced-motion: reduce) {
  body::before,
  body::after,
  #ambient-petals,
  .ambient-petal,
  .cover::before,
  #xuan-paper {
    animation: none !important;
  }
  .book-page.flip-next,
  .book-page.flip-prev {
    animation: none !important;
  }
}

body.locked #app,
body.locked #album-controls,
body.locked #btn-see-us {
  display: none !important;
  pointer-events: none !important;
}

.password-gate {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 400;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  background:
    radial-gradient(ellipse at 25% 15%, rgba(255, 252, 254, 0.96) 0%, transparent 50%),
    radial-gradient(ellipse at 80% 85%, rgba(201, 217, 236, 0.78) 0%, transparent 55%),
    linear-gradient(165deg, #f7fbff 0%, #e8f0fa 45%, #f7e8ef 100%);
}
body.locked .password-gate {
  display: flex;
}
body:not(.locked) .password-gate {
  display: none !important;
}

.password-card {
  width: min(100%, 420px);
  padding: 2.6rem 2.1rem 2.2rem;
  text-align: center;
  background:
    radial-gradient(ellipse at 50% 0%, rgba(232, 240, 250, 0.95) 0%, transparent 55%),
    linear-gradient(155deg, #fffcfe 0%, #f4f8fc 45%, #faf0f5 100%);
  border: 1px solid rgba(158, 182, 212, 0.7);
  border-radius: 10px;
  box-shadow:
    0 18px 52px var(--shadow),
    inset 0 0 0 10px rgba(201, 217, 236, 0.38),
    inset 0 0 0 11px rgba(236, 192, 208, 0.28);
  position: relative;
}
.password-card::before {
  content: "❀  ·  ✦  ·  ❀";
  display: block;
  margin-bottom: 0.85rem;
  color: rgba(127, 159, 196, 0.7);
  letter-spacing: 0.4em;
  font-size: 0.72rem;
}
.password-kicker {
  color: var(--accent);
  letter-spacing: 0.28em;
  font-size: 0.95rem;
  margin-bottom: 0.45rem;
}
.password-title {
  font-size: 1.85rem;
  color: var(--rose);
  margin-bottom: 0.35rem;
}
.password-sub {
  color: var(--ink-muted);
  font-size: 1.05rem;
  margin-bottom: 1.35rem;
}
.password-form {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}
.password-input {
  appearance: none;
  border: 1px solid rgba(158, 182, 212, 0.85);
  border-radius: 999px;
  padding: 0.75rem 1.1rem;
  font-size: 1rem;
  font-family: var(--font-en);
  text-align: center;
  background: rgba(255, 252, 254, 0.9);
  color: var(--ink);
}
.password-input:focus {
  outline: 2px solid rgba(127, 159, 196, 0.45);
  outline-offset: 2px;
}
.password-error {
  margin-top: 0.85rem;
  color: #b06078;
  font-size: 0.95rem;
}

#app {
  max-width: 1180px;
}

.cover-frame {
  width: min(100%, 640px);
  padding: 3.2rem 2.8rem 2.8rem;
}

.cover-title {
  font-size: clamp(2.4rem, 8vw, 3.45rem);
}

.cover-avatar {
  width: 96px;
  height: 96px;
}

.book-page {
  max-width: 720px;
}

.chapter-dots {
  max-width: 36rem;
  margin-left: auto;
  margin-right: auto;
  gap: 0.12rem;
}

.chapter-dot {
  width: 22px;
  height: 22px;
  background: transparent;
  position: relative;
}

.chapter-dot::after {
  content: "";
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--blush-deep);
  display: block;
  margin: 7px auto;
}

.chapter-dot.active,
.chapter-dot:hover {
  background: transparent;
  transform: none;
}

.chapter-dot.active::after {
  background: var(--rose);
  transform: scale(1.25);
}

.chapter-dot:hover::after {
  background: var(--rose-soft);
}

.photo-frame {
  aspect-ratio: auto;
  min-height: 220px;
  background:
    linear-gradient(165deg, rgba(255, 252, 254, 0.9), rgba(232, 240, 250, 0.55));
  box-shadow:
    inset 0 0 0 8px rgba(255, 252, 254, 0.72),
    inset 0 0 0 9px rgba(201, 137, 163, 0.18);
  padding: 10px;
}

.photo-frame--letter,
.photo-placeholder--letter {
  min-height: 260px;
  cursor: default;
}

.photo-placeholder--letter {
  background:
    radial-gradient(circle at 50% 38%, rgba(255, 252, 254, 0.92) 0%, transparent 58%),
    linear-gradient(165deg, #fffcfe 0%, #f7e8ef 48%, #e8f0fa 100%);
}

.lightbox-placeholder--letter {
  min-height: 240px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.photo-frame img {
  height: auto;
  max-height: min(70vh, 680px);
  object-fit: contain;
  background: transparent;
  filter: none;
}

.lightbox-frame img {
  max-width: min(92vw, 920px);
  max-height: 86vh;
  object-fit: contain;
}

.story-card {
  max-width: 720px;
  margin: 0 auto;
  padding: 2.1rem 1.8rem;
}

@media (min-width: 900px) {
  .cover-frame { width: min(100%, 680px); padding: 3.4rem 3rem 2.9rem; }
  .book-page { max-width: 760px; padding: 2.15rem 2rem 2.3rem; }
  .cover-avatar { width: 104px; height: 104px; }
}

