/* PawMemora shared modal system */
body.pm-modal-open,body.modal-open{overflow:hidden}
.pm-modal-layer,.pm-save-overlay{position:fixed;inset:0;z-index:100;display:grid;place-items:center;padding:58px 24px 24px;background:rgba(50,35,31,.58);backdrop-filter:blur(7px)}
.pm-modal-layer[hidden],.pm-save-overlay[hidden]{display:none}
.pm-dialog{position:fixed;inset:0;box-sizing:border-box;width:100%;max-width:none;height:100%;max-height:none;margin:0;padding:58px 24px 24px;border:0;background:transparent;color:var(--ink);overflow:visible}
.pm-dialog[open]{display:grid;place-items:center}
.pm-dialog::backdrop{background:rgba(50,35,31,.58);backdrop-filter:blur(7px)}
.pm-modal{--pm-modal-width:600px;--pm-badge-size:64px;position:relative;box-sizing:border-box;width:min(100%,var(--pm-modal-width));max-height:calc(100vh - 82px);display:flex;flex-direction:column;overflow:visible;border:1px solid rgba(255,255,255,.72);border-radius:28px;background:var(--surface);box-shadow:0 32px 90px rgba(41,25,20,.31);color:var(--ink)}
.pm-modal--compact{--pm-modal-width:470px}
.pm-modal--form{--pm-modal-width:620px}
.pm-modal--compose{--pm-modal-width:620px}
.pm-modal--media{--pm-modal-width:900px}
.pm-modal--progress{--pm-modal-width:520px}
.pm-modal--photo-badge{--pm-badge-size:82px}
.pm-modal__close{position:absolute;z-index:4;right:16px;top:16px;width:40px;height:40px;display:grid;place-items:center;padding:0;border:1px solid var(--line);border-radius:50%;background:rgba(255,253,252,.94);color:var(--muted);cursor:pointer;transition:border-color .18s ease,color .18s ease,transform .18s ease,box-shadow .18s ease}
.pm-modal__close:hover{border-color:rgba(185,101,73,.45);color:var(--terra-dark)}
.pm-modal__close:focus-visible{outline:3px solid rgba(185,101,73,.3);outline-offset:3px}
.pm-modal__close:active{transform:translateY(1px)}
.pm-modal__close svg{width:17px;height:17px;fill:none;stroke:currentColor;stroke-width:1.8}
.pm-modal__badge{position:absolute;z-index:3;left:50%;top:0;width:var(--pm-badge-size);height:var(--pm-badge-size);display:grid;place-items:center;overflow:hidden;border:4px solid var(--surface);border-radius:50%;background:linear-gradient(145deg,var(--terra-soft),#faeee8);color:var(--terra-dark);box-shadow:0 14px 30px rgba(76,51,43,.2),0 4px 10px rgba(76,51,43,.09),inset 0 0 0 1px rgba(185,101,73,.13);transform:translate(-50%,-50%)}
.pm-modal__badge svg{width:29px;height:29px;fill:none;stroke:currentColor;stroke-width:1.75}
.pm-modal__badge img{width:100%;height:100%;display:block;object-fit:cover}
.pm-modal__badge--warning{background:#f5d8d2;color:#963e34}
.pm-modal__badge--success{background:var(--sage-soft);color:#526653}
.pm-modal__badge .spinner{color:#fff}
.pm-modal__header{flex:0 0 auto;padding:52px 34px 0;text-align:center}
.pm-modal--photo-badge .pm-modal__header{padding-top:60px}
.pm-modal__header>.eyebrow{margin:0 auto 8px;font-size:10px;line-height:1.5;letter-spacing:.15em}
.pm-modal__title{max-width:760px;margin:0 auto;font-family:var(--font-display);font-size:36px;font-weight:560;letter-spacing:-.03em;line-height:1.04;text-wrap:balance}
.pm-modal--compact .pm-modal__title{font-size:34px}
.pm-modal__description{max-width:560px;margin:9px auto 0;color:var(--muted);font-size:13px;line-height:1.55;text-wrap:balance}
.pm-modal__body{min-height:0;overflow:auto;padding:22px 34px 0;overscroll-behavior:contain}
.pm-modal__body--flush{padding-inline:0}
.pm-modal__actions{flex:0 0 auto;display:flex;align-items:center;justify-content:flex-end;gap:10px;padding:24px 34px 30px}
.pm-modal__actions--center{justify-content:center}
.pm-modal__actions .button{min-width:0}
.pm-modal__prompt{display:grid;grid-template-columns:44px minmax(0,1fr);align-items:center;gap:14px;padding:15px 17px;border:1px solid rgba(185,101,73,.25);border-radius:18px;background:linear-gradient(135deg,rgba(243,225,216,.76),rgba(255,250,247,.94));text-align:left}
.pm-modal__prompt-icon{width:44px;height:44px;display:grid;place-items:center;border:1px solid rgba(185,101,73,.2);border-radius:50%;background:rgba(255,253,252,.82);color:var(--terra-dark)}
.pm-modal__prompt-icon svg{width:22px;height:22px;fill:none;stroke:currentColor;stroke-width:1.8}
.pm-modal__prompt .eyebrow{margin:0 0 3px;font-size:9px}
.pm-modal__prompt p{margin:0;color:var(--ink);font-family:var(--font-display);font-size:20px;font-weight:600;line-height:1.25}
.pm-modal__field{display:grid;gap:8px;margin-top:18px;text-align:left}
.pm-modal__field>label,.pm-modal__legend{color:var(--ink);font-size:13px;font-weight:750}
.pm-modal__field textarea,.pm-modal__field input,.pm-modal__field select{width:100%;border:1px solid var(--line-strong);border-radius:16px;background:#fffdfb;color:var(--ink);font:inherit;transition:border-color .18s ease,box-shadow .18s ease}
.pm-modal__field textarea{min-height:170px;padding:15px 16px;line-height:1.6;resize:vertical}
.pm-modal__field input,.pm-modal__field select{min-height:48px;padding:11px 13px}
.pm-modal__field textarea:focus,.pm-modal__field input:focus,.pm-modal__field select:focus{outline:none;border-color:var(--terra);box-shadow:0 0 0 4px rgba(185,101,73,.11)}
.pm-modal__counter{justify-self:end;color:var(--muted);font-size:11px;font-weight:650;line-height:1}
.pm-modal__choice-group{margin:19px 0 0;padding:0;border:0;text-align:left}
.pm-modal__choice-grid{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:12px;margin-top:9px}
.pm-modal__choice{position:relative;min-width:0;display:grid;grid-template-columns:42px minmax(0,1fr);align-items:start;gap:11px;padding:15px;border:1px solid var(--line);border-radius:18px;background:var(--surface);cursor:pointer;transition:border-color .18s ease,background-color .18s ease,box-shadow .18s ease}
.pm-modal__choice.is-selected,.pm-modal__choice:has(input:checked){border-color:var(--terra);background:linear-gradient(145deg,rgba(243,225,216,.58),rgba(255,253,252,.98));box-shadow:0 7px 18px rgba(185,101,73,.08)}
.pm-modal__choice input{position:absolute;right:14px;top:14px;width:20px;height:20px;margin:0;accent-color:var(--terra)}
.pm-modal__choice-icon{width:42px;height:42px;display:grid;place-items:center;border:1px solid rgba(185,101,73,.16);border-radius:50%;background:var(--surface-soft);color:var(--terra-dark)}
.pm-modal__choice-icon svg{width:20px;height:20px;fill:none;stroke:currentColor;stroke-width:1.8}
.pm-modal__choice-copy{min-width:0;padding-top:1px;padding-right:22px}
.pm-modal__choice strong,.pm-modal__choice small{display:block}
.pm-modal__choice strong{font-size:14px}
.pm-modal__choice small{margin-top:3px;color:var(--muted);font-size:11px;font-weight:400;line-height:1.45}
.pm-modal__status{margin-top:14px;padding:11px 13px;border:1px solid rgba(139,70,54,.28);border-radius:13px;background:#f9e7e1;color:#6f2c22;font-size:12px;font-weight:700;line-height:1.45;text-align:left}
.pm-modal__status[hidden]{display:none}
.pm-modal__media-layout{display:grid;grid-template-columns:150px minmax(0,1fr);align-items:start;gap:18px}
.pm-modal__media-tools{display:grid;gap:7px}
.pm-modal__media-tools button,.pm-modal__media-tool{min-height:42px;display:flex;align-items:center;gap:9px;padding:9px 11px;border:1px solid transparent;border-radius:12px;background:transparent;color:var(--muted);font-size:12px;font-weight:700;text-align:left;cursor:pointer}
.pm-modal__media-tool{cursor:default}
.pm-modal__media-tool.is-active{border-color:rgba(185,101,73,.3);background:var(--terra-soft);color:var(--terra-dark)}
.pm-modal__media-tools button:hover,.pm-modal__media-tools button:focus-visible{border-color:var(--line);background:var(--surface-soft);color:var(--ink);outline:none}
.pm-modal__media-tools svg{width:17px;height:17px;fill:none;stroke:currentColor;stroke-width:1.8}
.pm-modal__media-stage{position:relative;min-height:330px;overflow:hidden;border-radius:18px;background:var(--ink)}
.pm-modal__media-stage img{display:block;max-width:100%}
.pm-modal__zoom-controls{position:absolute;z-index:8;right:12px;bottom:12px;display:grid;overflow:hidden;border:1px solid rgba(69,48,41,.18);border-radius:12px;background:rgba(255,253,252,.96);box-shadow:0 7px 22px rgba(35,23,19,.24);backdrop-filter:blur(6px)}
.pm-modal__zoom-controls button{width:42px;height:42px;display:grid;place-items:center;padding:0;border:0;background:transparent;color:var(--ink);font:600 25px/1 Arial,sans-serif;cursor:pointer;touch-action:manipulation;transition:background-color .16s ease,color .16s ease}
.pm-modal__zoom-controls button+button{border-top:1px solid rgba(69,48,41,.14)}
.pm-modal__zoom-controls button:hover{background:var(--terra-soft);color:var(--terra-dark)}
.pm-modal__zoom-controls button:focus-visible{position:relative;z-index:1;outline:3px solid rgba(185,101,73,.32);outline-offset:-3px}
.pm-modal__zoom-controls button:active{background:#f1d9cf}
.pm-modal__zoom-controls button:disabled{cursor:default;opacity:.45}
.pm-modal__progress{margin:22px 0 0;text-align:left}
.pm-modal__progress>span{display:flex;justify-content:space-between;gap:20px;margin-bottom:7px;font-size:12px;line-height:1.35}
.pm-modal__progress>div{height:8px;overflow:hidden;border-radius:999px;background:var(--terra-soft)}
.pm-modal__progress i{display:block;width:var(--save-progress,42%);height:100%;border-radius:999px;background:var(--terra);transition:width .2s ease}
.pm-modal__note{display:grid;grid-template-columns:32px 1fr;align-items:center;gap:10px;margin-top:17px;padding:13px;border-radius:14px;background:var(--sage-soft);text-align:left}
.pm-modal__note[hidden]{display:none}
.pm-modal__note>svg{width:21px;height:21px;fill:none;stroke:#526653;stroke-width:1.8}
.pm-modal__note strong,.pm-modal__note small{display:block}.pm-modal__note strong{font-size:13px}.pm-modal__note small{margin-top:2px;color:var(--muted);font-size:12px;line-height:1.4}
.pm-modal__progress-actions{display:none}
.pm-save-overlay.is-success .saving-mark,.pm-save-overlay.is-success .failure-mark,.pm-save-overlay.is-failure .saving-mark,.pm-save-overlay.is-failure .success-mark{display:none}
.pm-save-overlay:not(.is-success) .success-mark,.pm-save-overlay:not(.is-failure) .failure-mark{display:none}
.pm-save-overlay.is-success .pm-modal__progress,.pm-save-overlay.is-failure .pm-modal__progress{display:none}
.pm-save-overlay.is-success .pm-modal__progress-actions,.pm-save-overlay.is-failure .pm-modal__progress-actions{display:flex}
.pm-modal[aria-busy="true"]{cursor:wait}
.pm-modal .button[disabled]{cursor:wait;opacity:.62}
.avatar-crop-stage{width:min(330px,100%);aspect-ratio:1;margin:0 auto;display:grid;place-items:center;overflow:hidden;border:1px solid var(--line);border-radius:22px;background:linear-gradient(145deg,#f7ded4,#e7ece2);color:var(--terra-dark)}
.avatar-crop-stage img{width:100%;height:100%;display:block;object-fit:cover}.avatar-crop-stage img:not([src]){display:none}.avatar-crop-stage span{display:grid;place-items:center}.avatar-crop-stage svg{width:44px;height:44px;fill:none;stroke:currentColor;stroke-width:1.5}
.pm-modal__body>.avatar-dialog-help{margin:15px auto 0;color:var(--muted);font-size:12px;line-height:1.55;text-align:center}
@media(max-width:720px){
  .pm-modal-layer,.pm-save-overlay{align-items:end;padding:58px 12px 12px}
  .pm-dialog{align-items:end;padding:58px 12px 12px}
  .pm-modal{max-height:calc(100vh - 70px);border-radius:24px}
  .pm-modal__header{padding:48px 20px 0}.pm-modal--photo-badge .pm-modal__header{padding-top:57px}
  .pm-modal__title{font-size:31px}.pm-modal--compact .pm-modal__title{font-size:30px}
  .pm-modal__body{padding:19px 20px 0}.pm-modal__actions{padding:20px 20px 22px;flex-wrap:wrap}
  .pm-modal__actions .button{flex:1 1 auto}
  .pm-modal__media-layout{grid-template-columns:1fr}
  .pm-modal__media-tools{grid-template-columns:repeat(5,minmax(0,1fr));order:2}
  .pm-modal__media-tools button,.pm-modal__media-tool{justify-content:center;padding:9px;font-size:0}.pm-modal__media-tools svg{width:20px;height:20px}
  .pm-modal__media-stage{min-height:280px}
  .pm-modal__zoom-controls{right:10px;bottom:10px}.pm-modal__zoom-controls button{width:40px;height:40px;font-size:24px}
}
@media(max-width:460px){
  .pm-modal-layer,.pm-save-overlay,.pm-dialog{padding-inline:8px;padding-bottom:max(8px,env(safe-area-inset-bottom,0px))}
  .pm-modal__actions{display:grid;grid-template-columns:1fr;width:100%}.pm-modal__actions .button{width:100%}
  .pm-modal__prompt{grid-template-columns:38px minmax(0,1fr);padding:13px}.pm-modal__prompt-icon{width:38px;height:38px}.pm-modal__prompt p{font-size:18px}
}
@media(prefers-reduced-motion:reduce){.pm-modal__close,.pm-modal__choice,.pm-modal__progress i{transition:none}}
/* Shared content owners used inside every PawMemora modal variant. */
.pm-modal__badge--paw svg{fill:currentColor;stroke:none}
.pm-save-overlay .saving-mark{background:var(--terra);color:#fff}
.pm-modal__actions .button svg{width:17px;height:17px;fill:none;stroke:currentColor;stroke-width:1.8}
.pm-modal__status:empty{display:none}
.story-helper-runtime{display:grid;gap:12px;text-align:left}
.story-helper-runtime>label,.story-helper-controls label{display:block;color:var(--ink);font-size:12px;font-weight:750}
.story-helper-runtime textarea,.story-helper-runtime select{width:100%;margin-top:7px;border:1px solid var(--line-strong);border-radius:16px;background:#fffdfb;color:var(--ink);font:inherit;font-size:13px;transition:border-color .18s ease,box-shadow .18s ease}
.story-helper-runtime textarea{min-height:142px;padding:13px;resize:vertical;line-height:1.6}
.story-helper-runtime select{min-height:46px;padding:10px 12px}
.story-helper-runtime textarea:focus,.story-helper-runtime select:focus{outline:none;border-color:var(--terra);box-shadow:0 0 0 4px rgba(185,101,73,.11)}
.story-helper-controls{display:grid;grid-template-columns:1fr 1fr;gap:12px}
.story-helper-status{padding:10px 12px;border-radius:13px;background:var(--surface-soft);color:var(--muted);font-size:11px;line-height:1.45}
.story-helper-status.is-error{background:#fff3f0;color:#963e34}
.story-helper-result{padding:13px;border:1px solid var(--line);border-radius:16px;background:var(--sage-soft)}
.story-helper-result p{margin:0 0 10px;color:var(--ink);white-space:pre-wrap}
.crop-stage--runtime{height:min(54vh,470px);aspect-ratio:auto;background:#241a18}
.crop-stage--runtime img{max-width:100%;display:block;transform:none}
.crop-stage--runtime .cropper-container{width:100%!important;height:100%!important;max-width:100%}
.memorial-message-tools{display:flex;align-items:center;justify-content:flex-start;margin-top:10px}
.pm-modal--compose .pm-modal__field{margin-top:0}
.pm-modal--compose .pm-modal__field textarea{min-height:190px;font-size:16px}
.avatar-crop-stage .cropper-container{width:100%!important;height:100%!important}
.avatar-crop-stage>img{max-width:100%;max-height:100%}
.avatar-crop-stage.is-ready [data-avatar-placeholder]{display:none}
@media(max-width:620px){.story-helper-controls{grid-template-columns:1fr}.pm-modal__choice-grid{grid-template-columns:repeat(2,minmax(0,1fr))}.pm-modal__choice{grid-template-columns:34px minmax(0,1fr);padding:12px;gap:8px}.pm-modal__choice-icon{width:34px;height:34px}.pm-modal__choice-copy{padding-right:22px}.pm-modal__choice input{right:10px;top:10px;width:18px;height:18px}.pm-modal__choice small{font-size:10px}}
@media(max-width:420px){.pm-modal__choice-grid{grid-template-columns:1fr}}
