@import url("https://fonts.googleapis.com/css2?family=Noto+Sans+SC:wght@400;500;600;700;800&family=Noto+Serif+SC:wght@600;700&display=swap");

:root {
  --paper: #fffaf4;
  --ink: #2a2522;
  --muted: #766c64;
  --line: #eadfd5;
  --rose: #d45d5d;
  --rose-dark: #9f3f3f;
  --mint: #dcefe8;
  --sky: #dbe8f4;
  --gold: #f5d99d;
  --white: #ffffff;
  --pet-font-body: "Noto Sans SC", "Noto Sans CJK SC", "Source Han Sans SC", sans-serif;
  --pet-font-display: "Noto Serif SC", "Noto Serif CJK SC", "Source Han Serif SC", serif;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Microsoft YaHei", sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  color: var(--ink);
  background: var(--paper);
  letter-spacing: 0;
}

a {
  color: inherit;
}

.page {
  width: min(1120px, 100%);
  margin: 0 auto;
  padding: 18px;
}

.top-nav {
  display: flex;
  gap: 10px;
  align-items: center;
  justify-content: center;
  padding: 10px;
  margin: 0 0 18px;
  position: sticky;
  top: 0;
  z-index: 2;
  background: rgba(255, 250, 244, 0.92);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
}

.top-nav a,
.button,
.link-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  padding: 0 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--white);
  text-decoration: none;
  font-weight: 700;
  cursor: pointer;
}

.link-button {
  color: var(--ink);
  font: inherit;
}

.button.primary {
  color: #fff;
  background: var(--rose);
  border-color: var(--rose);
}

.button.danger {
  color: #fff;
  background: #8f342a;
  border-color: #8f342a;
}

.button.small {
  min-height: 34px;
  padding: 0 10px;
  font-size: 14px;
}

.button[disabled],
button[disabled] {
  cursor: not-allowed;
  opacity: 0.45;
}

.hero,
.memorial-hero {
  min-height: 72vh;
  display: grid;
  align-items: center;
  gap: 28px;
  padding: 28px 0;
}

.product-hero {
  grid-template-columns: minmax(0, 1.1fr) minmax(260px, 0.9fr);
}

.eyebrow {
  margin: 0 0 10px;
  color: var(--rose-dark);
  font-size: 13px;
  font-weight: 800;
}

h1 {
  margin: 0;
  font-size: clamp(36px, 8vw, 82px);
  line-height: 1.05;
}

.product-title {
  font-size: clamp(42px, 6vw, 70px);
}

h2 {
  margin: 0 0 10px;
  font-size: 22px;
}

.lead {
  margin: 18px 0 24px;
  color: var(--muted);
  font-size: 20px;
  line-height: 1.7;
}

.hero-img,
.pet-avatar {
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
  border-radius: 8px;
  box-shadow: 0 20px 50px rgba(73, 51, 38, 0.14);
  background: var(--white);
}

.product-photo {
  object-fit: contain;
  padding: 18px;
}

.feature-grid,
.soft-grid,
.detail-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.feature,
.soft-grid article,
.panel,
.form-panel,
.note-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.76);
  padding: 18px;
}

.inner-panel {
  margin: 0;
  background: #fff;
}

.feature p,
.soft-grid p,
.muted {
  color: var(--muted);
  line-height: 1.7;
}

.narrow {
  width: min(720px, 100%);
  margin: 44px auto;
}

form {
  margin: 0;
}

label {
  display: grid;
  gap: 8px;
  font-weight: 700;
}

input,
select,
textarea {
  width: 100%;
  min-height: 44px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  font: inherit;
}

textarea {
  resize: vertical;
}

.stacked,
.form-panel {
  display: grid;
  gap: 14px;
}

.upload-photo-guide {
  display: grid;
  grid-template-columns: minmax(0, 1.08fr) minmax(0, 0.92fr);
  gap: 14px;
  align-items: stretch;
  padding: 16px;
  border: 1px solid #ead9ce;
  border-radius: 8px;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.88), rgba(255, 248, 240, 0.96)),
    #fffaf5;
}

.upload-guide-good {
  display: grid;
  grid-template-columns: 116px minmax(0, 1fr);
  gap: 14px;
  align-items: center;
}

.upload-guide-figure {
  position: relative;
  margin: 0;
}

.upload-guide-figure img {
  display: block;
  width: 116px;
  height: 116px;
  object-fit: cover;
  border: 1px solid rgba(234, 217, 206, 0.92);
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 12px 30px rgba(83, 61, 45, 0.08);
}

.upload-guide-figure figcaption {
  position: absolute;
  left: 8px;
  bottom: 8px;
  min-height: 24px;
  display: inline-flex;
  align-items: center;
  padding: 0 9px;
  border: 1px solid rgba(234, 217, 206, 0.92);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.94);
  color: var(--rose-dark);
  font-size: 12px;
  font-weight: 800;
  line-height: 1;
}

.upload-guide-good strong {
  display: block;
  margin-bottom: 7px;
  color: var(--ink);
  font-size: 18px;
  line-height: 1.35;
}

.upload-guide-good p {
  margin: 0;
  color: var(--muted);
  line-height: 1.7;
}

.upload-guide-bad {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 9px;
}

.upload-guide-bad span {
  display: flex;
  min-height: 48px;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 7px 8px;
  border: 1px solid #efd6cf;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.86);
  color: #9b3428;
  font-size: 16px;
  font-weight: 800;
  line-height: 1.22;
  text-align: center;
}

.upload-guide-bad small {
  display: block;
  margin: 0 0 3px;
  color: #b66b5d;
  font-size: 11px;
  font-weight: 700;
}

.upload-avatar-field {
  gap: 6px;
}

.upload-avatar-field span {
  font-size: 20px;
  line-height: 1.35;
}

.upload-avatar-field small {
  color: var(--muted);
  font-size: 13px;
  font-weight: 500;
  line-height: 1.5;
}

.upload-avatar-field input[type="file"] {
  min-height: 52px;
  padding: 8px;
}

.upload-avatar-field input[type="file"]::file-selector-button {
  min-height: 36px;
  margin-right: 10px;
  padding: 0 14px;
  border: 1px solid rgba(159, 63, 63, 0.22);
  border-radius: 8px;
  background: #fff7f2;
  color: var(--rose-dark);
  font: inherit;
  font-weight: 800;
  cursor: pointer;
}

.upload-avatar-preview {
  display: grid;
  grid-template-columns: 96px minmax(0, 1fr);
  gap: 12px;
  align-items: center;
  margin-top: 8px;
  padding: 10px;
  border: 1px solid #ead5cc;
  border-radius: 8px;
  background: #fffaf7;
}

.upload-avatar-preview[hidden] {
  display: none;
}

.upload-avatar-preview img {
  display: block;
  width: 96px;
  aspect-ratio: 1;
  border: 1px solid #e8d7d0;
  border-radius: 8px;
  object-fit: cover;
  background: #fff;
}

.upload-avatar-preview strong,
.upload-avatar-preview span,
.upload-avatar-preview small {
  display: block;
}

.upload-avatar-preview strong {
  margin-bottom: 4px;
  font-size: 16px;
  line-height: 1.25;
}

.upload-avatar-preview span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
  line-height: 1.4;
  overflow-wrap: anywhere;
}

.upload-avatar-preview small {
  margin-top: 5px;
  color: #8f342a;
}

.review-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 14px 0;
}

.review-tabs a {
  min-height: 38px;
  display: inline-flex;
  align-items: center;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  text-decoration: none;
  font-weight: 800;
}

.review-tabs a.active {
  border-color: rgba(212, 93, 93, 0.35);
  background: #fff3ef;
  color: var(--rose-dark);
}

.gallery-review-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(156px, 1fr));
  gap: 10px;
}

.gallery-review-day {
  display: grid;
  gap: 10px;
  margin: 18px 0 24px;
}

.gallery-review-day-head {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 12px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--line);
}

.gallery-review-day-head h2 {
  margin: 0;
  font-size: 24px;
}

.gallery-review-day-head p {
  margin: 3px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.gallery-review-card {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  gap: 8px;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.gallery-review-image {
  display: block;
  overflow: hidden;
  border-radius: 8px;
  background: #fff8f2;
  aspect-ratio: 1;
}

.gallery-review-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.gallery-review-meta {
  display: grid;
  gap: 2px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.42;
}

.gallery-review-meta strong {
  color: var(--ink);
  font-size: 15px;
}

.gallery-review-meta em {
  color: #8f342a;
  font-style: normal;
  font-weight: 800;
}

.gallery-review-form,
.gallery-review-actions {
  display: grid;
  gap: 6px;
}

.gallery-review-form input {
  min-height: 34px;
  padding: 7px 9px;
  font-size: 13px;
}

.gallery-review-actions {
  grid-template-columns: repeat(auto-fit, minmax(92px, 1fr));
}

.gallery-review-actions .button {
  min-height: 38px;
  padding: 0 6px;
  font-size: 13px;
  line-height: 1.15;
  text-align: center;
}

.gallery-block-list {
  display: grid;
  gap: 10px;
}

.gallery-block-card {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  padding: 12px;
  border: 1px solid rgba(143, 52, 42, 0.22);
  border-radius: 8px;
  background: #fff;
}

.gallery-block-card > div {
  display: grid;
  gap: 3px;
  color: var(--muted);
  font-size: 13px;
}

.gallery-block-card strong {
  color: var(--ink);
  font-size: 18px;
}

.gallery-block-card em {
  color: #8f342a;
  font-style: normal;
  font-weight: 800;
}

.settings-image-preview {
  display: inline-flex;
  width: 132px;
  height: 132px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.settings-image-preview img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.check {
  grid-template-columns: 20px 1fr;
  align-items: start;
  font-weight: 500;
  line-height: 1.6;
}

.check input {
  width: 18px;
  min-height: 18px;
  margin-top: 4px;
}

.alert {
  padding: 12px 14px;
  border-radius: 8px;
  background: #fff0ed;
  border: 1px solid #f3c2b7;
  color: #9b3428;
}

.alert.ok {
  background: #eef8f2;
  border-color: #bfdfcc;
  color: #2f6b47;
}

.message {
  text-align: center;
}

.memorial-hero {
  min-height: 66vh;
  text-align: center;
  justify-items: center;
}

.memorial-hero .pet-avatar {
  width: min(420px, 88vw);
}

.info-band {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
  margin: 4px 0 18px;
}

.pill {
  min-height: 80px;
  display: grid;
  align-content: center;
  gap: 6px;
  padding: 12px;
  border-radius: 8px;
  background: var(--mint);
}

.pill span {
  color: var(--muted);
  font-size: 13px;
}

.memory-copy {
  margin: 18px 0;
  padding: 26px;
  border-radius: 8px;
  background: var(--sky);
  font-size: 22px;
  line-height: 1.8;
  text-align: center;
}

.gallery,
.asset-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin: 18px 0;
}

.gallery img,
.asset-grid img {
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
  border-radius: 8px;
  background: var(--white);
}

.note-card {
  margin: 18px 0;
  text-align: center;
  font-size: 20px;
  background: var(--gold);
}

.footer {
  padding: 36px 0;
  color: var(--muted);
  text-align: center;
  line-height: 1.8;
}

.memory-open {
  min-height: 96vh;
  display: grid;
  align-content: center;
  gap: 22px;
  padding: 34px 0 28px;
  border-bottom: 1px solid rgba(234, 223, 213, 0.72);
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.66), rgba(220, 239, 232, 0.28)),
    linear-gradient(0deg, rgba(255, 250, 244, 0), rgba(255, 255, 255, 0.5));
}

.touch-signal {
  display: inline-flex;
  justify-self: center;
  min-height: 34px;
  align-items: center;
  padding: 0 12px;
  border-radius: 999px;
  color: var(--rose-dark);
  background: #fff;
  border: 1px solid var(--line);
  font-size: 13px;
  font-weight: 800;
}

.memory-hero-grid {
  display: grid;
  grid-template-columns: minmax(280px, 0.88fr) minmax(0, 1.12fr);
  align-items: center;
  gap: 34px;
}

.memory-portrait {
  position: relative;
  display: grid;
  justify-items: center;
}

.memory-avatar {
  width: min(76vw, 460px);
  aspect-ratio: 1;
  object-fit: cover;
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 24px 70px rgba(73, 51, 38, 0.18);
}

.memory-chip {
  position: absolute;
  right: 8px;
  bottom: 8px;
  max-width: min(330px, 86%);
  padding: 10px 12px;
  border: 1px solid rgba(234, 223, 213, 0.9);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.92);
  color: var(--rose-dark);
  font-size: 14px;
  font-weight: 900;
  box-shadow: 0 12px 28px rgba(73, 51, 38, 0.12);
}

.memory-title {
  width: min(690px, 100%);
}

.memory-title p,
.section-kicker {
  margin: 0 0 8px;
  color: var(--rose-dark);
  font-size: 13px;
  font-weight: 800;
}

.memory-title h1 {
  margin: 0 0 12px;
}

.memory-title strong {
  display: block;
  color: var(--muted);
  font-size: 20px;
  line-height: 1.7;
}

.memory-title span {
  display: block;
  width: min(620px, 100%);
  margin-top: 20px;
  color: #4e5960;
  font-size: 17px;
  line-height: 1.8;
}

.memory-letter {
  margin: 10px auto 28px;
  width: min(840px, 100%);
  padding: 32px;
  border-radius: 8px;
  background: #e9f1f6;
  text-align: center;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.58);
}

.memory-letter span {
  display: block;
  margin-bottom: 10px;
  color: #526b7e;
  font-size: 13px;
  font-weight: 900;
}

.memory-letter p {
  margin: 0;
  font-size: 24px;
  line-height: 1.85;
  font-weight: 700;
}

.keepsake-story {
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(260px, 0.95fr);
  align-items: center;
  gap: 24px;
  margin: 28px 0;
  padding: 28px;
  border-radius: 8px;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.95), rgba(220, 239, 232, 0.42)),
    #fff;
  border: 1px solid var(--line);
}

.keepsake-copy h2 {
  margin: 0 0 12px;
  font-size: clamp(28px, 4vw, 48px);
  line-height: 1.12;
}

.keepsake-copy p:last-child {
  margin: 0;
  color: var(--muted);
  font-size: 18px;
  line-height: 1.8;
}

.keepsake-product {
  display: grid;
  place-items: center;
  gap: 10px;
}

.keepsake-product > img {
  width: min(430px, 100%);
  aspect-ratio: 1;
  object-fit: contain;
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 18px 44px rgba(73, 51, 38, 0.12);
}

.pendant-playground {
  --pet-preview-x: 0px;
  --pet-preview-y: 0px;
  --pet-preview-scale: 1;
  --pet-preview-rotate: 0deg;
  --cloud-preview-x: 0px;
  --cloud-preview-y: 42px;
  --cloud-preview-scale: 0.66;
  --cloud-preview-rotate: 0deg;
  --crop-frame-x: 0%;
  --crop-frame-y: -7%;
  --crop-frame-width: 72%;
  --crop-frame-height: 106%;
  position: relative;
  width: min(430px, 100%);
  aspect-ratio: 1;
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 18px 44px rgba(73, 51, 38, 0.12);
  overflow: hidden;
  touch-action: manipulation;
}

.pendant-base {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.preview-window {
  position: absolute;
  left: 50%;
  top: 55%;
  width: 43%;
  height: 47%;
  overflow: visible;
  transform: translate(-50%, -50%);
}

.pet-crop-frame {
  position: absolute;
  left: calc(50% + var(--crop-frame-x));
  top: calc(50% + var(--crop-frame-y));
  width: var(--crop-frame-width);
  height: var(--crop-frame-height);
  overflow: hidden;
  transform: translate(-50%, -50%);
  z-index: 1;
}

.preview-crop-admin .pet-crop-frame {
  outline: 2px dashed rgba(159, 63, 63, 0.78);
  outline-offset: -2px;
  background: rgba(255, 246, 239, 0.18);
}

.pendant-pet {
  position: absolute;
  left: 50%;
  top: 48%;
  width: 138%;
  height: 138%;
  max-width: none;
  aspect-ratio: 1;
  object-fit: contain;
  transform:
    translate(-50%, -50%)
    translate(var(--pet-preview-x), var(--pet-preview-y))
    scale(var(--pet-preview-scale))
    rotate(var(--pet-preview-rotate));
  transform-origin: center;
  filter: drop-shadow(0 4px 8px rgba(73, 51, 38, 0.16));
  user-select: none;
  pointer-events: none;
}

.pendant-decor {
  position: absolute;
  left: 50%;
  top: 71%;
  width: 182%;
  height: auto;
  max-width: none;
  transform:
    translate(-50%, -50%)
    translate(var(--cloud-preview-x), var(--cloud-preview-y))
    scale(var(--cloud-preview-scale))
    rotate(var(--cloud-preview-rotate));
  transform-origin: center;
  filter: drop-shadow(0 4px 7px rgba(73, 51, 38, 0.14));
  user-select: none;
  pointer-events: none;
  z-index: 2;
}

.decor-cat .pendant-decor {
  top: 69%;
  width: 170%;
}

.decor-settings-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
}

.decor-setting-card {
  display: grid;
  gap: 12px;
  min-width: 0;
}

.decor-setting-card .pendant-playground,
.decor-setting-card .preview-tools {
  width: 100%;
}

.base-admin-preview {
  display: flex;
  gap: 12px;
  align-items: center;
  min-width: 0;
}

.base-admin-preview img {
  width: 86px;
  height: 86px;
  object-fit: contain;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.crop-frame-tool-grid button {
  font-size: 13px;
  white-space: nowrap;
}

.decor-tool-title {
  margin: 4px 0 0;
  font-size: 15px;
  line-height: 1.2;
}

.worker-uv-panel {
  display: grid;
  gap: 12px;
  margin-top: 18px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
}

.worker-uv-editor {
  display: grid;
  grid-template-columns: minmax(260px, 430px) minmax(220px, 1fr);
  gap: 18px;
  align-items: start;
}

.worker-uv-playground {
  width: min(430px, 100%);
}

.worker-uv-editor .preview-tools {
  width: 100%;
}

.uv-preview-save-form {
  margin: 0;
}

.uv-preview-save-form .preview-reset {
  width: 100%;
}

.worker-thumb {
  width: 64px;
  height: 64px;
  object-fit: contain;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.status-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.inline-status-form {
  margin: 0;
}

.nook-editor-grid {
  display: grid;
  grid-template-columns: minmax(240px, 348px) minmax(220px, 1fr);
  gap: 18px;
  align-items: start;
}

.nook-editor-preview {
  width: min(348px, 100%);
  margin-top: 0;
}

.nook-number-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.nook-tool-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

[data-uv-export][disabled] {
  cursor: progress;
  opacity: 0.72;
}

.decor-number-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
}

.decor-number-grid label {
  display: grid;
  gap: 5px;
  margin: 0;
  font-size: 12px;
  color: var(--muted);
}

.decor-number-grid input {
  min-width: 0;
  padding: 9px 10px;
}

.preview-tools {
  width: min(430px, 100%);
  display: grid;
  gap: 8px;
}

.preview-layer-tabs {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 8px;
}

.preview-tool-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
}

.preview-layer-tabs button,
.preview-tool-grid button,
.nook-move-grid button,
.nook-scale-row button,
.preview-reset {
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  font: inherit;
  font-weight: 900;
  cursor: pointer;
}

.preview-layer-tabs button.active,
.preview-layer-tabs button[aria-pressed="true"] {
  border-color: rgba(159, 63, 63, 0.42);
  background: #fff6ef;
  color: #8f3d2b;
}

.preview-layer-tabs button:active,
.preview-tool-grid button:active,
.nook-move-grid button:active,
.nook-scale-row button:active,
.preview-reset:active {
  transform: translateY(1px);
}

.preview-reset {
  width: 100%;
}

.keepsake-product small {
  width: min(430px, 100%);
  color: var(--muted);
  font-size: 12px;
  line-height: 1.6;
  text-align: center;
}

.keepsake-points {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin: 18px 0 28px;
}

.keepsake-points .feature {
  background: rgba(255, 255, 255, 0.88);
}

.memory-facts {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
  margin: 18px 0;
}

.memory-facts article {
  min-height: 92px;
  display: grid;
  align-content: center;
  gap: 7px;
  padding: 14px;
  border-radius: 8px;
  background: #fff;
  border: 1px solid var(--line);
}

.memory-facts span {
  color: var(--muted);
  font-size: 13px;
}

.memory-facts strong {
  font-size: 17px;
}

.memory-gallery {
  margin: 24px 0;
  padding: 22px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.72);
}

.memory-gallery > div:last-child {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}

.memory-gallery a {
  display: block;
  color: inherit;
  text-decoration: none;
}

.memory-gallery img {
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 12px 26px rgba(73, 51, 38, 0.1);
  transition: transform 160ms ease, box-shadow 160ms ease;
}

.memory-gallery a:hover img {
  transform: translateY(-2px);
  box-shadow: 0 16px 32px rgba(73, 51, 38, 0.16);
}

.keepsake-band {
  margin: 18px 0;
  padding: 22px;
  border-radius: 8px;
  background: var(--mint);
}

.keepsake-band h2 {
  margin-bottom: 8px;
}

.keepsake-band p {
  margin: 0;
  color: var(--muted);
  line-height: 1.8;
}

.last-touch {
  min-height: 30vh;
  display: grid;
  place-items: center;
  gap: 18px;
  padding: 20px 0;
  text-align: center;
}

.last-touch p {
  margin: 0;
  width: min(760px, 100%);
  font-size: clamp(26px, 5vw, 48px);
  line-height: 1.2;
  font-weight: 900;
}

.cta-row {
  display: flex;
  justify-content: center;
  gap: 10px;
  flex-wrap: wrap;
}

.pet-nest {
  display: grid;
  justify-items: center;
  gap: 18px;
  margin: 28px 0;
  padding: 30px 22px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.92), rgba(245, 217, 157, 0.26)),
    #fff;
  text-align: center;
}

.nest-copy h2 {
  margin: 0;
  font-size: clamp(26px, 4vw, 42px);
  line-height: 1.15;
}

.nest-scene {
  position: relative;
  width: min(520px, 100%);
  min-height: 290px;
  display: grid;
  place-items: end center;
  padding: 34px 16px 18px;
}

.nest-house {
  position: relative;
  width: min(310px, 76vw);
  aspect-ratio: 1.18;
  display: grid;
  place-items: center;
  border: 1px solid #d8c7b6;
  border-radius: 8px 8px 76px 76px;
  background:
    linear-gradient(180deg, #fff7ed 0%, #f6ddc9 100%);
  box-shadow: 0 24px 46px rgba(73, 51, 38, 0.16);
}

.nest-house::before {
  content: "";
  position: absolute;
  top: -58px;
  width: 76%;
  height: 104px;
  border: 1px solid #d8c7b6;
  border-bottom: 0;
  border-radius: 8px 8px 0 0;
  background: linear-gradient(135deg, #c86f61, #f0bd82);
  transform: perspective(260px) rotateX(28deg);
  transform-origin: bottom;
}

.nest-house span {
  position: absolute;
  inset: 42% 14% 0;
  border-radius: 999px 999px 8px 8px;
  background: #3d3430;
}

.nest-house img {
  position: relative;
  z-index: 1;
  width: min(170px, 54%);
  aspect-ratio: 1;
  object-fit: cover;
  border: 6px solid #fff;
  border-radius: 999px;
  background: #fff;
  box-shadow: 0 14px 28px rgba(0, 0, 0, 0.18);
}

.nest-bubble {
  position: absolute;
  top: 8px;
  right: 0;
  width: min(260px, 72%);
  margin: 0;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  font-weight: 800;
  line-height: 1.55;
  box-shadow: 0 14px 32px rgba(73, 51, 38, 0.13);
}

.nest-bubble::after {
  content: "";
  position: absolute;
  right: 42px;
  bottom: -8px;
  width: 14px;
  height: 14px;
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  background: #fff;
  transform: rotate(45deg);
}

.nest-bubble.pop {
  animation: bubble-pop 220ms ease;
}

@keyframes bubble-pop {
  0% {
    transform: scale(0.96);
    opacity: 0.72;
  }
  100% {
    transform: scale(1);
    opacity: 1;
  }
}

.admin {
  display: grid;
  gap: 16px;
}

.section-head,
.action-row,
.inline-form {
  display: flex;
  gap: 10px;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
}

.inline-form input {
  flex: 1 1 220px;
}

.order-import-actions {
  display: grid;
  justify-items: start;
  gap: 10px;
  margin-top: 12px;
}

.order-import-actions + .order-import-actions {
  margin-top: 16px;
}

.bulk-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin: 8px 0 10px;
  flex-wrap: wrap;
}

.select-cell {
  width: 44px;
  text-align: center;
}

.select-cell input {
  width: 18px;
  height: 18px;
  accent-color: var(--rose);
}

.account-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.compact-form {
  justify-content: flex-start;
}

.compact-form input {
  flex: 0 1 220px;
}

.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

table {
  width: 100%;
  min-width: 860px;
  border-collapse: collapse;
}

th,
td {
  padding: 12px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  white-space: nowrap;
}

.status {
  display: inline-flex;
  padding: 5px 9px;
  border-radius: 8px;
  background: var(--mint);
  font-size: 13px;
  font-weight: 800;
}

.status.not_found,
.status.phone_mismatch,
.status.duplicate {
  background: #fff0ed;
  color: #9b3428;
}

.status.verified {
  background: #eef8f2;
  color: #2f6b47;
}

.status.ready {
  background: #eef8f2;
  color: #2f6b47;
}

.status.failed,
.status.needs_admin_approval,
.status.manual_required {
  background: #fff0ed;
  color: #9b3428;
}

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

.filter-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 36px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--muted);
  text-decoration: none;
  font-weight: 800;
}

.filter-chip.active {
  color: #fff;
  background: var(--rose);
  border-color: var(--rose);
}

.pagination,
.pagination > div {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.pagination {
  justify-content: space-between;
  margin: 10px 0 16px;
  color: var(--muted);
  font-weight: 700;
}

.pagination a,
.pagination-current,
.pagination .disabled,
.pagination-gap {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 34px;
  min-height: 34px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  text-decoration: none;
  color: var(--ink);
}

.pagination-current {
  color: #fff;
  background: var(--rose);
  border-color: var(--rose);
}

.pagination .disabled,
.pagination-gap {
  color: var(--muted);
  background: #faf6f1;
}

.pagination-summary {
  margin: 10px 0 16px;
  color: var(--muted);
  font-weight: 700;
}

.empty-cell {
  color: var(--muted);
  text-align: center;
}

.meta {
  display: grid;
  grid-template-columns: 110px 1fr;
  gap: 10px;
}

.meta dt {
  color: var(--muted);
}

.meta dd {
  margin: 0;
}

figure {
  margin: 0;
}

figcaption {
  margin-top: 6px;
  color: var(--muted);
  font-size: 12px;
  word-break: break-all;
}

.qr {
  width: 180px;
  height: 180px;
  object-fit: contain;
  margin-top: 12px;
  background: #fff;
  border-radius: 8px;
}

.owner-link-box {
  display: grid;
  gap: 8px;
  margin-top: 12px;
  padding: 12px;
  border: 1px solid rgba(222, 203, 187, 0.62);
  border-radius: 10px;
  background: rgba(255, 250, 244, 0.72);
}

.bubble-settings-grid {
  display: grid;
  gap: 14px;
  padding: 14px;
  border: 1px solid rgba(222, 203, 187, 0.72);
  border-radius: 10px;
  background: rgba(255, 250, 244, 0.56);
}

.bubble-settings-grid h3 {
  margin: 0 0 4px;
}

.bubble-settings-grid label {
  gap: 7px;
}

.bubble-settings-grid textarea {
  min-height: 132px;
  font-size: 14px;
  font-weight: 500;
  line-height: 1.6;
}

.bubble-settings-grid .muted {
  font-size: 13px;
  font-weight: 500;
}

.log {
  padding: 10px 0;
  margin: 0;
  border-bottom: 1px solid var(--line);
  color: var(--muted);
}

@media (max-width: 760px) {
  .page {
    padding: 12px;
  }

  .top-nav {
    overflow-x: auto;
    justify-content: flex-start;
  }

  .product-hero,
  .feature-grid,
  .soft-grid,
  .detail-grid,
  .decor-settings-grid,
  .upload-photo-guide,
  .worker-uv-editor,
  .nook-editor-grid,
  .info-band,
  .memory-facts,
  .memory-hero-grid,
  .keepsake-story,
  .keepsake-points {
    grid-template-columns: 1fr;
  }

  .hero,
  .memorial-hero {
    min-height: auto;
    padding: 20px 0 8px;
  }

  h1 {
    font-size: 42px;
  }

  .lead,
  .memory-copy,
  .note-card,
  .memory-letter p {
    font-size: 18px;
  }

  .gallery,
  .asset-grid,
  .memory-gallery > div:last-child {
    grid-template-columns: repeat(2, 1fr);
  }

  .upload-guide-good {
    grid-template-columns: 82px minmax(0, 1fr);
    gap: 12px;
  }

  .upload-photo-guide {
    gap: 12px;
    padding: 12px;
  }

  .upload-guide-figure img {
    width: 82px;
    height: 82px;
  }

  .upload-guide-figure figcaption {
    left: 6px;
    bottom: 6px;
    min-height: 22px;
    padding: 0 8px;
    font-size: 11px;
  }

  .upload-guide-good strong {
    margin-bottom: 4px;
    font-size: 16px;
  }

  .upload-guide-good p {
    font-size: 14px;
    line-height: 1.55;
  }

  .upload-guide-bad {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 7px;
  }

  .upload-guide-bad span {
    min-height: 52px;
    padding: 6px 4px;
    font-size: 14px;
  }

  .upload-guide-bad small {
    font-size: 10px;
  }

  .upload-avatar-field span {
    font-size: 18px;
  }

  .upload-avatar-preview {
    grid-template-columns: 82px minmax(0, 1fr);
    padding: 8px;
  }

  .upload-avatar-preview img {
    width: 82px;
  }

  .memory-open {
    min-height: auto;
    padding-top: 22px;
  }

  .memory-title {
    text-align: center;
  }

  .memory-chip {
    right: 50%;
    bottom: 8px;
    transform: translateX(50%);
  }

  .memory-title strong {
    font-size: 17px;
  }

  .memory-title span,
  .keepsake-copy p:last-child {
    font-size: 16px;
  }

  .memory-letter,
  .keepsake-story,
  .pet-nest {
    padding: 20px;
  }

  .nest-scene {
    min-height: 250px;
    padding-inline: 0;
  }

  .nest-bubble {
    right: 50%;
    width: min(260px, 92%);
    transform: translateX(50%);
  }

  .nest-bubble.pop {
    animation: mobile-bubble-pop 220ms ease;
  }

  .last-touch p {
    font-size: 24px;
  }

  .section-head,
  .action-row,
  .cta-row,
  .inline-form {
    align-items: stretch;
    flex-direction: column;
  }

  .button {
    width: 100%;
  }
}

@keyframes mobile-bubble-pop {
  0% {
    transform: translateX(50%) scale(0.96);
    opacity: 0.72;
  }
  100% {
    transform: translateX(50%) scale(1);
    opacity: 1;
  }
}

/* NFC pet memorial page */
.pet-memory-page {
  --pet-bg: #fff8f0;
  --pet-card: rgba(255, 255, 255, 0.88);
  --pet-ink: #2e2824;
  --pet-soft: #6f625b;
  --pet-line: rgba(222, 203, 187, 0.72);
  --pet-rose: #c95f64;
  --pet-rose-deep: #8e393d;
  --pet-mint: #e5f0e9;
  --pet-lavender: #efe9f5;
  max-width: 460px;
  margin: 0 auto;
  color: var(--pet-ink);
  padding-bottom: 2px;
}

.pet-memory-page::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  background:
    radial-gradient(circle at 22% 8%, rgba(245, 217, 157, 0.42), transparent 31%),
    radial-gradient(circle at 88% 24%, rgba(220, 239, 232, 0.62), transparent 32%),
    linear-gradient(180deg, #fff9f1 0%, #fffaf4 46%, #f8f1ea 100%);
}

.pet-memory-page .button {
  min-height: 48px;
  padding: 0 18px;
  border-radius: 8px;
  border-color: rgba(182, 74, 78, 0.2);
  box-shadow: 0 12px 26px rgba(142, 57, 61, 0.14);
}

.pet-hero {
  position: relative;
  min-height: min(700px, calc(100svh - 24px));
  display: grid;
  align-content: center;
  justify-items: center;
  gap: 14px;
  padding: 18px 0 24px;
  text-align: center;
  overflow: hidden;
}

.pet-hero-glow {
  position: absolute;
  left: 50%;
  top: 46%;
  width: 300px;
  height: 300px;
  border-radius: 999px;
  background: rgba(229, 240, 233, 0.76);
  filter: blur(36px);
  transform: translate(-50%, -50%);
  z-index: -1;
}

.pet-nfc-badge {
  min-height: 32px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin: 0;
  padding: 0 13px;
  border: 1px solid var(--pet-line);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.82);
  color: var(--pet-rose-deep);
  font-size: 12px;
  font-weight: 900;
  box-shadow: 0 10px 28px rgba(118, 91, 68, 0.08);
}

.pet-hero-photo {
  position: relative;
  width: min(232px, 66vw);
  margin: 0;
}

.pet-hero-photo img {
  display: block;
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
  border: 7px solid rgba(255, 255, 255, 0.82);
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 24px 58px rgba(83, 61, 45, 0.16);
}

.pet-hero-photo figcaption {
  position: absolute;
  left: 50%;
  bottom: -14px;
  width: max-content;
  max-width: 86%;
  padding: 8px 12px;
  border: 1px solid rgba(222, 203, 187, 0.86);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.96);
  color: var(--pet-rose-deep);
  font-size: 12px;
  font-weight: 900;
  line-height: 1.35;
  transform: translateX(-50%);
  box-shadow: 0 12px 26px rgba(83, 61, 45, 0.12);
}

.pet-hero-copy {
  width: min(100%, 390px);
  display: grid;
  gap: 8px;
  padding-top: 10px;
}

.pet-hero-copy p {
  margin: 0;
  color: var(--pet-rose-deep);
  font-size: 13px;
  font-weight: 900;
}

.pet-hero-copy h1 {
  margin: 0;
  font-size: clamp(38px, 12vw, 52px);
  line-height: 0.98;
}

.pet-hero-copy strong {
  display: block;
  color: #4a403b;
  font-size: 17px;
  line-height: 1.58;
}

.pet-section {
  margin: 14px 0;
  border: 1px solid var(--pet-line);
  border-radius: 8px;
  background: var(--pet-card);
  box-shadow: 0 14px 34px rgba(83, 61, 45, 0.08);
  backdrop-filter: blur(10px);
}

.pet-section-copy,
.pet-section-heading {
  display: grid;
  gap: 10px;
}

.pet-section-kicker {
  margin: 0;
  color: var(--pet-rose-deep);
  font-size: 13px;
  font-weight: 900;
}

.pet-section h2 {
  margin: 0;
  font-size: 25px;
  line-height: 1.18;
}

.pet-section p {
  color: var(--pet-soft);
  line-height: 1.78;
}

.pet-memory-card {
  display: grid;
  gap: 16px;
  padding: 18px 16px;
}

.pet-memory-card .pet-section-copy p:last-child {
  margin: 0;
  font-size: 16px;
}

.pet-preview-card {
  display: grid;
  justify-items: center;
  gap: 12px;
}

.pet-preview-card small {
  color: var(--pet-soft);
  font-size: 12px;
  line-height: 1.55;
  text-align: center;
}

.pet-pendant-preview {
  width: min(100%, 318px);
}

.pet-preview-adjust {
  width: min(100%, 318px);
}

.pet-preview-adjust summary,
.nook-adjust-trigger {
  min-height: 44px;
  display: grid;
  place-items: center;
  width: 100%;
  padding: 0 12px;
  border: 1px solid var(--pet-line);
  border-radius: 8px;
  background: #fff;
  color: var(--pet-rose-deep);
  font: inherit;
  font-weight: 900;
  cursor: pointer;
}

.pet-preview-adjust[open] summary,
.nook-adjust.is-open .nook-adjust-trigger {
  margin-bottom: 10px;
}

.pet-preview-adjust .preview-tools,
.pet-preview-adjust .preview-layer-tabs,
.pet-preview-adjust .preview-tool-grid,
.nook-adjust .preview-tools,
.nook-adjust .nook-move-grid,
.nook-adjust .nook-scale-row {
  width: 100%;
}

.nook-adjust .nook-move-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.nook-adjust .nook-scale-row {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.pet-preview-adjust .preview-layer-tabs button,
.pet-preview-adjust .preview-tool-grid button,
.pet-preview-adjust .preview-reset,
.nook-adjust .nook-move-grid button,
.nook-adjust .nook-scale-row button,
.nook-adjust .preview-reset {
  min-height: 44px;
}

.owner-message {
  padding: 22px 18px;
  background:
    linear-gradient(135deg, rgba(239, 233, 245, 0.72), rgba(229, 240, 233, 0.66)),
    #fff;
  text-align: center;
}

.owner-message p {
  margin: 0 0 10px;
  color: #6c6073;
  font-size: 13px;
  font-weight: 900;
}

.owner-message blockquote {
  margin: 0;
  color: var(--pet-ink);
  font-size: 21px;
  font-weight: 900;
  line-height: 1.58;
}

.photo-gallery {
  padding: 18px 16px;
}

.photo-gallery h2 {
  font-size: 24px;
}

.photo-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-top: 14px;
}

.photo-grid a {
  display: block;
  color: inherit;
  text-decoration: none;
}

.photo-grid img {
  display: block;
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 12px 26px rgba(83, 61, 45, 0.1);
}

.blessing-message {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 9px;
  padding: 0;
  border: 0;
  background: transparent;
  box-shadow: none;
  backdrop-filter: none;
}

.blessing-message article {
  min-height: 88px;
  display: grid;
  align-content: center;
  gap: 6px;
  padding: 13px;
  border: 1px solid var(--pet-line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.78);
}

.blessing-message span {
  color: var(--pet-soft);
  font-size: 13px;
}

.blessing-message strong {
  color: var(--pet-ink);
  font-size: 17px;
  line-height: 1.35;
}

.pet-memory-page .pet-nest {
  position: relative;
  overflow: hidden;
  padding: 22px 12px 18px;
  background: rgba(255, 255, 255, 0.9);
}

.pet-memory-page .pet-nest::before {
  content: none;
}

.pet-memory-page .nest-copy {
  position: relative;
  z-index: 1;
}

.pet-memory-page .nest-copy h2 {
  width: min(320px, 100%);
  margin-inline: auto;
  font-size: 24px;
}

.nook-scene {
  --nook-pet-x: 0px;
  --nook-pet-y: 0px;
  --nook-pet-scale: 1;
  --nook-mask-x: 0px;
  --nook-mask-y: 0px;
  --nook-mask-scale: 1;
  --nook-mask-opacity: 1;
  position: relative;
  width: min(100%, 348px);
  aspect-ratio: 3 / 4;
  margin-top: 2px;
  overflow: hidden;
  border: 1px solid rgba(222, 203, 187, 0.86);
  border-radius: 8px;
  background: #fffaf4;
  box-shadow: 0 22px 48px rgba(83, 61, 45, 0.14);
  isolation: isolate;
}

.nook-scene::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 3;
  background:
    radial-gradient(circle at 50% 47%, rgba(255, 255, 255, 0.58), transparent 24%),
    radial-gradient(circle at 54% 57%, rgba(245, 217, 157, 0.28), transparent 28%);
  opacity: 0;
  pointer-events: none;
}

.nook-scene.petting::after {
  animation: nook-warm-touch 620ms ease;
}

.nook-bg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  pointer-events: none;
  user-select: none;
}

.nook-bg {
  z-index: 0;
}

.nook-blanket-front {
  position: absolute;
  left: 50%;
  bottom: 0;
  z-index: 2;
  width: 100%;
  height: 54%;
  object-fit: cover;
  object-position: bottom center;
  opacity: var(--nook-mask-opacity);
  transform:
    translateX(-50%)
    translate(var(--nook-mask-x), var(--nook-mask-y))
    scale(var(--nook-mask-scale));
  transform-origin: center bottom;
  pointer-events: none;
  user-select: none;
}

.nook-pet-shell {
  position: absolute;
  left: 50%;
  top: 49%;
  z-index: 1;
  width: 72%;
  height: 52%;
  display: grid;
  place-items: center;
  transform:
    translate(-50%, -50%)
    translate(var(--nook-pet-x), var(--nook-pet-y))
    scale(var(--nook-pet-scale));
  transform-origin: center bottom;
}

.nook-pet {
  width: 100%;
  height: 100%;
  object-fit: contain;
  object-position: center bottom;
  filter: drop-shadow(0 14px 18px rgba(83, 61, 45, 0.18));
  pointer-events: none;
  user-select: none;
}

.nook-scene.petting .nook-pet-shell {
  animation: nook-pet-touch 520ms ease;
}

.nook-blanket-front {
  z-index: 2;
}

.pet-memory-page .nest-scene {
  position: relative;
  min-height: 274px;
  display: grid;
  place-items: center;
  padding: 18px 0 8px;
}

.nest-keepsake {
  position: relative;
  width: min(248px, 76vw);
  aspect-ratio: 0.9;
  display: grid;
  place-items: center;
  border: 1px solid rgba(216, 199, 182, 0.86);
  border-radius: 8px 8px 96px 96px;
  background:
    linear-gradient(180deg, rgba(255, 250, 244, 0.94), rgba(244, 223, 204, 0.92));
  box-shadow: 0 26px 54px rgba(83, 61, 45, 0.14);
}

.nest-keepsake::before {
  content: "";
  position: absolute;
  top: -30px;
  width: 62%;
  height: 58px;
  border: 1px solid rgba(199, 125, 99, 0.42);
  border-bottom: 0;
  border-radius: 8px 8px 0 0;
  background: linear-gradient(135deg, #c97665, #e9b67e);
}

.nest-keepsake::after {
  content: "";
  position: absolute;
  left: 16%;
  right: 16%;
  bottom: 22px;
  height: 40%;
  border-radius: 999px 999px 8px 8px;
  background: linear-gradient(180deg, #4a3d38, #342b28);
}

.nest-photo-frame {
  position: relative;
  z-index: 2;
  width: min(138px, 46vw);
  aspect-ratio: 1;
  display: grid;
  place-items: center;
  border: 7px solid #fff;
  border-radius: 999px;
  background: #fff;
  box-shadow: 0 16px 30px rgba(83, 61, 45, 0.18);
}

.nest-photo-frame img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: inherit;
}

.nest-ribbon {
  position: absolute;
  z-index: 3;
  left: 50%;
  bottom: 34px;
  min-width: 96px;
  max-width: 150px;
  padding: 8px 13px;
  border: 1px solid rgba(222, 203, 187, 0.86);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.94);
  color: var(--pet-rose-deep);
  font-size: 14px;
  font-weight: 900;
  line-height: 1.15;
  text-align: center;
  transform: translateX(-50%);
}

.pet-memory-page .nest-bubble {
  position: absolute;
  left: 50%;
  top: 18px;
  z-index: 4;
  width: min(260px, 78%);
  margin: 0;
  padding: 11px 14px;
  border: 1px solid rgba(222, 203, 187, 0.74);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.95);
  color: var(--pet-ink);
  font-size: 14px;
  font-weight: 800;
  line-height: 1.5;
  box-shadow: 0 14px 28px rgba(83, 61, 45, 0.1);
  backdrop-filter: blur(8px);
  transform: translateX(-50%);
}

.pet-memory-page .nest-bubble::after {
  content: "";
  position: absolute;
  right: 44px;
  bottom: -8px;
  width: 14px;
  height: 14px;
  border-right: 1px solid rgba(222, 203, 187, 0.74);
  border-bottom: 1px solid rgba(222, 203, 187, 0.74);
  background: rgba(255, 255, 255, 0.95);
  transform: rotate(45deg);
}

.pet-memory-page .nest-bubble.pop {
  animation: pet-bubble-pop 220ms ease;
}

.pet-memory-page [data-pet-bubble-button] {
  position: relative;
  z-index: 1;
  width: min(292px, 100%);
  font-weight: 900;
}

.nook-adjust {
  position: relative;
  z-index: 1;
  width: min(292px, 100%);
}

.nook-adjust [hidden] {
  display: none;
}

body.pet-sheet-open {
  overflow: hidden;
}

.pet-memory-page.pet-nook-mode {
  width: calc(100% + 36px);
  max-width: none;
  min-height: 100svh;
  min-height: 100dvh;
  margin: -18px;
  padding: 0;
  overflow: hidden;
  background: #f8f1ea;
}

.pet-memory-page.pet-nook-mode::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  background:
    linear-gradient(180deg, rgba(255, 250, 244, 0.96) 0%, rgba(244, 234, 225, 0.98) 58%, #ead9ca 100%);
}

.pet-nook-app {
  position: relative;
  min-height: 100svh;
  min-height: 100dvh;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  gap: 10px;
  width: min(100%, 480px);
  margin: 0 auto;
  padding:
    calc(14px + env(safe-area-inset-top))
    max(12px, env(safe-area-inset-right))
    calc(14px + env(safe-area-inset-bottom))
    max(12px, env(safe-area-inset-left));
  color: var(--pet-ink);
  overflow: hidden;
}

.pet-nook-topbar {
  position: relative;
  z-index: 4;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.pet-nook-topbar p,
.pet-sheet-head p,
.pet-sheet-section p {
  margin: 0;
}

.pet-nook-topbar p {
  color: var(--pet-rose-deep);
  font-size: 13px;
  font-weight: 900;
}

.pet-nook-topbar h1 {
  margin: 4px 0 0;
  color: #332a24;
  font-size: 25px;
  font-weight: 720;
  line-height: 1.16;
}

.pet-icon-button {
  min-width: 52px;
  min-height: 38px;
  display: inline-grid;
  place-items: center;
  padding: 0 12px;
  border: 1px solid rgba(222, 203, 187, 0.9);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.84);
  color: var(--pet-rose-deep);
  font: inherit;
  font-size: 13px;
  font-weight: 800;
  box-shadow: 0 10px 22px rgba(83, 61, 45, 0.08);
}

.pet-sheet-head .pet-icon-button {
  min-width: 36px;
  min-height: 36px;
  padding: 0;
  border-color: rgba(222, 203, 187, 0.58);
  color: #8c6f61;
  font-size: 20px;
  line-height: 1;
  box-shadow: none;
}

.pet-nook-stage {
  min-height: 0;
  display: grid;
  place-items: center;
}

.pet-nook-app .nook-scene {
  width: min(100%, calc((100svh - 178px - env(safe-area-inset-top) - env(safe-area-inset-bottom)) * 0.75), 438px);
  width: min(100%, calc((100dvh - 178px - env(safe-area-inset-top) - env(safe-area-inset-bottom)) * 0.75), 438px);
  max-height: calc(100svh - 178px - env(safe-area-inset-top) - env(safe-area-inset-bottom));
  max-height: calc(100dvh - 178px - env(safe-area-inset-top) - env(safe-area-inset-bottom));
  margin: 0;
  border-color: rgba(222, 203, 187, 0.72);
  background: #fff8f0;
  box-shadow: 0 26px 54px rgba(83, 61, 45, 0.18);
}

.pet-nook-app .nook-scene::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 2;
  background: linear-gradient(to bottom, transparent 64%, rgba(255, 248, 238, 0.35) 100%);
  pointer-events: none;
}

.pet-nook-app .nook-pet-shell {
  width: 67%;
  height: 49%;
}

.pet-nook-app .nest-bubble {
  top: 15px;
  width: min(264px, 78%);
  font-size: 14px;
}

.pet-nook-dock {
  position: static;
  z-index: 4;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  justify-items: center;
  gap: 7px;
  align-items: start;
}

.pet-nook-dock .button {
  min-height: 48px;
  padding: 0 18px;
  border-radius: 12px;
  font-size: 15px;
  font-weight: 900;
  transition: transform 160ms ease, box-shadow 160ms ease, filter 160ms ease;
  box-shadow: 0 12px 26px rgba(83, 61, 45, 0.12);
}

.pet-nook-dock [data-pet-bubble-button] {
  width: min(262px, 90%);
}

.pet-nook-dock [data-pet-bubble-button]:active {
  transform: scale(0.985);
  filter: brightness(1.03);
  box-shadow:
    0 0 0 4px rgba(245, 217, 157, 0.18),
    0 10px 22px rgba(142, 57, 61, 0.16);
}

.pet-nook-dock .nook-adjust {
  position: static;
  justify-self: center;
  width: min(210px, 100%);
}

.pet-nook-dock .nook-adjust-trigger {
  min-height: 30px;
  padding: 0 8px;
  border-color: transparent;
  color: #8a7569;
  background: transparent;
  font-size: 14px;
  font-weight: 700;
  box-shadow: none;
}

.pet-nook-dock .nook-adjust-trigger:active {
  color: #6f5b51;
  background: rgba(255, 250, 244, 0.48);
}

.pet-nook-dock .nook-adjust.is-open .nook-adjust-trigger {
  margin-bottom: 7px;
  color: #6f5b51;
}

.pet-nook-dock .nook-adjust .preview-tools {
  position: absolute;
  left: 50%;
  right: auto;
  width: min(calc(100% - 24px), 438px);
  bottom: calc(84px + env(safe-area-inset-bottom));
  z-index: 5;
  display: grid;
  gap: 7px;
  padding: 10px 12px;
  border: 1px solid rgba(222, 203, 187, 0.92);
  border-radius: 8px;
  background:
    linear-gradient(180deg, rgba(255, 252, 248, 0.93), rgba(255, 248, 240, 0.9)),
    rgba(255, 250, 244, 0.92);
  box-shadow: 0 18px 44px rgba(83, 61, 45, 0.2);
  backdrop-filter: blur(12px);
  transform: translateX(-50%);
}

.pet-nook-dock .nook-adjust .preview-tools[hidden] {
  display: none;
}

.nook-adjust-hint {
  margin: 0;
  color: #7f6f65;
  font-size: 12px;
  font-weight: 750;
  line-height: 1.45;
  text-align: center;
}

.pet-nook-dock .nook-move-grid {
  grid-template-columns: minmax(0, 1fr) minmax(80px, 0.8fr) minmax(0, 1fr);
  gap: 5px;
}

.pet-nook-dock .nook-scale-row {
  gap: 5px;
}

.pet-nook-dock .nook-move-grid button,
.pet-nook-dock .nook-scale-row button,
.pet-nook-dock .preview-reset {
  min-height: 34px;
  border-color: rgba(222, 203, 187, 0.92);
  background: rgba(255, 255, 255, 0.82);
  color: #2e2824;
  font-size: 16px;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.76);
}

.pet-nook-dock .nook-scale-row button {
  color: #5f514a;
  font-size: 14px;
  font-weight: 850;
}

.pet-nook-dock .preview-reset {
  min-height: 38px;
  color: #756256;
  font-size: 14px;
  font-weight: 850;
}

.pet-sheet-overlay {
  position: fixed;
  inset: 0;
  z-index: 20;
  background: rgba(46, 40, 36, 0.22);
  opacity: 0;
  transition: opacity 180ms ease;
}

.pet-sheet-overlay.is-open {
  opacity: 1;
}

.pet-sheet-overlay[hidden],
.pet-info-sheet[hidden] {
  display: none;
}

.pet-info-sheet {
  position: fixed;
  left: 50%;
  right: auto;
  bottom: 0;
  z-index: 21;
  width: min(100%, 480px);
  max-height: min(84svh, 780px);
  max-height: min(84dvh, 780px);
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr);
  padding:
    8px
    max(14px, env(safe-area-inset-right))
    calc(16px + env(safe-area-inset-bottom))
    max(14px, env(safe-area-inset-left));
  border: 1px solid rgba(222, 203, 187, 0.62);
  border-bottom: 0;
  border-radius: 18px 18px 0 0;
  background:
    linear-gradient(180deg, rgba(255, 252, 248, 0.98), rgba(255, 248, 240, 0.97)),
    #fffaf4;
  box-shadow: 0 -22px 48px rgba(83, 61, 45, 0.18);
  transform: translateX(-50%) translateY(102%);
  transition: transform 220ms ease;
}

.pet-info-sheet.is-open {
  transform: translateX(-50%) translateY(0);
}

.pet-sheet-handle {
  justify-self: center;
  width: 38px;
  height: 3px;
  margin: 2px 0 12px;
  border-radius: 999px;
  background: rgba(118, 108, 100, 0.2);
}

.pet-sheet-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 2px 0 14px;
  border-bottom: 1px solid rgba(222, 203, 187, 0.42);
}

.pet-sheet-head p {
  color: var(--pet-rose-deep);
  font-size: 13px;
  font-weight: 900;
}

.pet-sheet-head h2 {
  margin: 2px 0 0;
  color: #332a24;
  font-size: 19px;
  font-weight: 610;
  line-height: 1.26;
}

.pet-sheet-body {
  min-height: 0;
  overflow: auto;
  scrollbar-width: thin;
  scrollbar-color: rgba(140, 111, 97, 0.28) transparent;
  overscroll-behavior: contain;
  padding: 14px 0 2px;
}

.pet-sheet-body::-webkit-scrollbar {
  width: 5px;
}

.pet-sheet-body::-webkit-scrollbar-thumb {
  border-radius: 999px;
  background: rgba(140, 111, 97, 0.22);
}

.pet-sheet-body::-webkit-scrollbar-track {
  background: transparent;
}

.pet-sheet-section {
  display: grid;
  gap: 14px;
  padding: 18px 0;
  border-bottom: 1px solid rgba(222, 203, 187, 0.38);
}

.pet-sheet-section:last-child {
  border-bottom: 0;
}

.pet-profile-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.pet-profile-grid article {
  min-height: 82px;
  display: grid;
  align-content: center;
  gap: 5px;
  padding: 12px;
  border: 1px solid rgba(222, 203, 187, 0.48);
  border-radius: 8px;
  background: rgba(255, 252, 248, 0.72);
}

.pet-profile-grid .pet-status-fact {
  grid-column: 1 / -1;
  min-height: 74px;
  background:
    linear-gradient(135deg, rgba(255, 248, 238, 0.86), rgba(255, 252, 248, 0.78)),
    #fffaf4;
}

.pet-profile-grid span {
  color: var(--pet-soft);
  font-size: 12px;
}

.pet-profile-grid strong {
  color: var(--pet-ink);
  font-size: 16px;
  line-height: 1.35;
}

.pet-memory-note {
  padding: 15px 16px;
  border: 1px solid rgba(222, 203, 187, 0.42);
  border-radius: 12px;
  background:
    radial-gradient(circle at 12% 0%, rgba(245, 217, 157, 0.22), transparent 34%),
    rgba(255, 250, 244, 0.82);
}

.pet-sheet-section blockquote {
  margin: 0;
  color: var(--pet-ink);
  font-size: 15px;
  font-weight: 520;
  line-height: 1.92;
}

.pet-sheet-pendant {
  grid-template-columns: minmax(0, 1fr) 136px;
  align-items: center;
  gap: 14px;
  padding: 16px;
  border: 1px solid rgba(222, 203, 187, 0.42);
  border-radius: 14px;
  background:
    linear-gradient(135deg, rgba(255, 252, 248, 0.9), rgba(255, 246, 236, 0.78)),
    #fffaf4;
}

.pet-sheet-pendant h3 {
  margin: 2px 0 0;
  font-size: 19px;
  line-height: 1.22;
}

.pet-sheet-pendant p:last-child,
.pet-sheet-adjust p:last-child {
  color: var(--pet-soft);
  line-height: 1.65;
}

.pet-sheet-pendant .pet-pendant-preview {
  width: 136px;
}

.pet-sheet-adjust .nook-adjust {
  width: 100%;
}

body.pet-gallery-open {
  overflow: hidden;
}

.pet-gallery-entry {
  width: 100%;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 116px 18px;
  align-items: center;
  gap: 12px;
  padding: 14px;
  border: 1px solid rgba(222, 203, 187, 0.48);
  border-radius: 14px;
  color: inherit;
  text-align: left;
  background:
    radial-gradient(circle at 12% 0%, rgba(245, 217, 157, 0.22), transparent 36%),
    linear-gradient(135deg, rgba(255, 252, 248, 0.92), rgba(255, 246, 236, 0.82));
  box-shadow: 0 12px 26px rgba(100, 75, 56, 0.08);
  cursor: pointer;
}

.pet-gallery-entry-copy {
  min-width: 0;
  display: grid;
  gap: 5px;
}

.pet-gallery-entry-copy strong {
  color: var(--pet-ink);
  font-size: 16px;
  line-height: 1.42;
}

.pet-gallery-entry-copy em {
  color: var(--pet-soft);
  font-size: 13px;
  font-style: normal;
}

.pet-gallery-peek {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 4px;
}

.pet-gallery-peek img,
.pet-gallery-peek span {
  width: 100%;
  aspect-ratio: 1;
  border-radius: 7px;
  object-fit: cover;
  background:
    linear-gradient(135deg, rgba(255, 247, 235, 0.92), rgba(235, 216, 199, 0.45)),
    #fffaf4;
}

.pet-gallery-entry-arrow {
  color: rgba(103, 73, 58, 0.52);
  font-size: 28px;
  line-height: 1;
}

.pet-gallery-modal {
  position: fixed;
  inset: 0;
  z-index: 40;
  opacity: 0;
  transition: opacity 180ms ease;
}

.pet-gallery-modal.is-open {
  opacity: 1;
}

.pet-gallery-modal[hidden] {
  display: none;
}

.pet-gallery-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(42, 33, 28, 0.36);
}

.pet-gallery-panel {
  position: absolute;
  left: 50%;
  bottom: 0;
  width: min(100%, 520px);
  height: min(92svh, 820px);
  height: min(92dvh, 820px);
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  padding:
    16px
    max(14px, env(safe-area-inset-right))
    calc(16px + env(safe-area-inset-bottom))
    max(14px, env(safe-area-inset-left));
  border: 1px solid rgba(222, 203, 187, 0.58);
  border-bottom: 0;
  border-radius: 20px 20px 0 0;
  background:
    linear-gradient(180deg, rgba(255, 252, 248, 0.99), rgba(255, 247, 238, 0.99)),
    #fffaf4;
  box-shadow: 0 -24px 52px rgba(72, 52, 39, 0.22);
  transform: translateX(-50%) translateY(16px);
  transition: transform 180ms ease;
}

.pet-gallery-modal.is-open .pet-gallery-panel {
  transform: translateX(-50%) translateY(0);
}

.pet-gallery-head,
.pet-gallery-viewer-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.pet-gallery-head {
  padding-bottom: 12px;
  border-bottom: 1px solid rgba(222, 203, 187, 0.4);
}

.pet-gallery-head p {
  color: var(--pet-rose-deep);
  font-size: 13px;
  font-weight: 850;
}

.pet-gallery-head h2 {
  margin: 2px 0 0;
  color: var(--pet-ink);
  font-size: 22px;
  font-weight: 700;
}

.pet-gallery-body {
  min-height: 0;
  overflow: auto;
  display: grid;
  align-content: start;
  gap: 14px;
  padding-top: 14px;
  scrollbar-width: none;
}

.pet-gallery-body::-webkit-scrollbar {
  width: 0;
  height: 0;
}

.pet-gallery-upload-card {
  display: grid;
  gap: 12px;
  padding: 14px;
  border: 1px solid rgba(222, 203, 187, 0.42);
  border-radius: 14px;
  background: rgba(255, 250, 244, 0.82);
}

.pet-gallery-upload-card strong,
.pet-gallery-empty strong {
  color: var(--pet-ink);
  font-size: 16px;
  line-height: 1.4;
}

.pet-gallery-upload-card span,
.pet-gallery-empty p {
  color: var(--pet-soft);
  font-size: 13px;
  line-height: 1.55;
}

.pet-gallery-upload-card small {
  display: block;
  margin-top: 4px;
  color: rgba(122, 103, 92, 0.72);
  font-size: 12px;
  line-height: 1.5;
}

.pet-gallery-blocked {
  margin: 0;
  padding: 10px 12px;
  border: 1px solid rgba(143, 52, 42, 0.22);
  border-radius: 8px;
  background: rgba(255, 243, 239, 0.9);
  color: #8f342a;
  font-size: 13px;
  font-weight: 800;
  line-height: 1.55;
}

.pet-gallery-upload-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 8px;
}

.pet-gallery-upload-form input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.pet-gallery-upload-form .button {
  min-height: 42px;
}

.pet-gallery-upload-form.has-selection label[for] {
  display: none;
}

.pet-gallery-manage-row {
  display: flex;
  justify-content: flex-end;
}

.pet-gallery-manage-button {
  min-height: 32px;
  padding: 0 12px;
  border: 1px solid rgba(222, 203, 187, 0.72);
  border-radius: 999px;
  color: #7f6f65;
  background: rgba(255, 250, 244, 0.72);
  font-size: 13px;
  font-weight: 800;
}

.pet-gallery-modal.is-managing .pet-gallery-manage-button {
  color: #6f5b51;
  background: rgba(255, 246, 236, 0.96);
}

.pet-gallery-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.pet-gallery-tile {
  position: relative;
  overflow: hidden;
  border-radius: 16px;
  background: #fffaf4;
}

.pet-gallery-tile > button {
  display: block;
  width: 100%;
  padding: 0;
  border: 0;
  background: transparent;
  cursor: pointer;
}

.pet-gallery-tile img {
  display: block;
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
}

.pet-gallery-tile.is-broken::after,
.pet-gallery-viewer-stage.is-broken::after {
  content: "这张照片暂时没有加载出来";
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 14px;
  color: #8a7569;
  background:
    linear-gradient(135deg, rgba(255, 247, 235, 0.95), rgba(235, 216, 199, 0.55)),
    #fffaf4;
  font-size: 13px;
  line-height: 1.5;
  text-align: center;
}

.pet-gallery-viewer-stage.is-broken::after {
  inset: auto;
  width: min(82%, 300px);
  min-height: 120px;
  border-radius: 16px;
}

.pet-gallery-tile form {
  position: absolute;
  right: 6px;
  bottom: 6px;
  display: none;
}

.pet-gallery-modal.is-managing .pet-gallery-tile form {
  display: block;
}

.pet-gallery-tile form button {
  min-height: 30px;
  padding: 0 10px;
  border: 1px solid rgba(255, 255, 255, 0.58);
  border-radius: 999px;
  color: #fff;
  background: rgba(73, 50, 40, 0.56);
  font-size: 12px;
  font-weight: 800;
}

.pet-gallery-empty {
  display: grid;
  gap: 5px;
  padding: 22px 16px;
  border: 1px dashed rgba(195, 166, 145, 0.55);
  border-radius: 14px;
  text-align: center;
  background: rgba(255, 250, 244, 0.58);
}

.pet-owner-access {
  display: grid;
  gap: 10px;
}

.pet-owner-unlocked,
.pet-owner-unlock-form {
  display: grid;
  gap: 10px;
  padding: 12px;
  border: 1px solid rgba(222, 203, 187, 0.72);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.74);
}

.pet-owner-unlocked strong {
  color: var(--pet-rose-deep);
  font-size: 15px;
}

.pet-owner-unlocked p,
.pet-owner-unlock-form p {
  margin: 0;
  color: var(--pet-soft);
  font-size: 13px;
  font-weight: 600;
  line-height: 1.6;
}

.pet-owner-unlock-form label {
  gap: 6px;
  color: var(--pet-ink);
  font-size: 13px;
  font-weight: 800;
}

.pet-owner-unlock-form input {
  min-height: 42px;
  border-color: rgba(222, 203, 187, 0.82);
  font-size: 15px;
}

.pet-gallery-viewer {
  position: absolute;
  inset: 0;
  z-index: 2;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  gap: 12px;
  padding:
    max(18px, env(safe-area-inset-top))
    max(14px, env(safe-area-inset-right))
    calc(18px + env(safe-area-inset-bottom))
    max(14px, env(safe-area-inset-left));
  background:
    linear-gradient(180deg, rgba(43, 34, 29, 0.96), rgba(80, 58, 45, 0.94)),
    #3a2c25;
}

.pet-gallery-viewer[hidden] {
  display: none;
}

.pet-gallery-viewer-head button {
  border: 0;
  color: rgba(255, 248, 240, 0.88);
  background: transparent;
  font-size: 14px;
  font-weight: 800;
}

.pet-gallery-viewer-head span,
.pet-gallery-viewer p {
  color: rgba(255, 248, 240, 0.78);
  font-size: 14px;
}

.pet-gallery-viewer-stage {
  position: relative;
  min-height: 0;
  display: grid;
  place-items: center;
}

.pet-gallery-viewer-stage img {
  max-width: 100%;
  max-height: 100%;
  border-radius: 14px;
  object-fit: contain;
  box-shadow: 0 18px 42px rgba(0, 0, 0, 0.28);
}

.pet-gallery-nav {
  position: absolute;
  top: 50%;
  width: 42px;
  height: 42px;
  border: 1px solid rgba(255, 248, 240, 0.28);
  border-radius: 999px;
  color: #fff8f0;
  background: rgba(255, 248, 240, 0.12);
  font-size: 30px;
  line-height: 1;
  transform: translateY(-50%);
}

.pet-gallery-nav.prev {
  left: 0;
}

.pet-gallery-nav.next {
  right: 0;
}

.pet-gallery-viewer p {
  margin: 0;
  text-align: center;
  line-height: 1.6;
}

@supports selector(:has(*)) {
  body:has(.pet-nook-mode) .page {
    width: 100%;
    padding: 0;
  }

  .pet-memory-page.pet-nook-mode {
    width: 100%;
    margin: 0;
  }
}

@media (max-height: 700px) {
  .pet-nook-topbar h1 {
    font-size: 24px;
  }

  .pet-nook-app {
    gap: 8px;
  }

  .pet-nook-app .nook-scene {
    width: min(100%, calc((100dvh - 142px - env(safe-area-inset-top) - env(safe-area-inset-bottom)) * 0.75), 390px);
    max-height: calc(100dvh - 142px - env(safe-area-inset-top) - env(safe-area-inset-bottom));
  }

  .pet-nook-dock .button {
    min-height: 44px;
  }

  .pet-nook-dock .nook-adjust .preview-tools {
    bottom: calc(78px + env(safe-area-inset-bottom));
    gap: 6px;
    padding: 10px;
  }

  .pet-nook-dock .nook-move-grid button,
  .pet-nook-dock .nook-scale-row button,
  .pet-nook-dock .preview-reset {
    min-height: 36px;
  }
}

@media (max-width: 420px) {
  .pet-profile-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  .pet-sheet-pendant {
    grid-template-columns: minmax(0, 1fr);
  }

  .pet-sheet-pendant .pet-pendant-preview {
    justify-self: center;
    width: min(170px, 58vw);
  }
}

@media (min-width: 760px) {
  .pet-memory-page.pet-nook-mode {
    background:
      linear-gradient(90deg, rgba(242, 232, 221, 0.98), rgba(255, 250, 244, 0.96), rgba(242, 232, 221, 0.98));
  }

  .pet-nook-app {
    min-height: min(100dvh, 920px);
    border-inline: 1px solid rgba(222, 203, 187, 0.72);
    background: rgba(255, 248, 240, 0.74);
    box-shadow: 0 24px 70px rgba(83, 61, 45, 0.12);
  }
}

.pet-footer {
  padding: 28px 0 38px;
  color: var(--pet-soft);
  font-size: 13px;
  line-height: 1.7;
  text-align: center;
}

@media (min-width: 760px) {
  .pet-memory-page {
    max-width: 960px;
  }

  .pet-hero,
  .pet-memory-card {
    grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.1fr);
    align-items: center;
    text-align: left;
  }

  .pet-nfc-badge {
    grid-column: 1 / -1;
  }

  .pet-hero-photo {
    justify-self: center;
  }

  .pet-hero-copy {
    justify-self: start;
  }

  .pet-hero-copy h1 {
    font-size: 72px;
  }

  .photo-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .blessing-message {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

}

/* Frontend design refresh: pet nook */
.pet-memory-page {
  --pet-bg: #f6f0e8;
  --pet-card: rgba(255, 253, 249, 0.9);
  --pet-ink: #292622;
  --pet-soft: #6b6258;
  --pet-line: rgba(125, 95, 66, 0.2);
  --pet-rose: #b75b52;
  --pet-rose-deep: #783732;
  --pet-lamp: #efbd70;
  --pet-sage: #8fa292;
  --pet-night: #253241;
  font-family: var(--pet-font-body);
}

.pet-memory-page button,
.pet-memory-page input,
.pet-memory-page select,
.pet-memory-page textarea,
.pet-memory-page .button {
  font-family: var(--pet-font-body);
}

.pet-memory-page.pet-nook-mode {
  background: #f6f0e8;
}

.pet-memory-page.pet-nook-mode::before {
  background:
    linear-gradient(180deg, rgba(255, 251, 245, 0.98) 0%, rgba(243, 235, 225, 0.96) 52%, rgba(220, 206, 191, 0.98) 100%),
    linear-gradient(90deg, rgba(143, 162, 146, 0.18), transparent 26%, transparent 74%, rgba(37, 50, 65, 0.08));
}

.pet-nook-app {
  gap: clamp(10px, 1.8dvh, 18px);
  padding:
    calc(16px + env(safe-area-inset-top))
    max(13px, env(safe-area-inset-right))
    calc(16px + env(safe-area-inset-bottom))
    max(13px, env(safe-area-inset-left));
}

.pet-nook-topbar {
  align-items: center;
  padding: 2px 2px 0;
}

.pet-nook-topbar p,
.pet-sheet-head p,
.pet-gallery-head p,
.pet-section-kicker {
  color: var(--pet-rose-deep);
  font-size: 12px;
  font-weight: 760;
  line-height: 1.25;
}

.pet-nook-topbar h1 {
  max-width: 270px;
  color: var(--pet-ink);
  font-family: var(--pet-font-display);
  font-size: clamp(27px, 7.2vw, 34px);
  font-weight: 700;
  line-height: 1.08;
}

.pet-icon-button {
  min-width: 58px;
  min-height: 40px;
  border-color: rgba(120, 55, 50, 0.18);
  border-radius: 14px;
  background: rgba(255, 253, 249, 0.78);
  color: var(--pet-rose-deep);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.92),
    0 14px 34px rgba(73, 57, 42, 0.12);
  backdrop-filter: blur(14px);
}

.pet-icon-button:focus-visible,
.pet-memory-page .button:focus-visible,
.pet-gallery-manage-button:focus-visible,
.nook-adjust-trigger:focus-visible,
.pet-gallery-tile > button:focus-visible,
.pet-gallery-nav:focus-visible {
  outline: 2px solid rgba(104, 132, 114, 0.62);
  outline-offset: 2px;
}

.pet-nook-app .nook-scene {
  width: min(100%, calc((100dvh - 186px - env(safe-area-inset-top) - env(safe-area-inset-bottom)) * 0.75), 420px);
  max-height: calc(100dvh - 186px - env(safe-area-inset-top) - env(safe-area-inset-bottom));
  border: 1px solid rgba(255, 253, 249, 0.78);
  border-radius: 20px;
  background: #fff8ef;
  box-shadow:
    0 0 0 1px rgba(121, 88, 61, 0.16),
    0 26px 64px rgba(56, 43, 32, 0.22),
    0 10px 28px rgba(239, 189, 112, 0.14);
}

.pet-nook-app .nook-scene::before {
  z-index: 2;
  background:
    linear-gradient(180deg, rgba(255, 253, 247, 0.12) 0%, transparent 34%, rgba(37, 50, 65, 0.06) 100%),
    linear-gradient(90deg, rgba(255, 255, 255, 0.22), transparent 18%, transparent 82%, rgba(37, 50, 65, 0.08));
}

.pet-memory-page .nest-bubble {
  top: 16px;
  width: min(270px, 80%);
  padding: 12px 16px;
  border-color: rgba(120, 94, 68, 0.2);
  border-radius: 15px;
  background: rgba(255, 253, 249, 0.92);
  color: #2f2a25;
  font-size: 14px;
  font-weight: 760;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.9),
    0 16px 34px rgba(53, 41, 31, 0.14);
}

.pet-memory-page .nest-bubble::after {
  right: 42px;
  border-color: rgba(120, 94, 68, 0.2);
  background: rgba(255, 253, 249, 0.92);
}

.pet-nook-dock {
  gap: 8px;
  padding-bottom: 1px;
}

.pet-nook-dock [data-pet-bubble-button] {
  width: min(270px, 88%);
  min-height: 50px;
  border: 0;
  border-radius: 999px;
  background:
    linear-gradient(135deg, #ae514a 0%, #c86d61 48%, #d89062 100%);
  color: #fffdf9;
  font-size: 16px;
  font-weight: 820;
  box-shadow:
    0 18px 42px rgba(120, 55, 50, 0.28),
    inset 0 1px 0 rgba(255, 255, 255, 0.28);
}

.pet-nook-dock [data-pet-bubble-button]:active {
  transform: translateY(1px) scale(0.985);
  box-shadow:
    0 0 0 5px rgba(239, 189, 112, 0.18),
    0 12px 28px rgba(120, 55, 50, 0.24);
}

.pet-nook-dock .nook-adjust-trigger {
  min-height: 32px;
  color: rgba(41, 38, 34, 0.58);
  font-size: 13px;
  font-weight: 720;
}

.pet-nook-dock .nook-adjust.is-open .nook-adjust-trigger {
  color: var(--pet-rose-deep);
}

.pet-nook-dock .nook-adjust .preview-tools {
  bottom: calc(122px + env(safe-area-inset-bottom));
  gap: 8px;
  padding: 12px;
  border-color: rgba(120, 94, 68, 0.22);
  border-radius: 18px;
  background:
    linear-gradient(180deg, rgba(255, 253, 249, 0.96), rgba(249, 241, 232, 0.94));
  box-shadow:
    0 22px 54px rgba(53, 41, 31, 0.22),
    inset 0 1px 0 rgba(255, 255, 255, 0.82);
}

.nook-adjust-hint {
  color: rgba(41, 38, 34, 0.62);
  font-size: 12px;
  font-weight: 650;
}

.pet-nook-dock .nook-move-grid button,
.pet-nook-dock .nook-scale-row button,
.pet-nook-dock .preview-reset {
  min-height: 38px;
  border-color: rgba(120, 94, 68, 0.18);
  border-radius: 12px;
  background: rgba(255, 253, 249, 0.86);
  color: var(--pet-ink);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.84);
}

.pet-info-sheet {
  width: min(100%, 500px);
  max-height: min(86dvh, 790px);
  border-color: rgba(120, 94, 68, 0.2);
  border-radius: 24px 24px 0 0;
  background:
    linear-gradient(180deg, rgba(255, 254, 250, 0.98), rgba(249, 242, 234, 0.98));
  box-shadow: 0 -28px 70px rgba(37, 50, 65, 0.18);
}

.pet-sheet-overlay {
  background: rgba(37, 50, 65, 0.28);
}

.pet-sheet-handle {
  width: 44px;
  height: 4px;
  background: rgba(41, 38, 34, 0.16);
}

.pet-sheet-head {
  border-bottom-color: rgba(120, 94, 68, 0.16);
}

.pet-sheet-head h2,
.pet-gallery-head h2 {
  color: var(--pet-ink);
  font-family: var(--pet-font-display);
  font-weight: 700;
}

.pet-profile-grid article,
.pet-memory-note,
.pet-gallery-entry,
.pet-gallery-upload-card,
.pet-gallery-empty {
  border-color: rgba(120, 94, 68, 0.16);
  background: rgba(255, 253, 249, 0.7);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.72);
}

.pet-profile-grid article {
  border-radius: 14px;
}

.pet-profile-grid .pet-status-fact,
.pet-memory-note,
.pet-gallery-entry {
  background:
    linear-gradient(135deg, rgba(255, 253, 249, 0.86), rgba(239, 189, 112, 0.1)),
    rgba(255, 253, 249, 0.74);
}

.pet-profile-grid span,
.pet-gallery-entry-copy em,
.pet-gallery-upload-card span,
.pet-gallery-empty p,
.pet-gallery-upload-card small {
  color: var(--pet-soft);
}

.pet-profile-grid strong,
.pet-gallery-entry-copy strong,
.pet-gallery-upload-card strong,
.pet-gallery-empty strong {
  color: var(--pet-ink);
}

.pet-gallery-entry {
  border-radius: 18px;
  box-shadow:
    0 12px 32px rgba(73, 57, 42, 0.08),
    inset 0 1px 0 rgba(255, 255, 255, 0.8);
}

.pet-gallery-panel {
  border-color: rgba(120, 94, 68, 0.18);
  border-radius: 24px 24px 0 0;
  background:
    linear-gradient(180deg, rgba(255, 254, 250, 0.99), rgba(250, 243, 236, 0.99));
  box-shadow: 0 -30px 74px rgba(37, 50, 65, 0.22);
}

.pet-gallery-tile {
  border-radius: 18px;
  background: #f7efe5;
  box-shadow: 0 12px 28px rgba(73, 57, 42, 0.1);
}

.pet-gallery-tile img {
  transition: transform 180ms ease, filter 180ms ease;
}

.pet-gallery-tile > button:active img {
  transform: scale(0.985);
  filter: saturate(0.98);
}

.pet-gallery-manage-button {
  border-color: rgba(120, 94, 68, 0.18);
  background: rgba(255, 253, 249, 0.72);
  color: rgba(41, 38, 34, 0.64);
}

.pet-gallery-modal.is-managing .pet-gallery-manage-button {
  background: rgba(143, 162, 146, 0.18);
  color: #405146;
}

.pet-gallery-viewer {
  background:
    linear-gradient(180deg, rgba(31, 39, 50, 0.98), rgba(58, 45, 37, 0.96));
}

@media (max-height: 700px) {
  .pet-nook-app {
    gap: 7px;
    padding-top: calc(12px + env(safe-area-inset-top));
  }

  .pet-nook-topbar h1 {
    font-size: 24px;
  }

  .pet-nook-app .nook-scene {
    width: min(100%, calc((100dvh - 150px - env(safe-area-inset-top) - env(safe-area-inset-bottom)) * 0.75), 384px);
    max-height: calc(100dvh - 150px - env(safe-area-inset-top) - env(safe-area-inset-bottom));
    border-radius: 17px;
  }

  .pet-memory-page .nest-bubble {
    top: 12px;
    padding: 10px 14px;
    font-size: 13px;
  }

  .pet-nook-dock [data-pet-bubble-button] {
    min-height: 44px;
  }

  .pet-nook-dock .nook-adjust .preview-tools {
    bottom: calc(118px + env(safe-area-inset-bottom));
    padding: 10px;
  }
}

@media (max-width: 360px) {
  .pet-nook-topbar h1 {
    max-width: 230px;
    font-size: 24px;
  }

  .pet-icon-button {
    min-width: 52px;
    padding: 0 10px;
  }

  .pet-gallery-entry {
    grid-template-columns: minmax(0, 1fr) 92px 14px;
  }
}

@media (min-width: 760px) {
  .pet-memory-page.pet-nook-mode {
    background:
      linear-gradient(90deg, #d9ccbd 0%, #f6f0e8 30%, #f9f4ed 50%, #f6f0e8 70%, #d9ccbd 100%);
  }

  .pet-nook-app {
    border-inline-color: rgba(120, 94, 68, 0.16);
    background: rgba(255, 253, 249, 0.62);
    box-shadow: 0 28px 84px rgba(37, 50, 65, 0.14);
  }
}

@media (prefers-reduced-motion: reduce) {
  .pet-memory-page *,
  .pet-memory-page *::before,
  .pet-memory-page *::after {
    animation-duration: 0.001ms !important;
    transition-duration: 0.001ms !important;
  }
}

@keyframes pet-bubble-pop {
  0% {
    opacity: 0.72;
    transform: translateX(-50%) translateY(4px) scale(0.97);
  }
  100% {
    opacity: 1;
    transform: translateX(-50%) translateY(0) scale(1);
  }
}

@keyframes nook-pet-touch {
  0% {
    transform:
      translate(-50%, -50%)
      translate(var(--nook-pet-x), var(--nook-pet-y))
      scale(var(--nook-pet-scale));
  }
  38% {
    transform:
      translate(-50%, -53%)
      translate(var(--nook-pet-x), var(--nook-pet-y))
      scale(calc(var(--nook-pet-scale) * 1.035));
  }
  100% {
    transform:
      translate(-50%, -50%)
      translate(var(--nook-pet-x), var(--nook-pet-y))
      scale(var(--nook-pet-scale));
  }
}

@keyframes nook-warm-touch {
  0% {
    opacity: 0;
  }
  34% {
    opacity: 1;
  }
  100% {
    opacity: 0;
  }
}
