:root {
  --ink: #173629;
  --muted: #5f6f65;
  --green: #2f6f4e;
  --green-deep: #174d35;
  --green-soft: #e8f3dc;
  --gold: #a8763a;
  --paper: #fffdf7;
  --line: #d9e1d6;
  --shadow: 0 14px 38px rgba(35, 64, 44, 0.16);
  --focus: #f7b500;
  --interactive-gold: #f7b500;
  --radius: 8px;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html {
  scroll-behavior: smooth;
  scroll-padding-top: 7rem;
}

body {
  margin: 0;
  color: var(--ink);
  background:
    radial-gradient(circle at 90% 0%, rgba(117, 158, 91, 0.18), transparent 28rem),
    linear-gradient(180deg, #fbfdf6 0%, #edf6df 52%, #f8fbf1 100%);
  font-family: "Microsoft JhengHei", "Noto Sans TC", Arial, sans-serif;
  line-height: 1.6;
}

button,
input,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.58;
}

.skip-link {
  position: fixed;
  left: 1rem;
  top: 1rem;
  z-index: 100;
  transform: translateY(-160%);
  padding: 0.75rem 1rem;
  background: var(--ink);
  color: #fff;
}

.skip-link:focus {
  transform: translateY(0);
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.site-header {
  width: min(1120px, calc(100% - 32px));
  margin: 0 auto;
  padding: 28px 0 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

body.is-home .site-header {
  position: absolute;
  top: 0;
  right: 0;
  left: 0;
  z-index: 20;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.75rem;
  color: var(--green-deep);
  font-weight: 800;
  font-size: clamp(1.25rem, 3vw, 1.75rem);
}

.brand-logo {
  display: block;
  width: 58px;
  height: auto;
}

.home-button,
.secondary-button,
.primary-button,
.photo-button,
.mode-button {
  min-height: 44px;
  border-radius: var(--radius);
  border: 2px solid transparent;
  padding: 0.68rem 1rem;
  font-weight: 700;
}

.home-button,
.secondary-button {
  background: rgba(255, 255, 255, 0.82);
  color: var(--green-deep);
  border-color: #aac7ad;
}

.secondary-button:not([data-action="go-home"]):hover,
.secondary-button:not([data-action="go-home"]):focus-visible {
  border-color: var(--interactive-gold);
  background: var(--interactive-gold);
  color: #000;
  outline: 0;
}

.site-header > .home-button {
  display: none;
}

.page-tools,
.worship-toolbar {
  position: fixed;
  top: 24px;
  right: 24px;
  z-index: 50;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 0.75rem;
}

button[data-action="go-home"] {
  position: relative;
  width: 56px;
  min-width: 56px;
  height: 56px;
  min-height: 56px;
  padding: 0;
  overflow: hidden;
  border: 3px solid rgba(255, 255, 255, 0.92);
  border-radius: 999px;
  background: linear-gradient(180deg, #95602b 0%, #714515 100%);
  color: transparent;
  box-shadow: 0 3px 0 #7c4b1d, 0 8px 18px rgba(50, 35, 17, 0.24);
  transition: transform 100ms ease, box-shadow 100ms ease, border-color 100ms ease;
}

#music-toggle {
  position: relative;
  width: 56px;
  min-width: 56px;
  height: 56px;
  min-height: 56px;
  padding: 0;
  overflow: hidden;
  border: 3px solid rgba(255, 255, 255, 0.92);
  border-radius: 999px;
  background: linear-gradient(180deg, #95602b 0%, #714515 100%);
  color: transparent;
  box-shadow: 0 3px 0 #7c4b1d, 0 8px 18px rgba(50, 35, 17, 0.24);
  transition: transform 100ms ease, box-shadow 100ms ease, border-color 100ms ease;
}

.toolbar-icon {
  position: absolute;
  top: 50%;
  left: 50%;
  display: block;
  width: 34px;
  height: 34px;
  pointer-events: none;
  transform: translate(-50%, -50%);
}

.primary-button,
.photo-button,
.mode-button {
  background: linear-gradient(180deg, #95602b 0%, #714515 100%);
  color: #fff;
  border-color: #95602b;
  text-shadow: 0 2px 4px rgba(54, 34, 13, 0.7);
}

.primary-button:hover,
.photo-button:hover,
.mode-button:hover {
  background: linear-gradient(180deg, #875522 0%, #613a13 100%);
}

main {
  min-height: 68vh;
}

.view {
  display: none;
  width: min(1120px, calc(100% - 32px));
  margin: 0 auto;
}

.view.is-active {
  display: block;
}

#home-view {
  width: 100%;
  max-width: none;
  background: linear-gradient(180deg, #f8fbf4 0%, #eef5e2 48%, #f8fbf4 100%);
}

.hero {
  min-height: 390px;
  display: flex;
  align-items: center;
  padding: 36px 0 42px;
  background-image: url("../assets/images/home/hero.png");
  background-repeat: no-repeat;
  background-position: center 66%;
  background-size: 100% auto;
}

body.is-home .hero {
  min-height: 475px;
  padding-top: 120px;
}

@media (min-width: 1200px) {
  body.is-home .hero {
    min-height: 560px;
  }
}

.hero-copy {
  width: min(1120px, calc(100% - 32px));
  margin: 0 auto;
}

.hero-copy h1 {
  margin: 0 0 0.35em;
  color: var(--green-deep);
  font-size: clamp(3.8rem, 7vw, 5.5rem);
  line-height: 1.05;
  letter-spacing: 0;
}

.hero-subtitle {
  margin: 0;
  color: #5b4a3d;
  font-size: clamp(1.2rem, 2.4vw, 1.55rem);
  font-weight: 700;
}

.hero-text {
  max-width: 34rem;
  margin: 1rem 0 0;
  color: var(--muted);
  font-size: 1.05rem;
}

.hero-divider {
  width: min(390px, 80vw);
  display: grid;
  grid-template-columns: 1fr 34px 1fr;
  align-items: center;
  gap: 0.6rem;
  margin-top: 0.9rem;
}

.hero-divider span {
  height: 1px;
  background: #c7ad84;
}

.hero-divider img {
  display: block;
  width: 34px;
  height: 34px;
}

.photo-button {
  background: linear-gradient(180deg, #347653 0%, #24573c 100%);
  border-color: #347653;
  text-shadow: none;
}

.photo-button:hover {
  background: linear-gradient(180deg, #2f684a 0%, #1f4b34 100%);
}

.entry-panel {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 1.25rem;
  width: min(1120px, calc(100% - 32px));
  margin: -58px auto 32px;
  padding: 22px;
  position: relative;
  z-index: 2;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.field-block {
  min-width: 0;
}

.field-heading {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 0.9rem;
  color: var(--green-deep);
  font-size: 1.3rem;
  font-weight: 800;
}

.field-icon {
  display: inline-grid;
  place-items: center;
  flex: 0 0 auto;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: #5d9b74;
}

.field-icon img {
  display: block;
  width: 28px;
  height: 28px;
}

.name-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 0.75rem;
}

input:not([type="checkbox"]):not([type="radio"]),
textarea {
  width: 100%;
  min-height: 48px;
  border: 2px solid #cdd8cc;
  border-radius: var(--radius);
  padding: 0.72rem 0.9rem;
  background: #fff;
  color: var(--ink);
}

textarea {
  resize: vertical;
}

.character-count {
  margin: 0.3rem 0 0;
  color: var(--muted);
  text-align: right;
}

.section-heading {
  text-align: center;
  margin: 20px auto 26px;
}

.section-heading h1,
.section-heading h2 {
  margin: 0 0 0.35rem;
  color: var(--green-deep);
  font-size: clamp(1.75rem, 4vw, 2.2rem);
  line-height: 1.25;
}

.section-heading p {
  margin: 0;
  color: var(--muted);
}

.location-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1.15rem 1.45rem;
}

.location-section {
  width: min(1120px, calc(100% - 32px));
  margin: 0 auto;
  padding-bottom: 2.5rem;
}

.location-card {
  position: relative;
  min-height: 0;
  aspect-ratio: 16 / 9;
  overflow: hidden;
  border: 0;
  border-radius: var(--radius);
  background: #e9efe5;
  color: #fff;
  text-align: left;
  box-shadow: 0 7px 18px rgba(26, 53, 38, 0.12);
}

.location-card img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 180ms ease;
}

.location-card::after {
  content: "";
  position: absolute;
  right: 0;
  bottom: 0;
  left: 0;
  height: 40%;
  background: rgba(0, 0, 0, 0.6);
}

.location-card:hover img,
.location-card:focus-visible img {
  transform: scale(1.04);
}

.location-card-content {
  position: relative;
  z-index: 1;
  min-height: 100%;
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.85rem 0.9rem;
}

.location-label {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 0.45rem;
}

.location-icon {
  position: static !important;
  flex: 0 0 auto;
  width: 26px !important;
  height: 26px !important;
  object-fit: contain !important;
}

.location-name {
  font-size: 1.1rem;
  font-weight: 900;
  line-height: 1.35;
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.55);
}

.location-arrow {
  display: inline-grid;
  place-items: center;
  flex: 0 0 auto;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.92);
  color: var(--green-deep);
}

.location-arrow img {
  position: static !important;
  width: 25px !important;
  height: 25px !important;
  object-fit: contain !important;
}

.page-tools,
.worship-toolbar {
  display: flex;
  justify-content: space-between;
  gap: 0.75rem;
  margin: 10px 0 18px;
}

.area-tabs {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-bottom: 1rem;
}

.area-tab {
  min-height: 48px;
  padding: 0.65rem 1rem;
  border-radius: 999px;
  border: 2px solid #9fc29d;
  background: #fff;
  color: var(--green-deep);
  font-weight: 800;
}

.area-tab[aria-pressed="true"] {
  background: var(--green-deep);
  color: #fff;
  border-color: var(--green-deep);
}

.area-tab:hover,
.area-tab:focus-visible {
  border-color: var(--interactive-gold);
  background: var(--interactive-gold);
  color: #000;
  outline: 0;
}

.area-tab:active {
  border-color: var(--focus);
  transform: translateY(3px);
}

.map-layout {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
  width: min(100%, 900px);
  margin: 0 auto;
}

.map-card {
  background: rgba(255, 255, 255, 0.92);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.map-card {
  padding: 0.85rem;
}

.map-stage {
  position: relative;
  overflow: hidden;
  border-radius: var(--radius);
  background: #eef4e8;
}

.map-stage img {
  width: 100%;
  display: block;
}

.map-point {
  position: absolute;
  display: flex;
  align-items: center;
  justify-content: center;
  transform: translate(-50%, -50%);
  min-width: 44px;
  min-height: 44px;
  border: 0;
  padding: 0;
  background: transparent;
  color: var(--green-deep);
  font-weight: 900;
  transition: transform 120ms ease;
}

.map-point-label {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 44px;
  min-height: 44px;
  padding: 0.35rem 0.65rem;
  border: 3px solid var(--green-deep);
  border-radius: 999px;
  background: #fff;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.22);
  white-space: nowrap;
  transition: border-color 160ms ease, background-color 160ms ease, transform 160ms ease;
}

.map-point.is-compact-point .map-point-label {
  min-width: 34px;
  min-height: 34px;
  padding: 0.2rem 0.4rem;
  font-size: 0.86rem;
}

.map-point:hover .map-point-label,
.map-point:focus-visible .map-point-label {
  border-color: var(--interactive-gold);
  background: var(--interactive-gold);
  color: #000;
}

.map-point:focus-visible {
  outline: 0;
}

.map-point:active {
  transform: translate(-50%, calc(-50% + 3px));
}

.map-point.is-label-point {
  min-width: 0;
  transform: translate(0, -50%);
}

.map-point.is-label-point:active {
  transform: translate(0, calc(-50% + 3px));
}

.selection-panel {
  padding: 0.25rem 0 0;
}

.selection-panel h2 {
  margin: 0 0 0.6rem;
  color: var(--green-deep);
  font-size: 1.15rem;
}

.position-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
}

.position-button {
  min-height: 44px;
  width: auto;
  border: 2px solid #b9cdb8;
  border-radius: var(--radius);
  background: #fff;
  color: var(--ink);
  text-align: center;
  padding: 0.5rem 0.85rem;
  font-weight: 700;
  transition: border-color 160ms ease, background-color 160ms ease, transform 120ms ease;
}

.position-button:hover,
.position-button:focus-visible {
  border-color: var(--interactive-gold);
  outline: 0;
  background: var(--interactive-gold);
  color: #000;
}

.position-button:active {
  border-color: var(--focus);
  transform: translateY(3px);
}

.worship-shell {
  margin-bottom: 2rem;
}

.worship-preview,
.worship-stage {
  position: relative;
  overflow: hidden;
  width: min(100%, 800px);
  aspect-ratio: 4 / 3;
  margin: 0 auto;
  border-radius: var(--radius);
  background-color: #eef4e8;
  background-size: cover;
  background-position: center;
  box-shadow: var(--shadow);
}

.worship-stage {
  background-color: transparent;
  border-radius: 26px;
  clip-path: inset(0 round 26px);
  isolation: isolate;
  box-shadow: none;
}

.worship-preview {
  background-color: transparent;
  border-radius: 26px;
  clip-path: inset(0 round 26px);
  isolation: isolate;
  box-shadow: none;
}

.panorama-viewport {
  position: absolute;
  inset: 0;
  z-index: 0;
  overflow: hidden;
  border-radius: inherit;
  clip-path: inset(0 round 26px);
  transform: translateZ(0);
}

.panorama-frame {
  position: absolute;
  inset: 0;
  z-index: 0;
  width: 100%;
  height: 100%;
  border: 0;
  border-radius: 26px;
  clip-path: inset(0 round 26px);
  pointer-events: none;
}

body.is-panorama-mode {
  overflow: hidden;
}

.worship-stage.is-panorama-interactive {
  position: fixed;
  inset: 16px;
  z-index: 90;
  width: auto;
  height: auto;
  max-width: none;
  aspect-ratio: auto;
  margin: 0;
  background: #101512;
}

.worship-stage.is-panorama-interactive .panorama-frame {
  pointer-events: auto;
}

.worship-stage.is-panorama-interactive > :not(.panorama-viewport) {
  visibility: hidden;
}

.worship-preview::before,
.worship-stage::before {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at center 42%, transparent 34%, rgba(255, 255, 255, 0.72) 80%);
  pointer-events: none;
}

.worship-stage::before {
  display: none;
}

.worship-preview::before {
  display: none;
}

.mode-buttons {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 2rem;
  padding: 1rem;
  z-index: 6;
}

.mode-button {
  width: min(36%, 230px);
  min-height: 128px;
  font-size: clamp(1.35rem, 4vw, 2rem);
  box-shadow: 0 10px 24px rgba(28, 39, 31, 0.22);
  transition: transform 100ms ease, box-shadow 100ms ease, border-color 100ms ease, background 100ms ease;
}

.legacy-stage-assets {
  position: absolute;
  inset: 0;
  z-index: 1;
  pointer-events: none;
}

.legacy-stage-assets::before {
  display: none;
}

.sprite {
  position: absolute;
  background-repeat: no-repeat;
  background-size: 100% 100%;
}

.sprite-table {
  left: 3.125%;
  top: 78%;
  width: 93.875%;
  height: 22%;
  z-index: 1;
  background-image: url("../assets/ritual/table.png");
}

.sprite-plaque-bg {
  left: 50%;
  top: 72%;
  width: 55.875%;
  height: 14.5%;
  z-index: 4;
  transform: translateX(-50%);
  background-image: url("../assets/ritual/plaque.png");
}

.sprite-urn {
  display: none;
  left: 50%;
  top: 35.333%;
  width: 27.875%;
  height: 52.667%;
  z-index: 2;
  transform: translateX(-50%);
  background-image: url("../assets/ritual/incense-burner.png");
}

.sprite-urn-front {
  display: none;
  left: 50%;
  top: 35.333%;
  width: 27.875%;
  height: 52.667%;
  z-index: 3;
  transform: translateX(-50%);
  clip-path: inset(60.5% 0 0 0);
  background-image: url("../assets/ritual/incense-burner.png");
}

.sprite-incense-stick {
  display: none;
  left: 50%;
  top: 34%;
  width: 1.25%;
  height: 37%;
  z-index: 3;
  transform: translateX(-50%);
  background-image: url("../assets/ritual/incense-stick.png");
}

.sprite-flower {
  display: none;
  top: 51%;
  width: 20.75%;
  height: 32.833%;
  z-index: 3;
  background-image: url("../assets/ritual/flower-bouquet.png");
}

.sprite-flower-left {
  left: 7.625%;
}

.sprite-flower-right {
  right: 7.875%;
}

.worship-stage.is-traditional .sprite-urn,
.worship-stage.is-traditional .sprite-urn-front,
.worship-stage.has-incense .sprite-urn,
.worship-stage.has-incense .sprite-urn-front {
  display: block;
}

.worship-stage.has-flower .sprite-flower {
  display: block;
}

.worship-stage.has-incense .sprite-incense-stick {
  display: block;
}

.legacy-plaque {
  position: absolute;
  z-index: 4;
  left: 50%;
  top: 72%;
  width: 55.875%;
  height: 14.5%;
  transform: translateX(-50%);
  display: grid;
  place-items: center;
  pointer-events: none;
}

.name-plaque {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 0.35rem 0.75rem;
  color: #21412f;
  background: transparent;
  border: 0;
  font-weight: 900;
  font-size: clamp(0.68rem, 2.4vw, 1.3rem);
  line-height: 1.25;
  text-align: center;
  overflow-wrap: anywhere;
}

.photo-frame {
  position: absolute;
  z-index: 2;
  left: 50%;
  top: 6%;
  transform: translateX(-50%);
  width: clamp(96px, 18vw, 170px);
  aspect-ratio: 1;
  padding: 6px;
  background: rgba(255, 255, 255, 0.96);
  border: 2px solid #d4c59c;
  border-radius: var(--radius);
  box-shadow: 0 8px 20px rgba(27, 45, 33, 0.22);
}

.photo-frame img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 4px;
}

.stage-message {
  position: absolute;
  z-index: 2;
  left: 50%;
  top: calc(6% + clamp(96px, 18vw, 170px) + 14px);
  width: min(78%, 600px);
  transform: translateX(-50%);
  margin: 0;
  padding: clamp(0.3rem, 1vw, 0.55rem) clamp(0.5rem, 1.5vw, 0.9rem);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.88);
  color: #25352c;
  text-align: center;
  font-size: clamp(0.72rem, 2vw, 1rem);
  line-height: 1.45;
  font-weight: 700;
  box-shadow: 0 6px 16px rgba(27, 45, 33, 0.14);
}

.stage-message.without-photo {
  top: 12%;
}

.ritual-animation {
  position: absolute;
  z-index: 5;
  display: none;
  pointer-events: none;
  background-repeat: no-repeat;
  background-size: 100% 100%;
  transform-origin: center center;
}

.ritual-animation.is-flower,
.ritual-animation.is-pray,
.ritual-animation.is-folded-pray,
.ritual-animation.is-incense {
  display: block;
  filter: drop-shadow(0 8px 12px rgba(0, 0, 0, 0.2));
}

.worship-stage:not(.is-animating) .ritual-animation {
  display: none !important;
}

.ritual-animation.is-flower {
  left: 50%;
  top: 51%;
  width: 20.75%;
  height: 32.833%;
  background-image: url("../assets/ritual/flower-bouquet.png");
  animation: flowerOffer 1600ms ease-in-out both;
}

.ritual-animation.is-pray {
  left: 50%;
  top: 18.333%;
  width: 30.8%;
  height: 42.467%;
  background-image: url("../assets/ritual/praying-hands.png");
  animation: worshipBow 2100ms ease-in-out both;
}

.ritual-animation.is-folded-pray {
  left: 50%;
  top: 18.333%;
  width: 30.8%;
  height: 42.467%;
  background-image: url("../assets/ritual/folded-hands.png");
  animation: prayerPause 2100ms ease-in-out both;
}

.ritual-animation.is-incense {
  left: 50%;
  top: 12%;
  width: 30.8%;
  height: 53.667%;
  background-image: url("../assets/ritual/incense-hands.png");
  animation: worshipBow 2100ms ease-in-out both;
}

@keyframes flowerOffer {
  0% {
    opacity: 0;
    transform: translate(-50%, 18%);
  }
  18%,
  72% {
    opacity: 1;
    transform: translate(-50%, 0);
  }
  100% {
    opacity: 0;
    transform: translate(-50%, 12%);
  }
}

@keyframes worshipBow {
  0% {
    opacity: 0;
    transform: translate(-50%, 0);
  }
  8%,
  14% {
    opacity: 1;
    transform: translate(-50%, 0);
  }
  24% {
    transform: translate(-50%, 7%);
  }
  34% {
    transform: translate(-50%, 0);
  }
  46% {
    transform: translate(-50%, 7%);
  }
  56% {
    transform: translate(-50%, 0);
  }
  68% {
    transform: translate(-50%, 7%);
  }
  78%,
  92% {
    opacity: 1;
    transform: translate(-50%, 0);
  }
  100% {
    opacity: 0;
    transform: translate(-50%, 0);
  }
}

@keyframes prayerPause {
  0% {
    opacity: 0;
    transform: translate(-50%, 0);
  }
  15%,
  82% {
    opacity: 1;
    transform: translate(-50%, 0);
  }
  100% {
    opacity: 0;
    transform: translate(-50%, 0);
  }
}

.status-line {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.ritual-actions {
  width: min(100%, 800px);
  margin: 0.9rem auto 1.5rem;
  position: relative;
  z-index: 10;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.75rem;
  padding: 0 24px;
}

.ritual-actions.is-western {
  grid-template-columns: repeat(3, minmax(0, 190px));
  justify-content: center;
}

.panorama-actions {
  position: relative;
  z-index: 10;
  display: flex;
  justify-content: center;
  width: min(100%, 800px);
  margin: -0.55rem auto 1.5rem;
  padding: 0 24px;
}

.panorama-action {
  width: min(100%, 190px);
  padding: 0.65rem 1rem;
}

body.is-panorama-mode .panorama-actions {
  position: fixed;
  top: 24px;
  right: 96px;
  z-index: 100;
  width: auto;
  margin: 0;
  padding: 0;
}

body.is-panorama-mode .panorama-action {
  width: auto;
  min-width: 180px;
}

.ritual-action {
  min-height: 48px;
  min-width: 0;
  border: 2px solid #d2aa72;
  border-radius: var(--radius);
  background: linear-gradient(180deg, #95602b 0%, #714515 100%);
  color: #fff;
  font-size: 1rem;
  font-weight: 900;
  text-shadow: 0 2px 4px rgba(54, 34, 13, 0.7);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.35), 0 3px 0 #724719;
  transition: transform 100ms ease, box-shadow 100ms ease, border-color 100ms ease, background 100ms ease;
}

.ritual-action:hover {
  background: linear-gradient(180deg, #875522 0%, #613a13 100%);
}

.finish-image-wrap {
  width: min(100%, 800px);
  margin: 1rem auto 2rem;
}

.finish-image {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 4 / 3;
  object-fit: contain;
}

.site-footer {
  margin-top: 3rem;
  padding: 1.5rem 1rem;
  color: #6b6f69;
  text-align: center;
  background: rgba(255, 255, 255, 0.72);
  border-top: 1px solid var(--line);
}

.dialog-backdrop {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: grid;
  place-items: center;
  padding: 1rem;
  background: rgba(5, 20, 12, 0.58);
}

.dialog {
  width: min(560px, 100%);
  max-height: min(720px, calc(100vh - 32px));
  overflow: auto;
  background: var(--paper);
  border-radius: var(--radius);
  box-shadow: 0 24px 54px rgba(0, 0, 0, 0.32);
}

.dialog.dialog--select-photo {
  width: min(760px, 100%);
}

.dialog-header,
.dialog-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 1rem;
  border-bottom: 1px solid var(--line);
}

.dialog-actions {
  border-top: 1px solid var(--line);
  border-bottom: 0;
  justify-content: end;
}

.dialog h2 {
  margin: 0;
  color: var(--green-deep);
}

.icon-button {
  min-width: 44px;
  min-height: 44px;
  border: 2px solid transparent;
  border-radius: 50%;
  background: #eef4e8;
  color: var(--ink);
  font-size: 1.75rem;
  line-height: 1;
}

.dialog-body {
  display: grid;
  gap: 0.5rem;
  padding: 1rem;
}

.dialog-body label {
  margin-top: 0.55rem;
  color: var(--green-deep);
  font-weight: 800;
}

.dialog-status {
  min-height: 1.6em;
  color: var(--muted);
}

.field-hint {
  margin: 0;
  color: var(--muted);
  font-size: 0.92rem;
  line-height: 1.5;
}

.photo-select-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 160px));
  gap: 0.85rem;
}

.photo-select-item {
  display: grid;
  gap: 0.45rem;
  margin: 0;
  padding: 0.55rem;
  border: 2px solid var(--line);
  border-radius: 12px;
  background: #fff;
  cursor: pointer;
  overflow: hidden;
  min-width: 0;
  max-width: 160px;
}

.photo-select-item:has(input:checked) {
  border-color: var(--green);
  box-shadow: 0 0 0 2px rgba(52, 118, 83, 0.18);
}

.photo-select-item img {
  display: block;
  width: 100%;
  max-width: 100%;
  aspect-ratio: 3 / 4;
  object-fit: cover;
  border-radius: 8px;
  background: #f3f3f3;
}

.photo-select-item span {
  color: var(--green-deep);
  font-size: 0.95rem;
  font-weight: 700;
  text-align: center;
}

.photo-select-item input[type="checkbox"],
.photo-select-item input[type="radio"] {
  justify-self: center;
  width: 22px;
  height: 22px;
  min-width: 22px;
  min-height: 22px;
  margin: 0;
  padding: 0;
  border: 2px solid #cdd8cc;
  border-radius: 4px;
  accent-color: var(--green);
  cursor: pointer;
}

.session-photo-panel {
  position: relative;
  z-index: 3;
  width: min(1120px, calc(100% - 32px));
  margin: 0 auto 16px;
  padding: 22px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.session-photo-panel:not([hidden]) + .entry-panel {
  margin-top: 0;
}

.session-photo-panel .section-heading {
  margin-bottom: 1rem;
}

.session-photo-panel .section-heading h2 {
  margin: 0 0 0.35rem;
  color: var(--green-deep);
  font-size: 1.35rem;
}

.session-photo-panel .section-heading p {
  margin: 0;
  color: var(--muted);
}

/* Keep the keyboard focus treatment consistent across form controls and cards. */
:where(a, button, input, textarea, select):focus-visible {
  outline: 5px solid #f7b500;
  outline-offset: 3px;
}

.location-card:hover,
.location-card:focus-visible {
  z-index: 3;
  outline: 5px solid #f7b500;
  outline-offset: 4px;
  box-shadow: 0 10px 24px rgba(26, 53, 38, 0.24);
}

.primary-button:hover,
.primary-button:focus-visible,
.mode-button:hover,
.mode-button:focus-visible {
  border-color: #613a13;
  background: linear-gradient(180deg, #875522 0%, #613a13 100%);
  color: #fff;
  outline: 0;
  box-shadow: inset 0 0 0 3px #f7b500, 0 10px 24px rgba(28, 39, 31, 0.22);
}

.ritual-action:hover,
.ritual-action:focus-visible {
  border-color: #613a13;
  background: linear-gradient(180deg, #875522 0%, #613a13 100%);
  color: #fff;
  outline: 0;
  box-shadow: inset 0 0 0 3px #f7b500, 0 3px 0 #724719;
}

.mode-button:active,
.ritual-action:active {
  border-color: #f7b500;
  transform: translateY(4px);
}

.mode-button:active {
  box-shadow: 0 3px 8px rgba(28, 39, 31, 0.2);
}

.ritual-action:active {
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.24), 0 0 0 #724719;
}

button[data-action="go-home"]:hover,
button[data-action="go-home"]:focus-visible,
#music-toggle:hover,
#music-toggle:focus-visible {
  border-color: #613a13;
  background: linear-gradient(180deg, #875522 0%, #613a13 100%);
  outline: 0;
  box-shadow: inset 0 0 0 3px #f7b500, 0 3px 0 #7c4b1d, 0 8px 18px rgba(50, 35, 17, 0.24);
}

button[data-action="go-home"]:active,
#music-toggle:active {
  border-color: #f7b500;
  transform: translateY(4px);
  box-shadow: 0 0 0 #7c4b1d, 0 3px 8px rgba(50, 35, 17, 0.22);
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

@media (max-width: 900px) {
  .entry-panel {
    grid-template-columns: 1fr;
  }

  .hero {
    min-height: 360px;
    background-position: 58% center;
    background-size: cover;
  }

  body.is-home .hero {
    min-height: 440px;
    padding-top: 104px;
  }

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

  .ritual-actions {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    padding: 0 4rem;
  }

  .ritual-actions.is-western {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 620px) {
  .site-header {
    align-items: start;
    flex-direction: column;
  }

  .hero {
    min-height: 330px;
    padding-top: 18px;
    background-position: 62% center;
    background-size: auto 100%;
  }

  body.is-home .hero {
    min-height: 410px;
    padding-top: 92px;
  }

  .hero-copy h1 {
    font-size: clamp(2.5rem, 16vw, 4rem);
  }

  .hero-text {
    display: inline-block;
    max-width: min(100%, 27rem);
    padding: 0.45rem 0.65rem;
    background: rgba(255, 255, 255, 0.78);
    border: 1px solid rgba(255, 255, 255, 0.95);
    border-radius: 8px;
    font-size: 0.95rem;
    line-height: 1.65;
  }

  .entry-panel {
    padding: 16px;
  }

  .name-row {
    grid-template-columns: 1fr;
  }

  .photo-button,
  .primary-button,
  .secondary-button {
    width: 100%;
  }

  button[data-action="go-home"],
  #music-toggle {
    width: 48px;
    min-width: 48px;
    height: 48px;
    min-height: 48px;
    border-width: 2px;
  }

  .toolbar-icon {
    width: 28px;
    height: 28px;
  }

  .location-grid {
    grid-template-columns: 1fr;
  }

  .location-card,
  .location-card-content {
    min-height: 170px;
  }

  .map-point-label {
    transform: scale(0.72);
    font-size: 0.78rem;
    transform-origin: center;
  }

  .map-point.is-label-point .map-point-label {
    transform-origin: left center;
  }

  .mode-buttons {
    flex-direction: column;
    gap: 0.9rem;
  }

  .mode-button {
    width: min(84%, 300px);
    min-height: 82px;
  }

  .stage-message {
    left: 50%;
    width: 72%;
    top: calc(6% + clamp(96px, 24vw, 140px) + 10px);
    font-size: 0.78rem;
  }

  .legacy-plaque {
    left: 50.8%;
  }

  .photo-frame {
    width: clamp(92px, 24vw, 138px);
  }

  .ritual-actions {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    margin-top: 0.9rem;
    padding: 0;
  }

  .ritual-actions.is-western {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .ritual-actions.is-western .ritual-action:last-child {
    grid-column: 1 / -1;
    width: calc(50% - 0.375rem);
    justify-self: center;
  }

  .dialog-actions,
  .worship-toolbar {
    flex-direction: column;
  }

  .finish-image-wrap {
    margin-top: 0.5rem;
  }

  .worship-stage.is-panorama-interactive {
    inset: 8px;
  }

  body.is-panorama-mode .panorama-actions {
    top: 88px;
    right: 16px;
  }

  body.is-panorama-mode .panorama-action {
    min-width: 150px;
  }
}
