.app-shell {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  min-height: 100dvh;
  position: relative;
}

.app-main {
  flex: 1;
  position: relative;
  z-index: var(--z-base);
}

body.modal-is-open .anchor-nav,
body.drawer-is-open .anchor-nav {
  opacity: 0;
  pointer-events: none;
}

.app-header {
  position: relative;
  z-index: var(--z-overlay);
  background: #000;
  border-bottom: 1px solid rgba(212, 175, 55, 0.25);
}

.app-header__inner {
  max-width: var(--container-wide);
  margin: 0 auto;
  padding: 0.35rem var(--space-lg);
  display: flex;
  align-items: center;
  gap: var(--space-md);
  position: relative;
}

.app-header__icons {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  margin-left: auto;
}

.app-header__icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  padding: 0;
  background: transparent;
  border: none;
  color: var(--color-paper);
  text-decoration: none;
  cursor: pointer;
}

.app-header__icon-btn svg {
  width: 22px;
  height: 22px;
}

.app-header__text-brand {
  display: inline-flex;
  align-items: center;
  text-decoration: none;
  line-height: 0;
}

.app-header__logo-img {
  display: block;
  height: 44px;
  width: auto;
  object-fit: contain;
}

@media (max-width: 767px) {
  .app-header__logo-img { height: 32px; }
}

.app-header__hamburger {
  display: none;
  width: 44px;
  height: 44px;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 5px;
  background: transparent;
  border: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
  padding: 0;
  transition: background var(--t-fast) ease;
}

.app-header__hamburger:hover {
  background: rgba(212, 175, 55, 0.12);
}

.app-header__share {
  display: none;
  width: 44px;
  height: 44px;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: none;
  border-radius: var(--radius-sm);
  color: var(--color-paper);
  cursor: pointer;
  padding: 0;
  transition: background var(--t-fast) ease, color var(--t-fast) ease;
}

.app-header__share:hover {
  background: rgba(212, 175, 55, 0.12);
  color: var(--color-temple-gold);
}

.app-header__share svg {
  width: 22px;
  height: 22px;
}

.app-header__hamburger-bar {
  display: block;
  width: 20px;
  height: 2px;
  background: var(--color-paper);
  border-radius: 1px;
  transition: transform var(--t-base) ease, opacity var(--t-fast) ease;
}

body.drawer-is-open .app-header__hamburger-bar:nth-child(1) {
  transform: translateY(7px) rotate(45deg);
}
body.drawer-is-open .app-header__hamburger-bar:nth-child(2) {
  opacity: 0;
}
body.drawer-is-open .app-header__hamburger-bar:nth-child(3) {
  transform: translateY(-7px) rotate(-45deg);
}

.drawer-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.65);
  backdrop-filter: blur(3px);
  z-index: calc(var(--z-modal) - 1);
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--t-base) ease;
}

body.drawer-is-open .drawer-overlay {
  opacity: 1;
  pointer-events: auto;
}

.drawer {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
  height: 100dvh;
  z-index: var(--z-modal);
  display: flex;
  flex-direction: column;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 0.2s ease, visibility 0s linear 0.2s;
  background:
    linear-gradient(180deg, rgba(5, 10, 20, 0.85) 0%, rgba(10, 25, 41, 0.92) 50%, rgba(5, 10, 20, 0.95) 100%),
    radial-gradient(ellipse 60% 40% at 50% 50%, rgba(192, 57, 43, 0.18) 0%, transparent 70%);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

body.drawer-is-open .drawer {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  transition: opacity 0.2s ease, visibility 0s;
}

.drawer::before {
  content: '永劫 × 鎮瀾宮';
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-serif);
  font-size: clamp(3rem, 12vw, 6rem);
  font-weight: 900;
  color: rgba(212, 175, 55, 0.06);
  letter-spacing: 0.15em;
  pointer-events: none;
  white-space: nowrap;
  user-select: none;
}

.drawer::after {
  content: '';
  position: absolute;
  top: 64px;
  left: 10%;
  right: 10%;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(212, 175, 55, 0.5), transparent);
  pointer-events: none;
}

.drawer__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-md) var(--space-lg);
  position: relative;
  z-index: 2;
}

.drawer__title {
  font-family: var(--font-serif);
  font-size: 1rem;
  font-weight: 700;
  color: var(--color-temple-gold);
  letter-spacing: 0.3em;
  opacity: 0;
  transition: opacity 0.2s ease;
}

body.drawer-is-open .drawer__title {
  opacity: 1;
}

.drawer__close {
  width: 44px;
  height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  color: var(--color-text-soft);
  background: transparent;
  border: 1px solid rgba(212, 175, 55, 0.3);
  border-radius: 50%;
  cursor: pointer;
  transition: all var(--t-fast) ease;
  opacity: 0;
  transform: rotate(-90deg);
}

.drawer__close svg {
  width: 18px;
  height: 18px;
  display: block;
}

body.drawer-is-open .drawer__close {
  opacity: 1;
  transform: rotate(0);
  transition: opacity 0.22s ease 0s, transform 0.28s cubic-bezier(0.4, 0, 0.2, 1) 0s, color var(--t-fast) ease, background var(--t-fast) ease, border-color var(--t-fast) ease;
}

.drawer__close:hover {
  color: var(--color-paper);
  background: rgba(212, 175, 55, 0.15);
  border-color: var(--color-temple-gold);
}

.drawer__list {
  list-style: none;
  margin: 0;
  padding: var(--space-xl) clamp(2rem, 8vw, 5rem) var(--space-lg);
  flex: 1;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  justify-content: center;
  gap: 0;
  position: relative;
  z-index: 2;
  max-width: 520px;
}

.drawer__list > li {
  opacity: 0;
  margin-left: 80px;
  transition:
    opacity 0.32s ease,
    margin-left 0.32s ease;
}

body.drawer-is-open .drawer__list > li {
  opacity: 1;
  margin-left: 0;
}

body.drawer-is-open .drawer__list > li:nth-child(1) { transition-delay: 0s; }
body.drawer-is-open .drawer__list > li:nth-child(2) { transition-delay: 0.06s; }
body.drawer-is-open .drawer__list > li:nth-child(3) { transition-delay: 0.12s; }
body.drawer-is-open .drawer__list > li:nth-child(4) { transition-delay: 0.18s; }
body.drawer-is-open .drawer__list > li:nth-child(5) { transition-delay: 0.24s; }
body.drawer-is-open .drawer__list > li:nth-child(6) { transition-delay: 0.3s; }
body.drawer-is-open .drawer__list > li:nth-child(7) { transition-delay: 0.36s; }

.drawer__list > li:not(.drawer__divider) {
  border-bottom: 1px solid rgba(212, 175, 55, 0.15);
}

.drawer__list > li:not(.drawer__divider):last-of-type {
  border-bottom: none;
}

.drawer__divider {
  display: none;
}

.drawer__link {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  width: 100%;
  padding: 1.1rem 0.5rem;
  font-family: var(--font-serif);
  font-size: 1.05rem;
  color: var(--color-paper);
  letter-spacing: 0.2em;
  background: transparent;
  border: none;
  text-decoration: none;
  cursor: pointer;
  text-align: left;
  position: relative;
  transition: color var(--t-fast) ease, padding-left var(--t-base) ease, background var(--t-fast) ease;
}

.drawer__link svg {
  width: 20px;
  height: 20px;
  color: var(--color-temple-gold);
  flex-shrink: 0;
  opacity: 0.85;
  transition: opacity var(--t-fast) ease, transform var(--t-fast) ease;
}

.drawer__link:hover {
  color: var(--color-temple-gold);
  text-decoration: none;
  background: transparent;
  padding-left: 1rem;
}

.drawer__link:hover svg {
  opacity: 1;
  transform: translateX(2px);
}

.drawer__link--external {
  color: var(--color-temple-gold);
}

.drawer__footer {
  padding: var(--space-md) var(--space-lg) var(--space-xl);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-sm);
  text-align: center;
  position: relative;
  z-index: 2;
  opacity: 0;
  transition: opacity 0.32s ease 0.42s;
}

body.drawer-is-open .drawer__footer {
  opacity: 1;
}

.drawer__follow-label {
  font-family: var(--font-serif);
  font-size: 0.85rem;
  color: var(--color-text-soft);
  letter-spacing: 0.3em;
}

.drawer__socials {
  list-style: none;
  margin: 0;
  padding: 0;
  display: inline-flex;
  gap: var(--space-md);
}

.drawer__social {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  border: 1px solid rgba(212, 175, 55, 0.35);
  border-radius: 50%;
  color: var(--color-paper);
  opacity: 0.9;
  transition: all var(--t-fast) ease;
}

.drawer__social svg {
  width: 20px;
  height: 20px;
  display: block;
}

.drawer__social:hover {
  background: rgba(212, 175, 55, 0.15);
  border-color: var(--color-temple-gold);
  color: var(--color-temple-gold);
  opacity: 1;
  transform: translateY(-2px);
}

.drawer__brand {
  font-family: var(--font-serif);
  font-size: 0.75rem;
  color: var(--color-text-soft);
  letter-spacing: 0.3em;
  margin-top: 0.5rem;
}

.drawer-overlay {
  display: none;
}

.app-footer {
  position: relative;
  z-index: var(--z-base);
  background: #000;
  padding: var(--space-lg);
  font-family: var(--font-sans);
  color: rgba(255, 255, 255, 0.85);
}

.app-footer__inner {
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: var(--space-lg);
}

.footer-main {
  flex-direction: row;
  align-items: center;
  justify-content: center;
  gap: var(--space-md);
  flex-wrap: nowrap;
  max-width: none;
}

@media (max-width: 1023px) {
  .footer-main {
    flex-direction: column;
    gap: var(--space-md);
  }
}

.footer-logo {
  display: block;
  height: auto;
}
.footer-logo--ican { max-height: 48px; }
.footer-logo--ent24 { max-height: 52px; }
.footer-logo--age15 { max-height: 60px; }

.footer-ican-copy {
  font-size: 0.72rem;
  color: rgba(255, 255, 255, 0.75);
  letter-spacing: 0.04em;
  white-space: nowrap;
}

.footer-age15 {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.footer-legal {
  text-align: left;
  font-size: 0.72rem;
  line-height: 1.65;
  color: rgba(255, 255, 255, 0.75);
  max-width: 640px;
}

.footer-legal p {
  margin: 0 0 0.1rem;
}

.footer-legal__notes {
  list-style: decimal;
  padding-left: 1.4em;
  margin: 0 0 0.1rem;
}

.footer-legal__notes li {
  margin-bottom: 0.1rem;
}

.footer-legal a {
  color: rgba(255, 255, 255, 0.85);
  text-decoration: underline;
}

.footer-legal a:hover {
  color: var(--color-temple-gold);
}

.footer-row--top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-bottom: var(--space-sm);
  border-bottom: 1px solid rgba(255, 255, 255, 0.18);
}

.footer-row__contact {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  line-height: 1;
  font-family: var(--font-sans);
  font-size: 1rem;
  font-weight: 700;
  color: #fff;
  letter-spacing: 0.1em;
  background: transparent;
  border: none;
  padding: 11px 0;
  cursor: pointer;
  transition: opacity var(--t-fast) ease;
}

.footer-row__contact:hover {
  opacity: 0.75;
}

.footer-row__follow {
  display: inline-flex;
  align-items: center;
  gap: 0.85rem;
}

.footer-row__follow-label {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  line-height: 1;
  font-family: var(--font-sans);
  font-size: 1rem;
  font-weight: 700;
  color: #fff;
  letter-spacing: 0.1em;
  margin-right: -0.1em;
}

.follow-icons {
  display: inline-flex;
  align-items: center;
  list-style: none;
  margin: 0;
  padding: 0;
  gap: 0.5rem;
  line-height: 1;
}

.follow-icons li {
  display: inline-flex;
  align-items: center;
  line-height: 1;
}

.follow-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  color: #fff;
  opacity: 0.85;
  transition: opacity var(--t-fast) ease, transform var(--t-fast) ease;
}

.follow-icon svg {
  width: 22px;
  height: 22px;
}

.follow-icon:hover {
  opacity: 1;
  transform: translateY(-1px);
}

.footer-row--tech {
  display: flex;
  justify-content: center;
  padding: var(--space-md) 0;
}

.tech-logos {
  display: flex;
  list-style: none;
  margin: 0;
  padding: 0;
  gap: var(--space-xl);
  align-items: center;
  flex-wrap: wrap;
  justify-content: center;
}

.tech-logo {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 36px;
  color: #fff;
  opacity: 0.95;
  transition: opacity var(--t-fast) ease;
}

.tech-logo img,
.tech-logo svg {
  height: 32px;
  width: auto;
  max-width: 140px;
  object-fit: contain;
  display: block;
}

.tech-logo__fallback {
  font-family: Arial, sans-serif;
  font-weight: 700;
  font-size: 0.95rem;
  color: #fff;
  letter-spacing: 0.05em;
}

.tech-logo:hover {
  opacity: 1;
}

.footer-row--bottom {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: var(--space-xl);
  align-items: flex-start;
  padding-top: var(--space-md);
}

.footer-publishers {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  flex-shrink: 0;
}

.publisher-mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 44px;
  text-decoration: none;
  transition: opacity var(--t-fast) ease;
}

.publisher-mark img {
  height: 100%;
  width: auto;
  max-width: 180px;
  object-fit: contain;
  display: block;
}

.publisher-mark__fallback {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.4rem 0.7rem;
  background: #fff;
  color: #1a1a1a;
  font-family: 'Noto Sans TC', sans-serif;
  font-weight: 700;
  font-size: 0.75rem;
  letter-spacing: 0.1em;
  border-radius: 4px;
}

.publisher-mark:hover {
  text-decoration: none;
  opacity: 0.85;
}

.publisher-mark--rating {
  flex-direction: column;
  background: #fff;
  border-radius: 4px;
  padding: 0.3rem 0.55rem;
  gap: 0;
  min-width: 56px;
}

.publisher-mark--rating .publisher-mark__age {
  font-family: Arial Black, sans-serif;
  font-weight: 900;
  font-size: 1.55rem;
  line-height: 1;
  color: #d6342b;
  letter-spacing: -0.02em;
}

.publisher-mark--rating .publisher-mark__age sup {
  font-size: 0.7em;
  vertical-align: super;
  position: relative;
  top: -0.05em;
}

.publisher-mark--rating .publisher-mark__sub {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-top: 0.15rem;
  padding: 0.05rem 0.3rem;
  background: #d6342b;
  color: #fff;
  font-family: 'Noto Sans TC', sans-serif;
  font-weight: 700;
  font-size: 0.6rem;
  letter-spacing: 0.1em;
  border-radius: 2px;
  width: 100%;
  box-sizing: border-box;
}

.footer-legal-text {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  font-size: 0.78rem;
  line-height: 1.7;
  color: rgba(255, 255, 255, 0.85);
}

.footer-legal-text__copyright {
  margin: 0;
  font-weight: 400;
}

.footer-legal-text__links {
  margin: 0 0 0.2rem 0;
}

.footer-legal-text__link {
  background: transparent;
  border: none;
  padding: 0;
  color: rgba(255, 255, 255, 0.85);
  font-size: inherit;
  font-family: inherit;
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 2px;
  transition: opacity var(--t-fast) ease;
}

.footer-legal-text__link:hover {
  opacity: 0.75;
}

.footer-legal-text__sep {
  color: rgba(255, 255, 255, 0.85);
}

.footer-legal-text__notice {
  margin: 0;
  font-size: 0.74rem;
  line-height: 1.7;
  color: rgba(255, 255, 255, 0.85);
}

.footer-top-btn {
  position: absolute;
  right: 20px;
  bottom: 20px;
  width: 44px;
  height: 44px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.35);
  color: #fff;
  border-radius: 50%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.35);
  backdrop-filter: blur(6px);
  transition: all var(--t-fast) ease;
}

.footer-top-btn svg {
  width: 14px;
  height: 14px;
  stroke-width: 3;
}

.footer-top-btn span {
  font-family: var(--font-sans);
  font-weight: 700;
  font-size: 0.55rem;
  letter-spacing: 0.1em;
  margin-top: 1px;
}

.footer-top-btn:hover {
  background: rgba(255, 255, 255, 0.18);
  border-color: rgba(255, 255, 255, 0.55);
  transform: translateY(-2px);
  box-shadow: 0 8px 18px rgba(0, 0, 0, 0.5);
}

.anchor-nav {
  position: fixed;
  top: 50%;
  left: var(--space-md);
  transform: translateY(-50%);
  z-index: var(--z-audio);
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.25rem;
  font-family: var(--font-serif);
  transition: opacity var(--t-base) ease;
}

.anchor-nav__item {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  padding: 0.35rem 0.1rem;
  background: transparent;
  border: none;
  color: var(--color-paper);
  cursor: pointer;
  font-family: inherit;
  font-size: 0.82rem;
  letter-spacing: 0.18em;
  line-height: 1;
  text-shadow: 0 1px 4px rgba(0, 0, 0, 0.65);
  transition: color var(--t-fast) ease, transform var(--t-fast) ease;
}

.anchor-nav__item:hover {
  color: var(--color-temple-gold);
  transform: translateX(3px);
}

.anchor-nav__item:hover .anchor-nav__diamond {
  filter: drop-shadow(0 0 6px rgba(212, 175, 55, 0.75));
  transform: rotate(45deg) scale(1.15);
}

.anchor-nav__diamond {
  display: inline-flex;
  width: 10px;
  height: 10px;
  align-items: center;
  justify-content: center;
  color: var(--color-temple-gold);
  font-size: 0.55rem;
  line-height: 1;
  transition: filter var(--t-fast) ease, transform var(--t-fast) ease;
}

.anchor-nav__label {
  font-family: inherit;
}

.anchor-nav__item--top .anchor-nav__label {
  font-weight: 700;
  letter-spacing: 0.22em;
}

.anchor-nav__line {
  width: 1px;
  height: 26px;
  margin-left: 4px;
  background: linear-gradient(180deg, rgba(212, 175, 55, 0.7) 0%, rgba(212, 175, 55, 0.15) 100%);
}

@media (max-width: 1023px) {
  .app-header__inner {
    min-height: 52px;
    padding: 0.4rem var(--space-md);
    padding-right: var(--space-md);
    justify-content: center;
  }
  .app-header__icons {
    display: none;
  }
  .app-header__hamburger {
    display: inline-flex;
    position: absolute;
    right: var(--space-sm);
    top: 50%;
    transform: translateY(-50%);
  }
  .app-header__share {
    display: inline-flex;
    position: absolute;
    left: var(--space-sm);
    top: 50%;
    transform: translateY(-50%);
  }
  .anchor-nav {
    display: none;
  }
  .app-footer {
    padding: var(--space-lg) var(--space-lg) var(--space-md);
  }
}

@media (max-width: 767px) {
  .app-header__inner {
    gap: 0.6rem;
    padding: 0.45rem var(--space-sm);
  }
  .app-header__text-brand {
    font-size: 0.9rem;
    letter-spacing: 0.1em;
  }
  .app-header__hamburger {
    width: 44px;
    height: 44px;
    gap: 4px;
  }
  .app-header__hamburger-bar {
    width: 20px;
  }

  .app-footer {
    padding: var(--space-md) var(--space-sm);
    margin-top: var(--space-xl);
  }
  .app-footer__inner {
    gap: var(--space-md);
  }

  .footer-row--top {
    padding-bottom: 0.6rem;
  }
  .footer-row__contact,
  .footer-row__follow-label {
    font-size: 0.85rem;
  }
  /* hit area 44 但視覺保持 22px icon（padding 撐開） */
  .follow-icon {
    width: 44px;
    height: 44px;
    padding: 11px;
    box-sizing: border-box;
  }
  .follow-icon svg {
    width: 22px;
    height: 22px;
  }

  .tech-logos {
    gap: var(--space-md);
  }
  .tech-logo {
    height: 26px;
  }
  .tech-logo svg {
    height: 22px;
  }

  .footer-row--bottom {
    grid-template-columns: 1fr;
    gap: var(--space-sm);
  }
  .footer-publishers {
    justify-content: center;
  }

  .publisher-mark--ican .publisher-mark__brand { font-size: 1.15rem; }
  .publisher-mark--rating .publisher-mark__age { font-size: 1.35rem; }
  .publisher-mark--24ent .publisher-mark__flag { width: 22px; height: 24px; }
  .publisher-mark--24ent .publisher-mark__name { font-size: 0.65rem; }

  .footer-legal-text {
    text-align: center;
    font-size: 0.78rem;
    line-height: 1.65;
  }
  .footer-legal-text__notice {
    font-size: 0.76rem;
    line-height: 1.65;
  }
  /* 法務連結 hit area */
  .footer-legal-text__link {
    padding: 4px 0;
    display: inline-block;
  }

  .footer-top-btn {
    width: 50px;
    height: 50px;
    right: 12px;
    bottom: 12px;
  }
  .footer-top-btn svg { width: 14px; height: 14px; }
  .footer-top-btn span { font-size: 0.62rem; }

}
