/* v0.3: scene structure and proportions are template-specific; business markup is shared. */
.sanctuary.v03-sanctuary {
  padding: 0;
  background: none;
  min-height: 0;
  border: 0;
  overflow: visible;
  position: relative;
  margin: 0;
}
.shrine-stage {
  --tablet-left: 18%;
  --tablet-top: 24%;
  --tablet-width: 53%;
  --altar-top: 68%;
  position: relative;
  aspect-ratio: 600/940;
  min-height: 580px;
  isolation: isolate;
  overflow: hidden;
  background: #25201c;
  color: #f3e9d3;
}
.shrine-backdrop {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: fill;
  z-index: -2;
}
.stage-inscription {
  position: absolute;
  top: 6%;
  left: 7%;
  right: 20%;
  font-size: 10px;
  letter-spacing: 3px;
  text-align: center;
  color: #dbc69e;
}
.memorial-tablet {
  position: absolute;
  left: var(--tablet-left);
  top: var(--tablet-top);
  width: var(--tablet-width);
  padding: 17px 8px 10px;
  background: linear-gradient(100deg, #38251d, #1e1714 45%, #38251d);
  border: 3px double #ab8a57;
  box-shadow: 0 12px 25px #0006;
  text-align: center;
}
.tablet-cap {
  position: absolute;
  left: 15%;
  right: 15%;
  height: 12px;
  top: -10px;
  border: 2px solid #b49b6c;
  background: #39271b;
  clip-path: polygon(
    15% 100%,
    0 70%,
    18% 20%,
    50% 0,
    82% 20%,
    100% 70%,
    85% 100%
  );
}
.v03-sanctuary .portrait,
.template-preview .portrait {
  width: 58%;
  aspect-ratio: 3/4;
  height: auto;
  margin: 0 auto 12px;
  display: grid;
  place-items: center;
  background: #27221d;
  border: 3px solid #c7b88e;
  box-shadow: 0 0 0 5px #151614;
  color: #c5b58e;
  font-size: 45px;
  padding: 0;
  overflow: hidden;
}
.v03-sanctuary .portrait img,
.template-preview .portrait img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.v03-sanctuary h1,
.template-preview h1 {
  font-size: clamp(18px, 4.8vw, 28px);
  letter-spacing: 2px;
  line-height: 1.45;
  margin: 8px 0;
  overflow-wrap: anywhere;
  font-weight: 400;
}
.v03-sanctuary .dates,
.template-preview .dates {
  font-family: inherit;
  font-size: 10px;
  letter-spacing: 0;
  margin: 4px -4px;
  color: #cfc3aa;
}
.v03-sanctuary .epitaph,
.template-preview .epitaph {
  font-size: 11px;
  line-height: 1.6;
  letter-spacing: 1px;
  margin: 9px 0 0;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
  color: #d7c6a7;
}
.tpl-1 {
  --tablet-left: 15%;
  --tablet-top: 27%;
  --tablet-width: 43%;
  --altar-top: 71%;
}
.tpl-1 .memorial-tablet {
  border-width: 6px 2px;
  background: linear-gradient(95deg, #57412f, #302c20);
  border-radius: 36% 36% 0 0/12% 12% 0 0;
}
.tpl-2 {
  --tablet-left: 23%;
  --tablet-top: 27%;
  --tablet-width: 47%;
  --altar-top: 72%;
}
.tpl-2 .memorial-tablet {
  background: #34352ddd;
  border: 1px solid #c5b895;
  border-radius: 48% 48% 4px 4px;
  padding-top: 23px;
}
.tpl-2 .portrait {
  border-radius: 50%;
  aspect-ratio: 1/1;
  width: 65%;
}
.tpl-2 .tablet-cap {
  display: none;
}
.tpl-3 {
  --tablet-left: 43%;
  --tablet-top: 28%;
  --tablet-width: 39%;
  --altar-top: 70%;
}
.tpl-3 .memorial-tablet {
  border: 5px ridge #8b784d;
  background: #20291ff2;
}
.tpl-3 h1 {
  font-size: 21px;
}
.tpl-3 .portrait {
  width: 65%;
}
.tpl-4 {
  --tablet-left: 24%;
  --tablet-top: 29%;
  --tablet-width: 45%;
  --altar-top: 69%;
}
.tpl-4 .memorial-tablet {
  background: linear-gradient(110deg, #e5dfd0, #a69d8c);
  border: 6px double #e6e0cf;
  color: #2e302a;
}
.tpl-4 .dates,
.tpl-4 .epitaph {
  color: #363c31;
}
.tpl-4 .tablet-cap {
  background: #d7cebb;
}
.tpl-4 .portrait {
  border-color: #f5f1e5;
}
.tpl-5 {
  --tablet-left: 29%;
  --tablet-top: 24%;
  --tablet-width: 36%;
  --altar-top: 74%;
}
.tpl-5 .memorial-tablet {
  padding-top: 27px;
  border-radius: 45% 45% 2px 2px/9% 9% 0 0;
  background: #363b2bec;
}
.tpl-5 .portrait {
  width: 78%;
}
.tpl-5 h1 {
  font-size: 21px;
}
.tpl-5 .epitaph {
  font-size: 10px;
}
.tpl-6 {
  --tablet-left: 23%;
  --tablet-top: 26%;
  --tablet-width: 49%;
  --altar-top: 70%;
}
.tpl-6 .memorial-tablet {
  border: 7px double #c09f56;
  box-shadow:
    0 0 0 5px #29231a,
    0 12px 24px #0008;
  background: #171b18;
}
.tpl-6 .portrait {
  border-color: #b6a46a;
}
.tpl-7 {
  --tablet-left: 12%;
  --tablet-top: 29%;
  --tablet-width: 67%;
  --altar-top: 72%;
}
.tpl-7 .memorial-tablet {
  min-height: 195px;
  text-align: left;
  padding: 18px 12px;
  background: #203233ec;
  display: grid;
  grid-template-columns: 42% 1fr;
  align-items: center;
  gap: 4px 10px;
  border: 4px double #a7b9ad;
}
.tpl-7 .portrait {
  width: 100%;
  grid-row: 1/4;
  margin: 0;
}
.tpl-7 h1 {
  font-size: 22px;
  margin: 0;
}
.tpl-7 .dates {
  font-size: 9px;
  margin: 0;
}
.tpl-7 .epitaph {
  margin: 0;
}
.tpl-7 .tablet-cap {
  display: none;
}
.tpl-8 {
  --tablet-left: 32%;
  --tablet-top: 27%;
  --tablet-width: 34%;
  --altar-top: 71%;
}
.tpl-8 .memorial-tablet {
  background: #31352c;
  border-radius: 40% 40% 0 0/10% 10% 0 0;
  border: 3px solid #b4a17d;
}
.tpl-8 .portrait {
  width: 80%;
}
.tpl-8 h1 {
  font-size: 20px;
}
.tpl-8 .dates {
  font-size: 8px;
}
.ritual-effects {
  position: absolute;
  inset: 0;
  pointer-events: none;
}
.ritual-scene {
  position: absolute;
  left: 0;
  right: 0;
  top: var(--altar-top);
  height: 17%;
}
.censer {
  position: absolute;
  width: 22%;
  height: 48%;
  left: 35%;
  bottom: 72%;
  z-index: 4;
}
.censer-bowl {
  position: absolute;
  inset: 45% 0 0;
  border-radius: 8% 8% 40% 40%;
  background: linear-gradient(
    90deg,
    #4a3725,
    #ba955c 43%,
    #725634 73%,
    #382b1d
  );
  border-top: 6px ridge #ba985f;
  box-shadow:
    inset 0 -7px 7px #352113aa,
    0 8px 8px #0005;
}
.censer-bowl:before,
.censer-bowl:after {
  content: "";
  position: absolute;
  top: -10%;
  width: 24%;
  height: 68%;
  border: 4px solid #a07d4a;
  border-radius: 40%;
  z-index: -1;
}
.censer-bowl:before {
  left: -20%;
}
.censer-bowl:after {
  right: -20%;
}
.censer-foot {
  position: absolute;
  bottom: -12%;
  width: 10%;
  height: 23%;
  background: #8c6d42;
}
.censer-foot.left {
  left: 20%;
  transform: rotate(13deg);
}
.censer-foot.right {
  right: 20%;
  transform: rotate(-13deg);
}
.incense-sticks {
  position: absolute;
  left: 22%;
  right: 22%;
  top: -98%;
  bottom: 40%;
  display: flex;
  justify-content: space-around;
  align-items: flex-end;
}
.incense-sticks i {
  display: block;
  background: linear-gradient(#ed9970 3px, #795039 4px, #c99b61);
  width: 3px;
  height: 100%;
  box-shadow: 0 -2px 5px #ed9970;
}
.incense-sticks i:first-child,
.incense-sticks i:last-child {
  height: 85%;
}
.incense-smoke {
  position: absolute;
  left: 15%;
  right: 15%;
  top: -190%;
  height: 130%;
}
.incense-smoke i {
  position: absolute;
  bottom: 0;
  left: 20%;
  width: 65%;
  height: 85%;
  border: 9px solid #e4e5d5;
  border-bottom: 0;
  border-right-color: transparent;
  border-radius: 60% 25% 60% 35%;
  filter: blur(9px);
  opacity: 0;
  animation: incense-rise 5s ease-out infinite;
}
.incense-smoke i:nth-child(2) {
  animation-delay: -1.6s;
  left: 0;
}
.incense-smoke i:nth-child(3) {
  animation-delay: -3.3s;
  left: 40%;
}
@keyframes incense-rise {
  0% {
    transform: translateY(12px) scale(0.6);
    opacity: 0;
  }
  30% {
    opacity: 0.34;
  }
  100% {
    transform: translate(15px, -65px) scale(1.7);
    opacity: 0;
  }
}
.candle {
  position: absolute;
  bottom: 80%;
  height: 59%;
  width: 4%;
  background: linear-gradient(90deg, #721d19, #deaf84 45%, #8e3323);
  border-radius: 3px 3px 0 0;
  box-shadow: 0 9px 0 -1px #a28754;
}
.candle-left {
  left: 25%;
}
.candle-right {
  left: 63%;
}
.flame {
  display: block;
  position: absolute;
  width: 15px;
  height: 25px;
  left: 50%;
  bottom: 100%;
  margin-left: -7px;
  border-radius: 50% 50% 45% 45%/65% 65% 35% 35%;
  background: radial-gradient(
    ellipse at 50% 80%,
    #fffde0 5%,
    #ffe291 40%,
    #ee9a42 67%,
    #d66226
  );
  box-shadow: 0 0 14px #edb65388;
  transform-origin: center bottom;
  animation: fire-flicker 1.15s ease-in-out infinite alternate;
}
@keyframes fire-flicker {
  0% {
    transform: rotate(-4deg) scale(0.92, 1);
  }
  50% {
    transform: rotate(3deg) scale(1.05, 0.91);
  }
  100% {
    transform: rotate(-2deg) scale(0.88, 1.13);
  }
}
.eternal-lamp {
  position: absolute;
  left: 72%;
  bottom: 91%;
  width: 11%;
  height: 61%;
  border: 3px solid #b49c58;
  border-radius: 35% 35% 10% 10%;
  background: #b69b4544;
  box-shadow: 0 0 23px #efcb4344;
}
.eternal-lamp .flame {
  bottom: 22%;
}
.eternal-lamp:after {
  content: "";
  position: absolute;
  width: 130%;
  height: 8px;
  left: -15%;
  bottom: -9px;
  background: #a48c4c;
  border-radius: 50%;
}
.flower-gift {
  position: absolute;
  left: 12%;
  width: 20%;
  bottom: 74%;
}
.wreath-gift {
  position: absolute;
  left: 70%;
  width: 24%;
  bottom: 39%;
  z-index: 3;
}
.flower-gift svg,
.wreath-gift svg {
  width: 100%;
  display: block;
}
.fruit-plate {
  position: absolute;
  left: 52%;
  bottom: 57%;
  width: 22%;
  height: 23%;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  gap: 1px;
}
.fruit-plate i {
  width: 25%;
  height: 85%;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #dbb157, #9b502d 70%);
}
.fruit-plate i:nth-child(2) {
  height: 100%;
  background: radial-gradient(circle at 35% 30%, #b8b66b, #66753a);
}
.fruit-plate b {
  position: absolute;
  height: 7px;
  background: linear-gradient(#d3c6a3, #8a7e62);
  left: -6%;
  right: -6%;
  bottom: -4px;
  border-radius: 0 0 50% 50%;
}
.floating-lantern {
  position: absolute;
  bottom: 5%;
  left: 8%;
  width: 10%;
  height: 57%;
  background: #c9a85a66;
  border: 2px solid #d9bb77;
  border-radius: 5px 5px 15px 15px;
  animation: lantern-float 4s ease-in-out infinite alternate;
}
.floating-lantern .flame {
  bottom: 20%;
  transform: scale(0.7);
}
@keyframes lantern-float {
  to {
    translate: 0 -14px;
  }
}
.paper-gift {
  position: absolute;
  bottom: 0;
  left: 34%;
  width: 15%;
  height: 20%;
  border-radius: 50%;
  background: #564128;
}
.paper-gift > i:not(.flame) {
  position: absolute;
  width: 55%;
  height: 85%;
  background: #c9ae6f;
  transform: rotate(-20deg);
}
.paper-gift > i:nth-child(2) {
  left: 30%;
  transform: rotate(28deg);
}
.ritual-rail {
  position: absolute;
  right: 9px;
  top: 16%;
  display: flex;
  flex-direction: column;
  gap: 7px;
  width: 55px;
  z-index: 6;
}
.ritual-rail button {
  min-height: 45px;
  padding: 5px 2px;
  background: #211b16e8;
  border: 1px solid #aa8d53;
  color: #f1e0bc;
  font-size: 11px;
  line-height: 1.3;
  backdrop-filter: blur(6px);
  border-radius: 6px;
}
.ritual-rail button .rail-glyph {
  display: block;
  font-size: 17px;
  margin-bottom: 1px;
  color: #d9bd7f;
}
.shrine-tools {
  position: absolute;
  bottom: 7%;
  left: 8%;
  right: 22%;
  display: flex;
  justify-content: center;
  gap: 8px;
}
.shrine-tools button {
  padding: 8px;
  font-size: 11px;
  min-height: 38px;
  background: #251c16de;
}
.visit .v03-intro {
  padding: 18px;
  margin: 0;
  border-top: 0;
}
.visit-bottom-nav {
  position: sticky;
  bottom: 0;
  z-index: 12;
  background: #201d1bf7;
  border: 1px solid #8a7650;
  display: flex;
  overflow-x: auto;
  gap: 0;
  padding: 5px 3px;
  scrollbar-width: thin;
  backdrop-filter: blur(12px);
  margin-top: 16px;
}
.visit-bottom-nav button {
  flex: 1 0 67px;
  border: 0;
  padding: 9px 4px;
  min-height: 48px;
  font-size: 11px;
  border-radius: 0;
  background: transparent;
  white-space: nowrap;
}
.visit-bottom-nav button.selected {
  color: #f8e3a9;
  border-top: 2px solid #c6a76c;
  background: #63513244;
}
.visit .tab-panel {
  margin-top: 16px;
}
.template-gallery {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}
.template-choice {
  padding: 0;
  text-align: left;
  overflow: hidden;
  background: #1d1c18;
  border: 1px solid #67593e;
}
.template-choice.selected {
  outline: 2px solid #d4b982;
}
.template-choice strong,
.template-choice small {
  display: block;
  padding: 8px 10px 0;
}
.template-choice small {
  padding-bottom: 12px;
  font-size: 10px;
}
.template-preview {
  min-height: 0;
  font-size: 6px;
  pointer-events: none;
}
.template-preview .stage-inscription {
  font-size: 5px;
  letter-spacing: 1px;
}
.template-preview .memorial-tablet {
  padding: 7px 3px 3px;
  border-width: 1px;
}
.template-preview h1 {
  font-size: 10px !important;
  letter-spacing: 0;
  margin: 3px 0;
}
.template-preview .portrait {
  margin-bottom: 5px;
  border-width: 1px;
  font-size: 20px;
}
.template-preview .dates {
  font-size: 5px !important;
}
.template-preview .epitaph {
  font-size: 5px !important;
  margin-top: 3px;
  letter-spacing: 0;
}
.template-preview.tpl-7 .memorial-tablet {
  min-height: 0;
  gap: 3px;
}
.template-preview .tablet-cap {
  height: 7px;
  top: -7px;
  border-width: 1px;
}
.template-preview .flame {
  width: 5px;
  height: 9px;
  margin-left: -2px;
}
.template-preview .incense-sticks i {
  width: 1px;
}
.template-preview .incense-smoke {
  display: none;
}
.template-preview .censer-bowl {
  border-top-width: 3px;
}
.audio-card audio {
  width: 100%;
  margin-top: 12px;
}
.category-filter {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin: 15px 0;
}
.category-filter button {
  font-size: 12px;
}
.qr-card img {
  display: block;
  max-width: 100%;
  width: 240px;
  margin: 18px auto;
}
.family-teaching {
  border-left: 3px solid #a78950;
  padding: 5px 18px;
  background: #a68e5810;
  margin: 25px 0;
}
.grave-info dd {
  margin: 4px 0 18px;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
.grave-info dt {
  color: #bda779;
}
@media (min-width: 700px) {
  .visit {
    max-width: 680px;
    margin: auto;
  }
  .shrine-stage {
    min-height: 0;
  }
  .v03-sanctuary h1 {
    font-size: 34px;
  }
  .v03-sanctuary .dates {
    font-size: 14px;
  }
  .v03-sanctuary .epitaph {
    font-size: 15px;
  }
  .ritual-rail {
    right: 20px;
    width: 69px;
    gap: 11px;
  }
  .ritual-rail button {
    min-height: 57px;
    font-size: 13px;
  }
  .ritual-rail button .rail-glyph {
    font-size: 21px;
  }
  .shrine-tools button {
    font-size: 14px;
  }
  .template-gallery {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
  .flame {
    width: 20px;
    height: 34px;
    margin-left: -10px;
  }
  .tpl-7 .memorial-tablet {
    min-height: 240px;
  }
  .tpl-3 h1,
  .tpl-5 h1,
  .tpl-8 h1 {
    font-size: 29px;
  }
  .tpl-8 .dates {
    font-size: 11px;
  }
}
@media (prefers-reduced-motion: reduce) {
  .incense-smoke i,
  .flame,
  .floating-lantern {
    animation: none !important;
  }
  .incense-smoke i {
    opacity: 0.19;
    filter: blur(9px);
  }
}
/* Narrow phones retain the available width even when the stage needs more height. */
.shrine-stage {
  width: 100%;
  max-width: 100%;
}
.tpl-3 {
  --tablet-left: 37%;
}
.wreath-gift {
  left: 5%;
  width: 23%;
  bottom: 10%;
}
.eternal-lamp {
  left: 68%;
  width: 10%;
}
.memorial-tablet h1 {
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.album > .empty {
  grid-column: 1/-1;
}
