/* ==========================================================================
   《Jing 的生日花园 · 小小盛大》
   Handwritten Lively Watercolor Secret Garden (V5)
   Fonts: Long Cang (expressive title & opening poem) + Yozai (lively handwritten body/UI)
   ========================================================================== */

:root {
  --paper: #faf6ee;
  --paper-soft: #f2ece0;
  --paper-glass: rgba(250, 246, 238, 0.88);
  --ink: #2d3832;
  --ink-soft: #5f6d65;
  --ink-faint: #8e9a92;
  --hairline: rgba(95, 109, 101, 0.14);
  --hairline-strong: rgba(95, 109, 101, 0.26);

  --sage: #6f8a78;
  --sage-hover: #5e7967;
  --rose-wax: #b9786f;
  --rose-soft: #f4e8e5;
  --coral-wash: #d98676;
  --ochre: #b58d3e;

  --title-hand: "Long Cang", "Yozai", "Kaiti SC", cursive, serif;
  --hand: "Long Cang", "Yozai", "Kaiti SC", cursive, serif;
  --serif: "Long Cang", "Noto Serif SC", "Songti SC", Georgia, serif;
  --sans: "Long Cang", "Yozai", "Kaiti SC", cursive, serif;

  --radius-pill: 999px;
  --radius-card: 18px;
  --shadow-soft: 0 8px 24px rgba(45, 56, 50, 0.12);
  --shadow-card: 0 26px 68px rgba(40, 50, 44, 0.16), 0 4px 16px rgba(40, 50, 44, 0.05);
}

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

html,
body {
  margin: 0;
  padding: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
  overscroll-behavior: none;
  background: #d6e8f6;
  color: var(--ink);
  font-family: var(--hand);
  -webkit-font-smoothing: antialiased;
  -webkit-text-size-adjust: 100%;
  -webkit-tap-highlight-color: transparent;
  text-rendering: optimizeLegibility;
}

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

button {
  cursor: pointer;
  border: 0;
  background: none;
  padding: 0;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}

button:focus-visible,
input:focus-visible,
textarea:focus-visible {
  outline: 2px solid var(--sage);
  outline-offset: 3px;
}

[hidden] {
  display: none !important;
}

.VisuallyHidden {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

/* ---------- Stage & Dual Canvases ---------- */

.Stage {
  position: relative;
  width: 100%;
  height: 100vh;
  height: 100svh;
  height: 100dvh;
  overflow: hidden;
  overscroll-behavior: none;
  user-select: none;
  -webkit-user-select: none;
}

.Stage-canvas,
.Stage-fireworks {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  touch-action: none;
}

.Stage-canvas {
  cursor: grab;
  z-index: 1;
}

.Stage-fireworks {
  z-index: 2;
  pointer-events: none;
}

.Stage.is-firework-mode .Stage-fireworks {
  pointer-events: auto;
  cursor: crosshair;
}

/* ---------- Opening Ritual A: Sunlit Morning Mist over Live Soft-Focus Garden ---------- */

.IntroVeil {
  position: absolute;
  inset: 0;
  z-index: 6;
  background: radial-gradient(
    circle at 50% 40%,
    rgba(252, 249, 243, 0.52) 0%,
    rgba(244, 240, 232, 0.34) 100%
  );
  backdrop-filter: blur(11px);
  -webkit-backdrop-filter: blur(11px);
  cursor: pointer;
  transition: opacity 1.3s cubic-bezier(0.22, 1, 0.36, 1),
    backdrop-filter 1.3s cubic-bezier(0.22, 1, 0.36, 1),
    -webkit-backdrop-filter 1.3s cubic-bezier(0.22, 1, 0.36, 1),
    visibility 1.3s ease;
}

.IntroVeil.is-lifted {
  opacity: 0;
  backdrop-filter: blur(0px);
  -webkit-backdrop-filter: blur(0px);
  visibility: hidden;
  pointer-events: none;
}

/* Poetic opening line: appears vividly during morning mist, then naturally dissolves into clouds */
.SkyPoem {
  position: absolute;
  top: clamp(104px, 19vh, 188px);
  left: 50%;
  transform: translateX(-50%);
  z-index: 15;
  margin: 0;
  width: min(88vw, 560px);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  text-align: center;
  font-family: var(--title-hand);
  font-size: clamp(24px, 3.8vw, 34px);
  letter-spacing: 0.14em;
  line-height: 1.55;
  color: rgba(45, 56, 50, 0.82);
  text-shadow: 0 2px 18px rgba(255, 253, 246, 0.85);
  pointer-events: none;
  transition: opacity 1.8s ease, transform 1.8s ease;
}

.SkyPoem-line {
  opacity: 0;
  transform: translateY(10px);
  animation: poemFadeIn 1.05s cubic-bezier(0.22, 1, 0.36, 1) forwards;
}

.SkyPoem-line--1 {
  animation-delay: 0.25s;
}

.SkyPoem-line--2 {
  animation-delay: 0.95s;
}

@keyframes poemFadeIn {
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.SkyPoem.is-dissolved,
.Stage.is-firework-mode .SkyPoem {
  opacity: 0;
  transform: translate(-50%, -18px);
}

@media (prefers-reduced-motion: reduce) {
  .SkyPoem-line {
    opacity: 1;
    transform: none;
    animation: none;
  }
}

/* ---------- Minimal Borderless Top Header (Generous 1.8x Title Spacing!) ---------- */

.TopBar {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  z-index: 10;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  padding: calc(22px + env(safe-area-inset-top)) 28px 12px;
  pointer-events: none;
}

.Stage.is-firework-mode .Masthead-title {
  color: rgba(255, 255, 255, 0.96);
  text-shadow: 0 2px 14px rgba(24, 48, 82, 0.24);
}

.Stage.is-firework-mode .Masthead-sub,
.Stage.is-firework-mode .LinkAction {
  color: rgba(255, 255, 255, 0.86);
  text-shadow: 0 1px 10px rgba(24, 48, 82, 0.24);
}

/* Strictly left-aligned Masthead with 1.8x breathing spacing */
.Masthead {
  pointer-events: auto;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  text-align: left;
}

.Masthead-title {
  margin: 0;
  padding: 0;
  font-family: var(--title-hand);
  font-size: clamp(32px, 3.9vw, 42px);
  font-weight: 400;
  letter-spacing: 0.06em;
  line-height: 1.2;
  color: var(--ink);
  transition: color 0.5s ease;
}

.Masthead-sub {
  margin: 16px 0 0 0;
  padding: 0;
  font-family: var(--hand);
  font-size: 20px;
  letter-spacing: 0.22em;
  line-height: 1.55;
  color: var(--ink-soft);
  transition: color 0.5s ease;
  cursor: default;
}

.TopActions {
  pointer-events: auto;
  display: flex;
  align-items: center;
  gap: 14px;
  padding-top: 6px;
}

.OwnerControls {
  pointer-events: auto;
  display: flex;
  align-items: center;
  gap: 10px;
  padding-top: 6px;
}

.ActionDivider {
  opacity: 0.35;
}

.LinkAction {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 32px;
  padding: 2px 4px;
  font-family: var(--hand);
  font-size: 18px;
  letter-spacing: 0.08em;
  color: var(--ink-soft);
  position: relative;
  transition: color 0.2s ease;
}

.LinkAction::after {
  content: "";
  position: absolute;
  left: 4px;
  right: 4px;
  bottom: 2px;
  height: 1px;
  background: currentColor;
  opacity: 0;
  transform: scaleX(0.4);
  transition: opacity 0.2s ease, transform 0.2s ease;
}

.LinkAction:hover {
  color: var(--ink);
}

.Stage.is-firework-mode .LinkAction:hover {
  color: #fff;
}

.LinkAction:hover::after {
  opacity: 0.5;
  transform: scaleX(1);
}

.LinkAction--icon {
  padding: 4px;
}

.LinkAction--icon::after {
  display: none;
}

.LinkAction--accent {
  color: var(--ink);
}

.UnreadDot {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 999px;
  background: var(--rose-wax);
  color: #fffaf6;
  font-family: var(--sans);
  font-size: 10.5px;
  font-weight: 500;
}

.Icon {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
}

.Icon--sm {
  width: 16px;
  height: 16px;
}

.Icon--xs {
  width: 14px;
  height: 14px;
}

.FireworkIcon {
  width: 24px;
  height: 24px;
  flex-shrink: 0;
  display: block;
}

.FireworkIcon--sm {
  width: 18px;
  height: 18px;
}

/* ---------- Minimal Firework Sky Bar ("回到花园" + firework menu) ---------- */

.SkyBar {
  position: absolute;
  left: 50%;
  bottom: calc(28px + env(safe-area-inset-bottom));
  transform: translateX(-50%);
  z-index: 12;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  max-width: calc(100vw - 24px);
}

.SkyBar-pillRow {
  display: inline-flex;
  align-items: center;
  gap: 10px;
}

.PaperPill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 0 24px;
  border-radius: var(--radius-pill);
  background: var(--paper-glass);
  color: var(--ink);
  font-family: var(--hand);
  font-size: 19.5px;
  letter-spacing: 0.12em;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  box-shadow: 0 8px 24px rgba(24, 38, 56, 0.16);
  transition: transform 0.18s ease, background-color 0.18s ease;
}

.PaperPill:hover {
  background: #fdfbf6;
  transform: translateY(-1px);
}

.PaperPill:active {
  transform: scale(0.96);
}

.PaperPill--icon {
  width: 44px;
  height: 44px;
  padding: 0;
}

.PaperPill--icon[aria-expanded="true"] {
  background: #fdfbf6;
  color: var(--rose-wax);
}

.SkyMenu {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 13px 16px;
  border-radius: 18px;
  background: rgba(250, 246, 238, 0.94);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  box-shadow: 0 16px 40px rgba(24, 38, 56, 0.2);
  width: min(92vw, 440px);
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
}

.SkyMenu-group {
  display: flex;
  flex-wrap: wrap;
  flex-wrap: balance;
  justify-content: center;
  gap: 5px 7px;
}

.SkyMenu-divider {
  width: 60%;
  height: 1px;
  background: var(--hairline);
}

.SkyMenuBtn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 36px;
  padding: 5px 13px;
  border-radius: var(--radius-pill);
  font-family: var(--hand);
  font-size: 18px;
  letter-spacing: 0.06em;
  color: var(--ink);
  transition: background-color 0.15s ease, color 0.15s ease, transform 0.12s ease;
}

.SkyMenuBtn:hover {
  background: rgba(111, 138, 120, 0.14);
}

.SkyMenuBtn:active {
  transform: scale(0.96);
}

.SkyMenuBtn--soft {
  font-size: 16.5px;
  color: var(--ink-soft);
}

.SkyMenuBtn[aria-pressed="true"] {
  background: var(--sage);
  color: #faf6ee;
}

/* ---------- Scheme 1 Unboxed Bottom Actions (Watercolor Primary + Whisper Secondary) ---------- */

.BottomArea {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 10;
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 0 26px calc(24px + env(safe-area-inset-bottom));
  pointer-events: none;
  transition: opacity 0.45s ease, transform 0.45s ease;
}

.Stage.is-firework-mode .BottomArea {
  opacity: 0;
  transform: translateY(14px);
}

/* Organic feathered watercolor blush CTA — zero rigid box or rectangle! */
.WatercolorCta {
  pointer-events: auto;
  position: relative;
  display: inline-grid;
  place-items: center;
  min-width: 196px;
  height: 62px;
  padding: 0 32px;
  transition: transform 0.24s cubic-bezier(0.22, 1, 0.36, 1), filter 0.24s ease;
}

.Stage.is-firework-mode .WatercolorCta,
.Stage.is-firework-mode .FireworkWhisperBtn {
  pointer-events: none;
}

.WatercolorCta-wash {
  position: absolute;
  inset: -6px -14px;
  width: calc(100% + 28px);
  height: calc(100% + 12px);
  pointer-events: none;
  transition: transform 0.3s ease, opacity 0.3s ease;
}

.WatercolorCta-label {
  position: relative;
  z-index: 1;
  font-family: var(--hand);
  font-size: 22px;
  letter-spacing: 0.14em;
  color: #fffcf7;
  text-shadow: 0 1px 8px rgba(136, 62, 48, 0.35);
}

.WatercolorCta:hover {
  transform: translateY(-2px) scale(1.03);
}

.WatercolorCta:hover .WatercolorCta-wash {
  transform: scale(1.04);
}

.WatercolorCta:active {
  transform: scale(0.97);
}

/* Quiet unboxed secondary firework link tucked softly to the bottom-right */
.FireworkWhisperBtn {
  pointer-events: auto;
  position: absolute;
  right: 28px;
  bottom: calc(32px + env(safe-area-inset-bottom));
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  gap: 6px;
  padding: 8px 10px;
  font-family: var(--hand);
  font-size: 18.5px;
  letter-spacing: 0.1em;
  color: rgba(255, 253, 248, 0.94);
  text-shadow: 0 1px 10px rgba(34, 48, 38, 0.55);
  opacity: 0.92;
  transition: opacity 0.2s ease, transform 0.2s ease;
}

.FireworkWhisperBtn:hover {
  opacity: 1;
  transform: translateY(-1px);
}

.FireworkWhisperBtn:active {
  transform: scale(0.96);
}

/* ---------- Toast ---------- */

.Toast {
  position: absolute;
  left: 50%;
  bottom: calc(96px + env(safe-area-inset-bottom));
  transform: translateX(-50%);
  z-index: 20;
  display: inline-flex;
  align-items: center;
  gap: 12px;
  max-width: min(92vw, 440px);
  padding: 10px 18px;
  border-radius: var(--radius-pill);
  background: rgba(45, 56, 50, 0.88);
  color: #faf6ee;
  font-family: var(--hand);
  font-size: 18px;
  letter-spacing: 0.06em;
  box-shadow: 0 12px 32px rgba(40, 50, 44, 0.2);
}

.Toast-action {
  color: #f4d892;
  white-space: nowrap;
}

/* ==========================================================================
   Native <dialog> Modals & Single-Sheet Ruled Stationery Letter
   ========================================================================== */

dialog:modal {
  overscroll-behavior: contain;
}

dialog::backdrop {
  overflow: hidden;
  overscroll-behavior: contain;
}

.ModalCard {
  margin: auto;
  padding: 0;
  border: 1px solid var(--hairline);
  border-radius: var(--radius-card);
  width: min(476px, calc(100vw - 28px));
  max-height: min(88vh, 720px);
  max-height: min(88svh, 720px);
  max-height: min(88dvh, 720px);
  background: var(--paper);
  color: var(--ink);
  box-shadow: var(--shadow-card);
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;

  opacity: 0;
  transition-property: opacity, transform, display, overlay;
  transition-duration: 0.28s;
  transition-timing-function: cubic-bezier(0.22, 1, 0.36, 1);
  transition-behavior: allow-discrete;
}

@media (prefers-reduced-motion: no-preference) {
  .ModalCard {
    transform: translateY(14px) scale(0.97);
  }
}

.ModalCard--compact {
  width: min(400px, calc(100vw - 28px));
}

.ModalCard--stationery {
  width: min(460px, calc(100vw - 28px));
  border-radius: 14px;
  background-color: #fcf9f2;
  background-image:
    radial-gradient(circle at 88% 12%, rgba(235, 220, 198, 0.32), transparent 55%),
    repeating-linear-gradient(
      to bottom,
      transparent 0px,
      transparent 33px,
      rgba(130, 142, 134, 0.1) 34px
    );
  background-position: 0 0, 0 58px;
}

.ModalCard::backdrop {
  background-color: rgba(40, 50, 44, 0);
  backdrop-filter: blur(0px);
  transition-property: background-color, backdrop-filter, display, overlay;
  transition-duration: 0.28s;
  transition-timing-function: ease-out;
  transition-behavior: allow-discrete;
}

.ModalCard[open]:where(:not([data-closing])) {
  opacity: 1;

  @starting-style {
    opacity: 0;
  }

  @media (prefers-reduced-motion: no-preference) {
    transform: translateY(0) scale(1);

    @starting-style {
      transform: translateY(14px) scale(0.97);
    }
  }

  &::backdrop {
    background-color: rgba(40, 50, 44, 0.24);
    backdrop-filter: blur(4px);

    @starting-style {
      background-color: rgba(40, 50, 44, 0);
      backdrop-filter: blur(0px);
    }
  }
}

@media (prefers-reduced-motion: reduce) {
  .ModalCard,
  .ModalCard::backdrop {
    transition-duration: 0.1s;
  }
}

.ModalCard-inner {
  padding: 26px 26px 24px;
}

.ModalHeader {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.ModalTitle {
  margin: 0;
  font-family: var(--hand);
  font-size: 26px;
  font-weight: 400;
  letter-spacing: 0.08em;
  color: var(--ink);
}

.CloseBtn {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--ink-soft);
  flex-shrink: 0;
  transition: background-color 0.16s ease, color 0.16s ease;
}

.CloseBtn:hover {
  background: rgba(111, 138, 120, 0.12);
  color: var(--ink);
}

.ModalPrivacyNote {
  margin: 0 0 16px;
  font-family: var(--hand);
  font-size: 17.5px;
  line-height: 1.75;
  color: var(--ink-soft);
  text-wrap: pretty;
}

.ModalPrivacyNote strong {
  color: var(--ink);
  font-weight: 500;
}

.ModalPrivacyNote code {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  color: var(--sage);
}

.PromptBox {
  padding: 12px 15px;
  margin-bottom: 14px;
  border-radius: 12px;
  background: var(--paper-soft);
}

.PromptBox-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 5px;
}

.PromptBox-tag {
  font-family: var(--hand);
  font-size: 16px;
  color: var(--ink-faint);
}

.TextActionBtn {
  font-family: var(--hand);
  font-size: 16px;
  color: var(--sage);
  border-bottom: 1px solid rgba(111, 138, 120, 0.35);
}

.PromptBox-text {
  margin: 0;
  font-family: var(--hand);
  font-size: 19.5px;
  line-height: 1.65;
  color: var(--ink);
  text-wrap: pretty;
}

.GiftForm {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.ModalCard.GiftComposer {
  --gift-layout-height: 100vh;
  --gift-cap: min(calc(var(--gift-layout-height) * 0.88), 720px);
  --gift-inline-padding: 26px;
  max-height: var(--gift-cap);
  overflow: hidden;
}

@supports (height: 100dvh) {
  .ModalCard.GiftComposer {
    --gift-layout-height: 100dvh;
  }
}

.GiftForm.GiftComposer-form {
  display: grid;
  grid-template-rows: minmax(0, 1fr) auto;
  gap: 0;
  max-height: calc(var(--gift-cap) - 2px);
}

.GiftComposer-scroll {
  overflow-y: auto;
  overscroll-behavior: contain;
  scroll-padding-block: 12px;
  padding: 26px var(--gift-inline-padding) 18px;
}

.GiftComposer-fields {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.GiftComposer-actions {
  padding: 12px var(--gift-inline-padding) 16px;
  border-top: 1px solid var(--hairline);
  background: var(--paper);
}

.GiftComposer-status {
  margin: 0;
  color: var(--ink-soft);
  font-size: 16.5px;
}

.GiftComposer-actions .ModalFooter {
  margin-top: 0;
}

.GiftComposer-actions :is(.GiftComposer-status, .FormError):not([hidden]) {
  margin-bottom: 8px;
}

.Field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.FieldLabel {
  font-family: var(--hand);
  font-size: 16.5px;
  color: var(--ink-soft);
  padding: 0;
}

.GiftForm textarea,
.GiftForm input {
  width: 100%;
  padding: 12px 14px;
  border-radius: 12px;
  border: 1px solid var(--hairline-strong);
  background: rgba(255, 254, 250, 0.88);
  font-family: var(--hand);
  font-size: 19.5px;
  line-height: 1.75;
  color: var(--ink);
  transition: border-color 0.16s ease, box-shadow 0.16s ease;
}

.GiftForm textarea {
  resize: vertical;
  min-height: 112px;
}

.GiftForm textarea:focus,
.GiftForm input:focus {
  outline: none;
  border-color: var(--sage);
  box-shadow: 0 0 0 3px rgba(111, 138, 120, 0.14);
}

.GiftForm textarea::placeholder,
.GiftForm input::placeholder {
  color: #a6b0a8;
}

.SwatchField {
  border: 0;
  margin: 0;
  padding: 0;
}

.SwatchRow {
  display: flex;
  flex-wrap: wrap;
  flex-wrap: balance;
  gap: 8px;
  margin-top: 8px;
}

.SwatchBtn {
  display: inline-flex;
  align-items: center;
  min-height: 36px;
  gap: 6px;
  padding: 6px 12px 6px 9px;
  border-radius: var(--radius-pill);
  border: 1px solid var(--hairline);
  background: #ede6da;
  font-family: var(--hand);
  font-size: 16.5px;
  color: var(--ink-soft);
  transition: border-color 0.15s ease, transform 0.15s ease, background-color 0.15s ease;
}

.SwatchBtn:hover {
  transform: translateY(-1px);
}

.SwatchBtn[aria-checked="true"] {
  border-color: var(--sage);
  background: #e4ddd0;
  color: var(--ink);
}

.SwatchDot {
  width: 13px;
  height: 13px;
  border-radius: 50%;
  background: var(--swatch-color);
  border: 1px solid rgba(45, 56, 50, 0.16);
}

.FormError {
  margin: 0;
  font-family: var(--hand);
  font-size: 16.5px;
  color: var(--rose-wax);
}

.ModalFooter {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 10px;
  margin-top: 4px;
}

.PrimaryBtn {
  min-height: 42px;
  padding: 0 24px;
  border-radius: var(--radius-pill);
  background: var(--coral-wash);
  color: #fffcf7;
  font-family: var(--hand);
  font-size: 19px;
  letter-spacing: 0.1em;
  transition: background-color 0.16s ease, transform 0.16s ease, opacity 0.16s ease;
}

.PrimaryBtn:hover:not(:disabled) {
  background: #cb7666;
  transform: translateY(-1px);
}

.PrimaryBtn:disabled {
  opacity: 0.6;
  cursor: wait;
}

.GhostBtn {
  min-height: 42px;
  padding: 0 18px;
  border-radius: var(--radius-pill);
  border: 1px solid var(--hairline-strong);
  color: var(--ink-soft);
  font-family: var(--hand);
  font-size: 18px;
  transition: background-color 0.15s ease, color 0.15s ease;
}

.GhostBtn:hover {
  background: rgba(111, 138, 120, 0.08);
  color: var(--ink);
}

/* ---------- Single-Sheet Stationery Styling ---------- */

.Stationery-inner {
  position: relative;
  padding: 26px 28px 24px;
}

.StationeryTop {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 18px;
}

.StationeryMeta {
  display: inline-flex;
  align-items: center;
  gap: 10px;
}

.SpecimenDot {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  border: 1px solid rgba(45, 56, 50, 0.14);
}

.StationerySpecies {
  margin: 0;
  font-family: var(--hand);
  font-size: 20px;
  font-weight: 400;
  letter-spacing: 0.08em;
  color: var(--ink-soft);
}

.UnsealVeil {
  position: absolute;
  inset: 0;
  z-index: 4;
  display: grid;
  place-items: center;
  background: rgba(252, 249, 242, 0.96);
  transition: opacity 0.55s ease, transform 0.55s ease;
}

.UnsealVeil.is-cracking {
  opacity: 0;
  transform: scale(1.12);
  pointer-events: none;
}

.WaxSealSvg {
  width: 66px;
  height: 66px;
  filter: drop-shadow(0 6px 14px rgba(185, 120, 111, 0.28));
}

.StationeryBody {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.StationeryPrompt {
  margin: 0;
  font-family: var(--hand);
  font-size: 16.5px;
  color: var(--ink-faint);
}

.StationeryText {
  margin: 0;
  padding: 4px 0 12px;
  font-family: var(--hand);
  font-size: 22.5px;
  line-height: 34px;
  color: var(--ink);
  white-space: pre-wrap;
  word-break: break-word;
  text-wrap: pretty;
}

.StationerySign {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 2px;
  padding: 4px 2px 10px;
}

.StationeryAuthor {
  font-family: var(--hand);
  font-size: 20.5px;
  color: var(--ink);
  letter-spacing: 0.08em;
}

.StationeryDate {
  font-family: var(--hand);
  font-size: 16px;
  color: var(--ink-faint);
}

.StationeryActions {
  display: flex;
  align-items: center;
  gap: 14px;
  padding-top: 12px;
  border-top: 1px dashed var(--hairline);
}

.QuietAction {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-family: var(--hand);
  font-size: 17.5px;
  color: var(--ink-soft);
  padding: 4px 2px;
  transition: color 0.15s ease;
}

.QuietAction:hover {
  color: var(--ink);
}

.QuietAction--push {
  margin-left: auto;
  color: var(--sage);
}

.QuietAction.is-starred {
  color: var(--ochre);
}

.QuietAction.is-starred svg {
  fill: var(--ochre);
  stroke: var(--ochre);
}

.SealedBody {
  text-align: center;
  padding: 10px 6px 6px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
}

.SealedLead {
  margin: 0;
  font-family: var(--hand);
  font-size: 22.5px;
  letter-spacing: 0.08em;
}

.SealedDesc {
  margin: 0;
  font-family: var(--hand);
  font-size: 18.5px;
  line-height: 1.85;
  color: var(--ink-soft);
  max-width: 320px;
  text-wrap: pretty;
}

.SealedActions {
  display: flex;
  gap: 10px;
  margin-top: 6px;
  flex-wrap: wrap;
  justify-content: center;
}

/* ==========================================================================
   Right-Side Herbarium Drawer (压花册)
   ========================================================================== */

.Drawer {
  --drawer-width: min(430px, 92vw);
  --drawer-width: min(430px, 92dvw);
  --drawer-backdrop: 0;

  inset: 0;
  width: auto;
  height: auto;
  max-width: none;
  max-height: none;
  margin: 0;
  padding: 0;
  background: transparent;
  border: 0;
  overflow: visible;
}

.Drawer::backdrop {
  background: #232d27;
  opacity: calc(var(--drawer-backdrop) * 0.3);
}

@supports not (animation-timeline: scroll()) {
  .Drawer[open]::backdrop {
    opacity: 0.26;
  }
}

.Drawer-scroller {
  position: relative;
  display: grid;
  grid-template-columns: 100% var(--drawer-width);
  overflow-x: scroll;
  overscroll-behavior: none;
  scrollbar-width: none;
  scroll-snap-type: x mandatory;
}

.Drawer-scroller::-webkit-scrollbar {
  display: none;
}

@media (prefers-reduced-motion: no-preference) {
  .Drawer-scroller {
    scroll-behavior: smooth;
  }
}

.Drawer-scroller::before {
  content: "";
  scroll-snap-align: start;
  scroll-initial-target: nearest;
}

.Drawer-sheet {
  display: flex;
  flex-direction: column;
  height: 100vh;
  height: 100svh;
  height: 100dvh;
  background: var(--paper);
  color: var(--ink);
  border-left: 1px solid var(--hairline);
  box-shadow: -16px 0 48px rgba(34, 44, 38, 0.14);
  scroll-snap-align: end;
  overflow: hidden;
}

@supports (animation-timeline: scroll()) {
  .Drawer {
    timeline-scope: --drawer-fade;
    animation: fade-drawer-backdrop linear both;
    animation-timeline: --drawer-fade;
  }

  .Drawer-scroller {
    scroll-timeline: --drawer-fade x;
  }

  @property --drawer-backdrop {
    syntax: "<number>";
    inherits: true;
    initial-value: 0;
  }

  @keyframes fade-drawer-backdrop {
    0% {
      --drawer-backdrop: 0;
    }
    100% {
      --drawer-backdrop: 1;
    }
  }
}

.DrawerHeader {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: calc(20px + env(safe-area-inset-top)) 22px 14px;
  border-bottom: 1px solid var(--hairline);
}

.DrawerTitle {
  margin: 0;
  font-family: var(--title-hand);
  font-size: 26px;
  font-weight: 400;
  letter-spacing: 0.08em;
}

.DrawerToolbar {
  padding: 12px 22px 14px;
  border-bottom: 1px solid var(--hairline);
  background: var(--paper-soft);
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.DrawerStats {
  display: flex;
  align-items: baseline;
  justify-content: center;
  gap: 12px;
  padding: 8px 14px;
  border-radius: 12px;
  background: rgba(253, 251, 246, 0.88);
  border: 1px solid var(--hairline);
}

.DrawerStat {
  display: inline-flex;
  align-items: baseline;
  gap: 4px;
}

.DrawerStat-num {
  font-family: var(--hand);
  font-size: 22px;
  color: var(--rose-wax);
  line-height: 1;
}

.DrawerStat-label {
  font-family: var(--hand);
  font-size: 15.5px;
  color: var(--ink-soft);
}

.DrawerStat-sep {
  color: var(--ink-faint);
  opacity: 0.55;
}

.VisitorCard {
  gap: 10px;
}

.VisitorCard-name {
  font-family: var(--hand);
  font-size: 19px;
  color: var(--ink);
}

.VisitorCard-time {
  font-family: var(--hand);
  font-size: 14.5px;
  color: var(--ink-faint);
}

.VisitorCard-metrics {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.VisitorMetric {
  display: inline-flex;
  align-items: center;
  padding: 3px 11px;
  border-radius: var(--radius-pill);
  font-family: var(--hand);
  font-size: 15.5px;
  background: var(--paper-soft);
  color: var(--ink-soft);
}

.VisitorMetric--fw {
  background: rgba(230, 134, 110, 0.14);
  color: #a65442;
}

.VisitorMetric--flower {
  background: rgba(111, 138, 120, 0.14);
  color: #486352;
}

.FilterTabs {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  flex-wrap: balance;
}

.FilterTab {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 36px;
  padding: 5px 13px;
  border-radius: var(--radius-pill);
  font-family: var(--hand);
  font-size: 17.5px;
  color: var(--ink-soft);
  transition: background-color 0.15s ease, color 0.15s ease;
}

.FilterTab:hover {
  background: rgba(111, 138, 120, 0.1);
}

.FilterTab.is-active {
  background: var(--sage);
  color: #fdfbf6;
}

.DrawerQuickActions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.SoftPillBtn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 36px;
  padding: 0 14px;
  border-radius: var(--radius-pill);
  font-family: var(--hand);
  font-size: 17px;
  color: var(--ink-soft);
  background: #fdfbf6;
  border: 1px solid var(--hairline);
  transition: background-color 0.15s ease, color 0.15s ease;
}

.SoftPillBtn:hover {
  background: #f5f0e5;
  color: var(--ink);
}

.ArchiveList {
  flex: 1;
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  padding: 16px 22px calc(24px + env(safe-area-inset-bottom));
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.ArchiveCard {
  padding: 16px 18px;
  border-radius: 14px;
  background: #fdfbf6;
  border: 1px solid var(--hairline);
  display: flex;
  flex-direction: column;
  gap: 9px;
}

.ArchiveCard.is-unread {
  background: #fcf6f3;
  border-color: rgba(185, 120, 111, 0.36);
}

.ArchiveCard-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.ArchiveCard-id {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-family: var(--hand);
  font-size: 17px;
  color: var(--ink-soft);
}

.ArchiveCard-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  border: 1px solid rgba(45, 56, 50, 0.14);
}

.ArchiveCard-badge {
  font-family: var(--hand);
  font-size: 14.5px;
  padding: 1px 8px;
  border-radius: 999px;
  background: var(--rose-soft);
  color: #8f4e46;
}

.ArchiveCard-badge--self {
  background: rgba(111, 138, 120, 0.14);
  color: #486352;
}

.ArchiveCard-prompt {
  margin: 0;
  font-family: var(--hand);
  font-size: 15.5px;
  color: var(--ink-faint);
}

.ArchiveCard-msg {
  margin: 0;
  font-family: var(--hand);
  font-size: 20px;
  line-height: 1.75;
  color: var(--ink);
  white-space: pre-wrap;
  word-break: break-word;
  text-wrap: pretty;
}

.ArchiveCard-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
  padding-top: 8px;
  border-top: 1px dashed var(--hairline);
  font-family: var(--hand);
  font-size: 16.5px;
  color: var(--ink-soft);
}

.ArchiveCard-btns {
  display: flex;
  align-items: center;
  gap: 10px;
}

.TinyIconBtn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-family: var(--hand);
  font-size: 16.5px;
  color: var(--ink-soft);
  padding: 2px 4px;
  transition: color 0.15s ease;
}

.TinyIconBtn:hover {
  color: var(--ink);
}

.TinyIconBtn.is-starred {
  color: var(--ochre);
}

.TinyIconBtn.is-starred svg {
  fill: var(--ochre);
  stroke: var(--ochre);
}

.ArchiveEmpty {
  padding: 44px 16px;
  text-align: center;
  font-family: var(--hand);
  font-size: 16px;
  color: var(--ink-faint);
}

/* ==========================================================================
   Mobile Responsive & Touch UX (360px–430px iOS Safari / Android / WeChat)
   ========================================================================== */

@media (max-width: 640px) {
  .TopBar {
    gap: 10px;
    padding: calc(16px + env(safe-area-inset-top)) max(18px, env(safe-area-inset-right)) 10px
      max(18px, env(safe-area-inset-left));
  }

  .Masthead {
    min-width: 0;
    flex: 1 1 auto;
  }

  .Masthead-title {
    font-size: clamp(28px, 7.6vw, 33px);
    line-height: 1.2;
  }

  .Masthead-sub {
    margin-top: 14px;
    font-size: 18px;
    letter-spacing: 0.2em;
    line-height: 1.55;
  }

  .OwnerControls {
    gap: 6px;
    padding-top: 2px;
    flex-shrink: 0;
    flex-wrap: wrap;
    justify-content: flex-end;
  }

  .LinkAction {
    min-height: 40px;
    padding: 6px;
    font-size: 17px;
    white-space: nowrap;
  }

  .SkyPoem {
    top: calc(136px + env(safe-area-inset-top));
    width: min(90vw, 420px);
    gap: 6px;
    font-size: clamp(24px, 6.4vw, 29px);
    letter-spacing: 0.12em;
    line-height: 1.5;
  }

  .BottomArea {
    flex-direction: column;
    gap: 4px;
    padding: 0 18px calc(18px + env(safe-area-inset-bottom));
  }

  .WatercolorCta {
    min-width: 186px;
    min-height: 54px;
    height: 56px;
    padding: 0 28px;
  }

  .WatercolorCta-label {
    font-size: 21px;
  }

  .FireworkWhisperBtn {
    position: static;
    min-height: 44px;
    padding: 8px 16px;
    font-size: 18px;
    gap: 7px;
  }

  .SkyBar {
    bottom: calc(20px + env(safe-area-inset-bottom));
    gap: 10px;
  }

  .SkyMenu {
    width: min(92vw, 380px);
    padding: 10px 12px;
    gap: 7px;
    max-height: 55svh;
    max-height: 55dvh;
    overflow-y: auto;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
  }

  .SkyMenu-group {
    gap: 6px 7px;
  }

  .SkyMenuBtn {
    min-height: 36px;
    padding: 6px 12px;
    font-size: 17px;
  }

  .SkyMenuBtn--soft {
    font-size: 16px;
  }

  .Toast {
    bottom: calc(126px + env(safe-area-inset-bottom));
    max-width: calc(100vw - 24px);
    padding: 10px 16px;
    gap: 6px 12px;
    flex-wrap: wrap;
    justify-content: center;
    text-align: center;
    font-size: 16.5px;
  }

  .Toast-action {
    min-height: 32px;
    padding: 2px 4px;
  }

  .ModalCard,
  .ModalCard--compact,
  .ModalCard--stationery {
    width: calc(100vw - 24px);
    max-width: 460px;
    max-height: 86svh;
    max-height: 86dvh;
    border-radius: 16px;
    -webkit-overflow-scrolling: touch;
  }

  .ModalCard-inner,
  .Stationery-inner {
    padding: 20px 18px 20px;
  }

  .ModalCard.GiftComposer {
    --gift-cap: min(calc(var(--gift-layout-height) * 0.86), 720px);
    --gift-inline-padding: 18px;
  }

  .GiftComposer-scroll {
    padding-top: 14px;
    padding-bottom: 14px;
  }

  .GiftComposer .ModalHeader,
  .GiftComposer .ModalPrivacyNote,
  .GiftComposer .PromptBox {
    margin-bottom: 10px;
  }

  .GiftComposer .ModalPrivacyNote,
  .GiftComposer .PromptBox-text {
    font-size: 17px;
    line-height: 1.5;
  }

  .GiftComposer .PromptBox {
    padding: 8px 12px;
  }

  .GiftComposer-fields {
    gap: 12px;
  }

  .GiftComposer-actions {
    padding-top: 8px;
    padding-bottom: 10px;
  }

  .GiftComposer-actions .ModalFooter {
    gap: 8px;
  }

  .GiftComposer-actions :is(.PrimaryBtn, .GhostBtn) {
    padding-inline: 12px;
  }

  .ModalTitle {
    font-size: 24px;
  }

  .CloseBtn {
    width: 40px;
    height: 40px;
  }

  .TextActionBtn {
    display: inline-flex;
    align-items: center;
    min-height: 36px;
    padding: 4px 6px;
  }

  .GiftForm {
    gap: 12px;
  }

  .GiftForm textarea,
  .GiftForm input {
    font-size: 18.5px;
    padding: 11px 13px;
  }

  .GiftForm textarea {
    min-height: 96px;
  }

  .SwatchRow {
    gap: 7px;
  }

  .SwatchBtn {
    min-height: 36px;
    padding: 6px 12px 6px 10px;
    font-size: 16.5px;
  }

  .PrimaryBtn,
  .GhostBtn {
    min-height: 44px;
  }

  .ModalFooter {
    gap: 10px;
    flex-wrap: wrap;
  }

  .StationeryText {
    font-size: 21px;
    line-height: 34px;
  }

  .StationeryActions {
    flex-wrap: wrap;
    gap: 6px 12px;
    padding-top: 10px;
  }

  .QuietAction {
    min-height: 40px;
    padding: 6px 8px;
    font-size: 17px;
  }

  .DrawerHeader {
    padding: calc(16px + env(safe-area-inset-top)) 18px 12px;
  }

  .DrawerToolbar {
    padding: 12px 18px 14px;
  }

  .FilterTab {
    min-height: 40px;
    padding: 6px 14px;
    font-size: 17px;
  }

  .SoftPillBtn {
    min-height: 40px;
    padding: 0 14px;
    font-size: 16.5px;
  }

  .ArchiveList {
    padding: 14px 18px calc(24px + env(safe-area-inset-bottom));
  }

  .ArchiveCard {
    padding: 14px 16px;
  }

  .TinyIconBtn {
    min-height: 40px;
    padding: 6px 8px;
  }
}

@media (pointer: coarse) {
  .ModalCard.GiftComposer {
    --gift-viewport-height: var(--gift-visible-height, var(--gift-layout-height));
    --gift-safe-top: max(8px, env(safe-area-inset-top));
    --gift-safe-bottom: max(8px, env(safe-area-inset-bottom));
    --gift-cap: min(
      calc(var(--gift-layout-height) * 0.86),
      720px,
      calc(var(--gift-viewport-height) - var(--gift-safe-top) - var(--gift-safe-bottom))
    );
    position: fixed;
    inset-block-start: calc(var(--gift-visible-top, 0px) + var(--gift-safe-top));
    inset-block-end: max(
      var(--gift-safe-bottom),
      calc(var(--gift-layout-height) - var(--gift-viewport-height) - var(--gift-visible-top, 0px) + var(--gift-safe-bottom))
    );
    width: min(460px, calc(100vw - max(12px, env(safe-area-inset-left)) - max(12px, env(safe-area-inset-right))));
  }
}

@media (max-width: 374px) {
  .Masthead-title {
    font-size: 26px;
  }

  .Masthead-sub {
    margin-top: 12px;
    font-size: 17px;
  }

  .LinkAction {
    font-size: 16px;
    padding: 6px 4px;
  }

  .SkyPoem {
    top: calc(126px + env(safe-area-inset-top));
    font-size: 23px;
  }
}

@media (max-height: 700px) {
  .TopBar {
    padding-top: calc(12px + env(safe-area-inset-top));
  }

  .Masthead-title {
    font-size: clamp(26px, 6.8vw, 34px);
  }

  .Masthead-sub {
    margin-top: 10px;
    font-size: 17px;
  }

  .SkyPoem {
    top: calc(114px + env(safe-area-inset-top));
    gap: 4px;
    font-size: clamp(22px, 5.8vw, 27px);
    line-height: 1.45;
  }

  .SkyBar {
    bottom: calc(16px + env(safe-area-inset-bottom));
  }

  .SkyMenu {
    max-height: 50svh;
    max-height: 50dvh;
  }
}

@media (max-width: 640px) and (max-height: 700px) {
  .BottomArea {
    padding-bottom: calc(14px + env(safe-area-inset-bottom));
    gap: 2px;
  }

  .WatercolorCta {
    height: 52px;
    min-height: 52px;
  }

  .Toast {
    bottom: calc(118px + env(safe-area-inset-bottom));
  }
}
