:root {
  --share-paper: #fff6e9;
  --share-cream: #fff9f4;
  --share-sand: #f0dfcb;
  --share-ink: #60391f;
  --share-muted: #805f50;
  --share-coral: #df795f;
  --share-olive: #7e8d50;
  --share-line: #e6c7a6;
}

.pet-share-dialog {
  position: fixed;
  inset: 0;
  width: 100vw;
  max-width: none;
  height: 100dvh;
  max-height: 100dvh;
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: var(--share-paper);
  color: var(--share-ink);
  box-shadow: none;
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", "PingFang SC", "Microsoft YaHei", sans-serif;
  overflow: auto;
}

.pet-share-dialog::backdrop {
  background: rgba(48, 32, 26, .42);
}

.pet-share-dialog__content {
  box-sizing: border-box;
  min-height: 100%;
  width: min(100%, 520px);
  margin: 0 auto;
  padding: max(12px, env(safe-area-inset-top)) 12px max(20px, env(safe-area-inset-bottom));
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 20px;
}

.pet-share-dialog__header {
  display: grid;
  grid-template-columns: 70px minmax(0, 1fr) 94px;
  align-items: center;
  gap: 6px;
  min-height: 52px;
  flex: none;
}

.pet-share-dialog__eyebrow {
  margin: 0;
  color: var(--share-coral);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: .12em;
  line-height: 1.5;
}

.pet-share-dialog h2 {
  margin: 0;
  color: var(--share-ink);
  font-size: 19px;
  line-height: 1.35;
  letter-spacing: -.03em;
  text-align: center;
}

.pet-share-dialog__close {
  min-width: 44px;
  min-height: 44px;
  flex: none;
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--share-muted);
  font-size: 17px;
  line-height: 1;
  cursor: pointer;
  text-align: left;
}

.pet-share-dialog__main {
  flex: 1 0 auto;
  display: flex;
  align-items: flex-start;
  padding: 0;
}
.pet-share-dialog__main .pet-share-card { width: 100%; }
.pet-share-dialog__hint {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  margin: 0;
  color: var(--share-olive);
  font-size: 17px;
  line-height: 1.7;
  text-align: center;
}
.pet-share-dialog__hint::before, .pet-share-dialog__hint::after {
  content: '';
  width: 30px;
  height: 1px;
  flex: none;
  background: currentColor;
  opacity: .65;
}

.pet-share-dialog__close:focus-visible,
.pet-share-dialog__action:focus-visible {
  outline: 3px solid rgba(203, 116, 98, .45);
  outline-offset: 2px;
}

.pet-share-dialog__loading {
  min-height: 150px;
  display: grid;
  place-items: center;
  margin: 0;
  padding: 30px 20px;
  color: var(--share-muted);
  font-size: 13px;
  text-align: center;
}

.pet-share-card {
  position: relative;
  aspect-ratio: .85;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, .9);
  border-radius: 24px;
  background: var(--share-paper);
  box-shadow: 0 8px 20px rgba(134, 83, 39, .08);
}

.pet-share-card__hero {
  position: absolute;
  inset: 0;
  height: 100%;
  width: 100%;
  overflow: hidden;
  background: #e6c7a6;
}

.pet-share-card__hero-image {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
}

.pet-share-card__identity {
  position: absolute;
  inset: auto 0 0;
  height: 26%;
  box-sizing: border-box;
  min-width: 0;
  display: grid;
  grid-template-columns: 27% minmax(0, 1fr) 22%;
  align-items: center;
  gap: 9px;
  padding: 12px;
  border-radius: 22px 22px 0 0;
  background: linear-gradient(180deg, rgba(255, 239, 214, .82), rgba(255, 229, 194, .92));
}

.pet-share-card__brand {
  display: grid;
  justify-items: center;
  gap: 4px;
  min-width: 0;
  color: var(--share-ink);
  font-size: 17px;
  font-weight: 700;
  white-space: nowrap;
}

.pet-share-card__brand-icon {
  width: 64px;
  height: 64px;
  object-fit: contain;
  mix-blend-mode: normal;
}

.pet-share-card__brand small { font-size: inherit; line-height: 1.2; font-family: KaiTi, STKaiti, 'Kaiti SC', 'Noto Serif CJK SC', serif; }

.pet-share-card__pet {
  min-width: 0;
  padding-left: 12px;
  border-left: 1px solid var(--share-line);
}

.pet-share-card__pet strong,
.pet-share-card__pet small {
  display: block;
  overflow-wrap: anywhere;
}

.pet-share-card__pet strong {
  color: var(--share-ink);
  font-size: 34px;
  font-weight: 700;
  font-family: KaiTi, STKaiti, 'Kaiti SC', 'Noto Serif CJK SC', serif;
  line-height: 1.15;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.pet-share-card__pet small {
  margin-top: 5px;
  color: var(--share-muted);
  font-size: 11px;
  line-height: 1.55;
}

.pet-share-card__qr-row {
  display: grid;
  justify-items: center;
  align-content: center;
  min-width: 0;
  gap: 4px;
}

.pet-share-card__qr {
  width: 64px;
  height: 64px;
  max-width: 100%;
  box-sizing: border-box;
  flex: none;
  image-rendering: pixelated;
  border: 0;
  border-radius: 0;
  background: #fff;
  box-shadow: none;
}

.pet-share-card__qr-copy {
  min-width: 0;
}

.pet-share-card__qr-copy strong,
.pet-share-card__qr-copy small {
  display: block;
  overflow-wrap: anywhere;
}

.pet-share-card__qr-copy strong {
  color: var(--share-muted);
  font-size: 10px;
  line-height: 1.35;
  text-align: center;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  overflow: hidden;
}

.pet-share-card__qr-copy small {
  margin-top: 5px;
  color: #9a7a68;
  font-size: 10px;
  line-height: 1.55;
}

.pet-share-dialog__actions {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
  margin: 8px 16px 0;
}

.pet-share-dialog__action {
  min-height: 56px;
  padding: 10px 12px;
  border: 1px solid var(--share-line);
  border-radius: 26px;
  background: var(--share-cream);
  color: var(--share-muted);
  font-size: 22px;
  font-weight: 700;
  cursor: pointer;
}

.pet-share-dialog__action--primary {
  border-color: var(--share-coral);
  background: var(--share-coral);
  color: #fff;
  box-shadow: none;
}

.pet-share-dialog__save {
  min-height: 56px;
  padding: 10px 12px;
  border: 1px solid var(--share-line);
  border-radius: 26px;
  background: var(--share-cream);
  color: var(--share-muted);
  font-size: 22px;
  font-weight: 700;
}
.pet-share-dialog__link[hidden] { display: none; }

.pet-share-dialog__action[aria-busy="true"] {
  opacity: .68;
  cursor: progress;
}

.pet-share-dialog__link {
  margin: 11px 3px 0;
  color: #9a7a68;
  font-size: 10px;
  line-height: 1.45;
  overflow-wrap: anywhere;
  user-select: text;
}

.pet-share-dialog__status {
  min-height: 20px;
  margin: 7px 3px 0;
  color: var(--share-muted);
  font-size: 11px;
  line-height: 1.6;
}

@media (max-width: 359px) {
  .pet-share-dialog__content { padding-inline: 10px; }
  .pet-share-card__identity { padding: 9px; gap: 7px; }
  .pet-share-card__qr { width: 52px; height: 52px; }
  .pet-share-card__pet strong { font-size: 28px; }
  .pet-share-card__brand-icon { width: 52px; height: 52px; }
  .pet-share-card__brand { font-size: 12px; }
  .pet-share-card__pet small { font-size: 10px; }
  .pet-share-dialog__hint { font-size: 13px; }
}

@media (min-width: 900px) {
  .pet-share-dialog { width: 520px; margin: 0 auto; }
}

#mediaViewer[data-share-save="true"] {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 62px 18px 102px;
  box-sizing: border-box;
  background: var(--share-paper);
  color: var(--share-ink);
}
#mediaViewer[data-share-save="true"][hidden] { display: none; }
#mediaViewer[data-share-save="true"] .viewer-toolbar { display: none; }
#mediaViewer[data-share-save="true"][data-save-ready="true"] .viewer-toolbar { display: flex; }
#mediaViewer[data-share-save="true"][data-save-ready="true"] .viewer-download {
  color: var(--share-ink);
  border-color: rgba(96, 57, 31, .2);
  background: rgba(255, 255, 255, .76);
}
#mediaViewer[data-share-save="true"][data-save-ready="true"] .viewer-close {
  color: var(--share-ink);
  background: rgba(255, 255, 255, .76);
}
#mediaViewer[data-share-save="true"] .viewer-content {
  position: static;
  flex: 1 1 auto;
  width: 100%;
  min-height: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
}
#mediaViewer[data-share-save="true"] .viewer-content img {
  width: auto;
  height: auto;
  max-width: min(100%, 390px);
  max-height: 100%;
  object-fit: contain;
  border-radius: 22px;
  box-shadow: 0 10px 24px rgba(92, 56, 35, .12);
}
#mediaViewer[data-share-save="true"] .viewer-caption {
  position: static;
  display: flex;
  flex: none;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  width: min(100%, 390px);
  margin: 16px 0 0;
  color: var(--share-olive);
  text-align: center;
  max-height: none;
  overflow: visible;
}
#mediaViewer[data-share-save="true"] .viewer-caption strong {
  position: absolute;
  top: 22px;
  color: var(--share-ink);
  font-size: 22px;
}
#mediaViewer[data-share-save="true"] .viewer-caption span {
  color: var(--share-olive);
  font-size: 13px;
  line-height: 1.5;
}
.pet-share-save__copy {
  width: 100%;
  min-height: 56px;
  border: 0;
  border-radius: 24px;
  color: #fff;
  background: var(--share-coral);
  font: inherit;
  font-weight: 650;
  font-size: 22px;
  cursor: pointer;
}
.pet-share-save__status {
  min-height: 18px;
  margin: 0;
  font-size: 12px;
}
#mediaViewer[data-share-save="true"] .viewer-caption #viewerMeta {
  color: var(--share-ink);
  font-size: 16px;
  font-weight: 600;
  max-width: 100%;
  white-space: normal;
  overflow-wrap: anywhere;
}
.pet-share-save__original {
  min-height: 44px;
  display: flex;
  align-items: center;
  color: var(--share-muted);
  font-size: 13px;
  text-decoration: underline;
}
