:root {
  color-scheme: light;
  --ink: #18201b;
  --muted: #58645c;
  --paper: #f7f3ea;
  --paper-strong: #fffaf1;
  --leaf: #2e5b42;
  --moss: #86a06e;
  --clay: #9b6848;
  --coral: #c95f4a;
  --sky: #dfe9e5;
  --line: rgba(24, 32, 27, 0.14);
  --shadow: 0 22px 70px rgba(33, 42, 34, 0.18);
  --light-text: #fff8ec;
  --dim-light: rgba(255, 248, 236, 0.78);
  --frost-line: rgba(255, 248, 236, 0.2);
  --frost-line-strong: rgba(255, 248, 236, 0.36);
  --frost-fill: rgba(9, 16, 11, 0.34);
  --frost-fill-strong: rgba(9, 16, 11, 0.46);
  --frost-shadow: 0 16px 38px rgba(0, 0, 0, 0.22);
  --star-border-color: rgba(255, 255, 255, 0.86);
  --star-border-soft: #222222;
  --star-border-bg: #000000;
  --star-border-bg-hover: #050505;
  --star-border-radius: 20px;
  --star-border-speed: 6s;
}

* {
  box-sizing: border-box;
}

html {
  height: 100%;
  overflow: hidden;
  scroll-behavior: smooth;
}

body {
  margin: 0;
  height: 100%;
  min-height: 100vh;
  overflow: hidden;
  background: #10150f;
  color: var(--light-text);
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Segoe UI", sans-serif;
  letter-spacing: 0;
  -webkit-font-smoothing: antialiased;
  text-rendering: geometricPrecision;
}

body::before {
  position: fixed;
  inset: 0;
  z-index: -3;
  pointer-events: none;
  content: "";
  background: url("./assets/tomb-background-wide.png?v=2") center center / cover no-repeat;
}

body::after {
  position: fixed;
  inset: 0;
  z-index: -2;
  pointer-events: none;
  content: "";
  background:
    linear-gradient(90deg, rgba(7, 12, 8, 0.86) 0%, rgba(7, 12, 8, 0.54) 30%, rgba(7, 12, 8, 0.15) 58%, rgba(7, 12, 8, 0.36) 100%),
    linear-gradient(180deg, rgba(7, 12, 8, 0.18) 0%, rgba(7, 12, 8, 0.26) 52%, rgba(7, 12, 8, 0.72) 100%);
}

.atmosphere {
  position: fixed;
  inset: 0;
  z-index: 1;
  overflow: hidden;
  pointer-events: none;
}

.mist {
  position: absolute;
  width: 42vw;
  height: 12vh;
  border-radius: 999px;
  background: radial-gradient(ellipse at center, rgba(230, 238, 231, 0.18), rgba(230, 238, 231, 0) 70%);
  filter: blur(12px);
  opacity: 0.55;
  animation: mistDrift 24s linear infinite;
}

.mist-a {
  top: 30%;
  left: 12%;
}

.mist-b {
  top: 42%;
  left: 48%;
  width: 36vw;
  animation-duration: 31s;
  animation-delay: -9s;
}

.wind {
  position: absolute;
  width: clamp(96px, 12vw, 210px);
  height: 1px;
  border-radius: 999px;
  background: linear-gradient(90deg, transparent, rgba(255, 248, 236, 0.5), transparent);
  opacity: 0;
  animation: windPass 8s ease-in-out infinite;
}

.wind-a {
  top: 24%;
  left: -18%;
}

.wind-b {
  top: 48%;
  left: -24%;
  animation-delay: -3s;
  animation-duration: 10s;
}

.wind-c {
  top: 67%;
  left: -16%;
  animation-delay: -5.5s;
  animation-duration: 11s;
}

.leaf {
  position: absolute;
  top: -40px;
  width: 14px;
  height: 8px;
  border-radius: 100% 0 100% 0;
  background: #9d9b5b;
  box-shadow: 0 0 0 1px rgba(35, 48, 30, 0.18) inset;
  opacity: 0.82;
  animation: leafFall 13s linear infinite;
}

.leaf-a { left: 18%; animation-delay: -1s; }
.leaf-b { left: 36%; animation-delay: -6s; animation-duration: 15s; }
.leaf-c { left: 58%; animation-delay: -3s; animation-duration: 12s; }
.leaf-d { left: 76%; animation-delay: -8s; animation-duration: 16s; }
.leaf-e { left: 88%; animation-delay: -4.5s; animation-duration: 14s; }
.leaf-f { left: 48%; animation-delay: -10s; animation-duration: 18s; }

a {
  color: inherit;
  text-decoration: none;
}

img {
  display: block;
  max-width: 100%;
}

button,
input,
textarea {
  font: inherit;
  -webkit-font-smoothing: antialiased;
}

button,
a,
.button,
.file-picker {
  -webkit-tap-highlight-color: transparent;
}

button,
.button,
.file-picker {
  appearance: none;
  -webkit-appearance: none;
}

button:focus,
.button:focus,
.file-picker:focus {
  outline: none;
}

::placeholder {
  color: rgba(255, 248, 236, 0.62);
  opacity: 1;
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 68px;
  padding: 0 clamp(18px, 5vw, 64px);
  border-bottom: 1px solid rgba(255, 248, 236, 0.18);
  background: rgba(9, 16, 11, 0.34);
  backdrop-filter: blur(18px);
}

.brand {
  font-family: "Noto Serif SC", serif;
  font-size: 1.28rem;
  font-weight: 700;
}

.mobile-memory-toggle,
.memory-drawer-close,
.mobile-drawer-backdrop {
  display: none;
}

.mobile-memory-toggle,
.memory-drawer-close {
  position: relative;
  overflow: hidden;
  border: 0;
  background: transparent;
  isolation: isolate;
}

.mobile-memory-toggle::before,
.mobile-memory-toggle::after,
.memory-drawer-close::before,
.memory-drawer-close::after {
  position: absolute;
  z-index: 0;
  width: 300%;
  height: 50%;
  border-radius: 50%;
  content: "";
  pointer-events: none;
  background: radial-gradient(circle, var(--star-border-color), transparent 10%);
  opacity: 0.68;
}

.mobile-memory-toggle::before,
.memory-drawer-close::before {
  right: -250%;
  bottom: -12px;
  animation: starMovementBottom var(--star-border-speed) linear infinite alternate;
}

.mobile-memory-toggle::after,
.memory-drawer-close::after {
  top: -12px;
  left: -250%;
  animation: starMovementTop var(--star-border-speed) linear infinite alternate;
}

.mobile-memory-toggle .star-inner {
  min-height: 50px;
  border-color: #222;
  background: #000;
  box-shadow: 0 0 0 rgba(255, 255, 255, 0);
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
}

nav {
  display: flex;
  align-items: center;
  gap: clamp(14px, 4vw, 30px);
  color: var(--dim-light);
  font-size: 0.95rem;
}

nav a:hover,
.nav-button:hover {
  color: var(--light-text);
}

.nav-button {
  padding: 0;
  border: 0;
  background: transparent;
  color: inherit;
  cursor: pointer;
  font: inherit;
  font-weight: 700;
}

.hero {
  position: relative;
  display: grid;
  grid-template-columns: minmax(280px, 0.82fr) minmax(320px, 1.18fr);
  grid-template-rows: 1fr auto;
  align-items: center;
  height: calc(100vh - 68px);
  min-height: calc(100vh - 68px);
  padding: clamp(24px, 5vw, 68px) clamp(430px, 28vw, 500px) clamp(18px, 3vw, 34px) clamp(24px, 5vw, 68px);
  gap: clamp(22px, 4vw, 56px);
}

.hero::after {
  position: absolute;
  right: 0;
  bottom: 0;
  left: 0;
  z-index: 2;
  height: min(34vh, 260px);
  content: "";
  pointer-events: none;
  background: linear-gradient(180deg, rgba(9, 16, 11, 0) 0%, rgba(9, 16, 11, 0.08) 46%, rgba(9, 16, 11, 0.34) 100%);
  backdrop-filter: blur(18px) saturate(1.08);
  -webkit-backdrop-filter: blur(18px) saturate(1.08);
  mask-image: linear-gradient(180deg, transparent 0%, rgba(0, 0, 0, 0.2) 42%, #000 100%);
  -webkit-mask-image: linear-gradient(180deg, transparent 0%, rgba(0, 0, 0, 0.2) 42%, #000 100%);
}

.hero-copy {
  position: relative;
  z-index: 4;
  max-width: 580px;
  text-shadow: 0 2px 24px rgba(0, 0, 0, 0.42);
}

.eyebrow {
  margin: 0 0 14px;
  color: #f0c16b;
  font-size: 0.82rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

h1,
h2 {
  margin: 0;
  font-family: "Noto Serif SC", serif;
  letter-spacing: 0;
}

h1 {
  font-size: clamp(4.2rem, 10vw, 8.2rem);
  line-height: 0.95;
  text-shadow: 0 8px 42px rgba(0, 0, 0, 0.42);
}

h2 {
  font-size: clamp(2rem, 5vw, 4rem);
  line-height: 1.12;
}

.hero-text {
  max-width: 480px;
  margin: 24px 0 0;
  color: var(--dim-light);
  font-size: clamp(1.05rem, 2vw, 1.25rem);
  line-height: 1.85;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 34px;
}

.button {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 46px;
  padding: 1px 0;
  overflow: hidden;
  border: 0;
  border-radius: var(--star-border-radius);
  background: transparent;
  box-shadow:
    0 12px 30px rgba(0, 0, 0, 0.18),
    0 0 0 1px rgba(255, 255, 255, 0.04) inset;
  color: var(--light-text);
  cursor: pointer;
  font-family: inherit;
  font-size: 0.96rem;
  font-weight: 600;
  text-shadow: 0 1px 14px rgba(0, 0, 0, 0.34);
  backdrop-filter: blur(22px) saturate(1.08);
  -webkit-backdrop-filter: blur(22px) saturate(1.08);
  transition: background 180ms ease, border-color 180ms ease, filter 120ms ease, transform 120ms ease;
  isolation: isolate;
}

.button::before,
.button::after {
  position: absolute;
  z-index: 0;
  width: 300%;
  height: 38%;
  border-radius: 50%;
  content: "";
  pointer-events: none;
  background: radial-gradient(circle, var(--star-border-color), transparent 10%);
  opacity: 0.7;
}

.button::before {
  right: -250%;
  bottom: -12px;
  animation: starMovementBottom var(--star-border-speed) linear infinite alternate;
}

.button::after {
  top: -12px;
  left: -250%;
  animation: starMovementTop var(--star-border-speed) linear infinite alternate;
}

.button > * {
  position: relative;
  z-index: 1;
}

.button:hover {
  background: transparent;
}

.button:active {
  background: transparent;
  filter: brightness(1.22);
  transform: translateY(1px) scale(0.985);
}

.button.primary {
  background: transparent;
  color: var(--light-text);
  text-shadow: 0 1px 12px rgba(0, 0, 0, 0.3);
  box-shadow:
    0 14px 34px rgba(0, 0, 0, 0.22),
    0 0 0 1px rgba(255, 255, 255, 0.04) inset;
}

.leave-panel .button.primary {
  background: transparent;
  color: #fffaf1;
}

.button.ghost {
  background: transparent;
  color: var(--light-text);
  backdrop-filter: blur(22px) saturate(1.08);
  -webkit-backdrop-filter: blur(22px) saturate(1.08);
}

.mound-scene {
  position: relative;
  margin: 0;
  min-height: min(52vw, 560px);
}

.mound-button {
  position: relative;
  display: block;
  width: 100%;
  min-height: min(52vw, 560px);
  padding: 0;
  border: 0;
  background: transparent;
  cursor: default;
}

.mound-button img {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  opacity: 0;
  pointer-events: none;
}

.mound-button::after {
  display: none;
}

.speech {
  position: fixed;
  top: clamp(146px, 24vh, 228px);
  left: clamp(360px, 43vw, 760px);
  z-index: 3;
  display: flex;
  align-items: center;
  justify-content: center;
  width: clamp(390px, 31vw, 610px);
  max-width: min(92vw, 720px);
  aspect-ratio: 1712 / 919;
  padding:
    clamp(24px, 3.2vw, 46px)
    clamp(58px, 5vw, 92px)
    clamp(66px, 7vw, 112px)
    clamp(78px, 7vw, 124px);
  border: 0;
  background: transparent;
  filter: drop-shadow(0 22px 42px rgba(0, 0, 0, 0.34));
  color: var(--ink);
  font-family: "Noto Serif SC", serif;
  font-size: clamp(1.12rem, 2.72vw, 1.92rem);
  line-height: 1.35;
  text-align: center;
  transform: translateX(-50%);
  animation: floatIn 520ms ease both;
}

.speech.thinking {
  animation: bubbleThink 1.45s ease-in-out infinite;
}

.thinking-dot {
  display: inline-block;
  min-width: 0.36em;
  animation: dotBounce 900ms ease-in-out infinite;
}

.thinking-dot:nth-child(2) {
  animation-delay: 140ms;
}

.thinking-dot:nth-child(3) {
  animation-delay: 280ms;
}

.speech::before {
  position: absolute;
  inset: 0;
  z-index: -1;
  content: "";
  background: url("./assets/comic-thought-bubble.png") center center / 100% 100% no-repeat;
  transform: scaleX(-1);
}

.speech::after {
  display: none;
}

@keyframes floatIn {
  from {
    opacity: 0;
    transform: translate(-50%, 10px);
  }
  to {
    opacity: 1;
    transform: translate(-50%, 0);
  }
}

@keyframes bubbleThink {
  0%,
  100% {
    transform: translate(-50%, 0) scale(1);
  }
  50% {
    transform: translate(-50%, -4px) scale(1.025);
  }
}

@keyframes dotBounce {
  0%,
  80%,
  100% {
    opacity: 0.35;
    transform: translateY(0);
  }
  35% {
    opacity: 1;
    transform: translateY(-0.34em);
  }
}

@keyframes leafFall {
  0% {
    transform: translate3d(-4vw, -40px, 0) rotate(0deg);
  }
  35% {
    transform: translate3d(4vw, 35vh, 0) rotate(130deg);
  }
  70% {
    transform: translate3d(-1vw, 72vh, 0) rotate(260deg);
  }
  100% {
    transform: translate3d(5vw, calc(100vh + 60px), 0) rotate(390deg);
  }
}

@keyframes windPass {
  0%,
  100% {
    opacity: 0;
    transform: translateX(0) scaleX(0.72);
  }
  18%,
  55% {
    opacity: 0.48;
  }
  70% {
    opacity: 0;
    transform: translateX(135vw) scaleX(1.35);
  }
}

@keyframes mistDrift {
  from {
    transform: translateX(-10vw);
  }
  to {
    transform: translateX(26vw);
  }
}

@keyframes starMovementBottom {
  0% {
    opacity: 1;
    transform: translate(0%, 0%);
  }
  100% {
    opacity: 0;
    transform: translate(-100%, 0%);
  }
}

@keyframes starMovementTop {
  0% {
    opacity: 1;
    transform: translate(0%, 0%);
  }
  100% {
    opacity: 0;
    transform: translate(100%, 0%);
  }
}

@keyframes envelopeClose {
  0% {
    transform: rotateX(0deg);
  }
  100% {
    transform: rotateX(-168deg);
  }
}

@keyframes insertIntoEnvelope {
  0% {
    opacity: 1;
    transform: translateY(-92px) scale(1) rotate(-5deg);
  }
  62% {
    opacity: 1;
    transform: translateY(-12px) scale(0.9) rotate(0deg);
  }
  100% {
    opacity: 0;
    transform: translateY(10px) scale(0.72) rotate(0deg);
  }
}

@keyframes ritualEnvelopeExit {
  0% {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
  72% {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
  100% {
    opacity: 0;
    transform: translateY(26px) scale(0.72);
  }
}

@keyframes borderTrace {
  0% {
    background-position:
      -120% 0,
      100% -120%,
      220% 100%,
      0 220%;
  }
  25% {
    background-position:
      220% 0,
      100% -120%,
      220% 100%,
      0 220%;
  }
  25.01% {
    background-position:
      220% 0,
      100% -120%,
      220% 100%,
      0 220%;
  }
  50% {
    background-position:
      220% 0,
      100% 220%,
      220% 100%,
      0 220%;
  }
  50.01% {
    background-position:
      220% 0,
      100% 220%,
      220% 100%,
      0 220%;
  }
  75% {
    background-position:
      220% 0,
      100% 220%,
      -120% 100%,
      0 220%;
  }
  75.01% {
    background-position:
      220% 0,
      100% 220%,
      -120% 100%,
      0 220%;
  }
  100% {
    background-position:
      220% 0,
      100% 220%,
      -120% 100%,
      0 -120%;
  }
}

.leave-panel {
  position: relative;
  z-index: 4;
  padding: clamp(56px, 8vw, 96px) clamp(18px, 5vw, 64px);
}

.leave-panel {
  background: rgba(247, 243, 234, 0.48);
  color: var(--ink);
  backdrop-filter: blur(2px) saturate(1.08);
}

.section-heading {
  max-width: 820px;
  margin: 0 auto 30px;
}

.memory-form {
  display: grid;
  grid-template-columns: minmax(220px, 0.78fr) minmax(280px, 1.22fr);
  max-width: 920px;
  margin: 0 auto;
  gap: 16px;
}

.quick-leave {
  position: absolute;
  z-index: 6;
  right: auto;
  bottom: clamp(14px, 3vw, 28px);
  left: calc((100vw - clamp(430px, 28vw, 500px)) / 2);
  width: min(78vw, calc(100vw - clamp(430px, 28vw, 500px) - 8vw), 1080px);
  max-width: 1080px;
  margin: 0;
  transform: translateX(-50%);
}

.quick-memory-form {
  --quick-control-height: 52px;
  display: grid;
  grid-template-columns: minmax(96px, 150px) minmax(220px, 1fr) auto auto;
  align-items: center;
  max-width: none;
  margin: 0;
  gap: 10px;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
  transition: filter 260ms ease, opacity 260ms ease;
}

.quick-memory-form label,
.quick-memory-form .file-picker,
.quick-memory-form .preview,
.quick-memory-form .form-footer {
  grid-column: auto;
}

.quick-memory-form label {
  position: relative;
  gap: 0;
}

.quick-memory-form label.name-field,
.quick-memory-form label.message-field {
  overflow: hidden;
  padding: 1px 0;
  border-radius: var(--star-border-radius);
  isolation: isolate;
}

.quick-memory-form label.name-field > span,
.quick-memory-form label.message-field > span {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
}

.quick-memory-form input,
.quick-memory-form textarea {
  position: relative;
  z-index: 1;
  height: var(--quick-control-height);
  min-height: 52px;
  border: 1px solid rgba(255, 248, 236, 0.18);
  border-radius: var(--star-border-radius);
  background: rgba(9, 16, 11, 0.34);
  box-shadow: none;
  color: var(--light-text);
  font-size: 16px;
  text-shadow: none;
  backdrop-filter: blur(18px) saturate(1.05);
  -webkit-backdrop-filter: blur(18px) saturate(1.05);
  transition: background 180ms ease, border-color 180ms ease, color 180ms ease;
}

.quick-memory-form input:hover,
.quick-memory-form textarea:hover,
.quick-memory-form input:focus,
.quick-memory-form textarea:focus {
  border-color: rgba(255, 248, 236, 0.26);
  background: rgba(9, 16, 11, 0.42);
}

.quick-memory-form label.name-field::before,
.quick-memory-form label.name-field::after,
.quick-memory-form label.message-field::before,
.quick-memory-form label.message-field::after {
  position: absolute;
  z-index: 0;
  width: 300%;
  height: 38%;
  border-radius: 50%;
  content: "";
  pointer-events: none;
  background: radial-gradient(circle, var(--star-border-color), transparent 6%);
  opacity: 0;
  filter: none;
  transition: opacity 180ms ease;
}

.quick-memory-form label.name-field::before,
.quick-memory-form label.message-field::before {
  right: -250%;
  bottom: -8px;
  animation: starMovementBottom var(--star-border-speed) linear infinite alternate;
}

.quick-memory-form label.name-field::after,
.quick-memory-form label.message-field::after {
  top: -8px;
  left: -250%;
  animation: starMovementTop var(--star-border-speed) linear infinite alternate;
}

.quick-memory-form label.message-field::before,
.quick-memory-form label.message-field::after {
  opacity: 0.48;
}

.quick-memory-form .button::before,
.quick-memory-form .button::after {
  opacity: 0;
}

.quick-memory-form .file-box::before,
.quick-memory-form .file-box::after {
  position: absolute;
  z-index: 0;
  width: 300%;
  height: 38%;
  border-radius: 50%;
  content: "";
  pointer-events: none;
  background: radial-gradient(circle, var(--star-border-color), transparent 10%);
  opacity: 0;
}

.quick-memory-form .file-box::before {
  right: -250%;
  bottom: -12px;
  animation: starMovementBottom var(--star-border-speed) linear infinite alternate;
}

.quick-memory-form .file-box::after {
  top: -12px;
  left: -250%;
  animation: starMovementTop var(--star-border-speed) linear infinite alternate;
}

.quick-memory-form label.name-field:hover::before,
.quick-memory-form label.name-field:hover::after,
.quick-memory-form label.name-field:focus-within::before,
.quick-memory-form label.name-field:focus-within::after,
.quick-memory-form label.message-field:hover::before,
.quick-memory-form label.message-field:hover::after,
.quick-memory-form label.message-field:focus-within::before,
.quick-memory-form label.message-field:focus-within::after,
.quick-memory-form .file-box:hover::before,
.quick-memory-form .file-box:hover::after,
.quick-memory-form .file-picker:focus-within .file-box::before,
.quick-memory-form .file-picker:focus-within .file-box::after,
.quick-memory-form .file-picker:focus-within::before,
.quick-memory-form .file-picker:focus-within::after {
  opacity: 0;
}

.quick-memory-form label.message-field:hover::before,
.quick-memory-form label.message-field:hover::after,
.quick-memory-form label.message-field:focus-within::before,
.quick-memory-form label.message-field:focus-within::after {
  opacity: 0.9;
}

.quick-memory-form label.name-field::before,
.quick-memory-form label.name-field::after,
.quick-memory-form label.name-field:hover::before,
.quick-memory-form label.name-field:hover::after,
.quick-memory-form label.name-field:focus-within::before,
.quick-memory-form label.name-field:focus-within::after,
.quick-memory-form label.quick-file.button::before,
.quick-memory-form label.quick-file.button::after,
.quick-memory-form label.quick-file.button:hover::before,
.quick-memory-form label.quick-file.button:hover::after,
.quick-memory-form label.quick-file.button:focus-within::before,
.quick-memory-form label.quick-file.button:focus-within::after,
.quick-memory-form .form-footer .button::before,
.quick-memory-form .form-footer .button::after,
.quick-memory-form .form-footer .button:hover::before,
.quick-memory-form .form-footer .button:hover::after,
.quick-memory-form .form-footer .button:focus-visible::before,
.quick-memory-form .form-footer .button:focus-visible::after {
  opacity: 0 !important;
}

.quick-memory-form textarea {
  height: var(--quick-control-height);
  min-height: var(--quick-control-height);
  overflow: hidden;
  resize: none;
  scrollbar-width: none;
}

.quick-memory-form textarea::-webkit-scrollbar {
  display: none;
}

.quick-memory-form .file-box {
  position: relative;
  z-index: 0;
  justify-content: center;
  gap: 10px;
  min-height: 52px;
  padding: 0;
  overflow: hidden;
  border: 0;
  border-radius: var(--star-border-radius);
  background: transparent;
  box-shadow: none;
  color: var(--light-text);
  white-space: nowrap;
  text-shadow: none;
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
  transition: border-color 180ms ease, background 180ms ease;
  isolation: isolate;
}

.quick-memory-form .file-box:hover,
.quick-memory-form .file-picker:focus-within .file-box {
  background: transparent;
  transform: none;
}

.quick-memory-form .file-title,
.star-inner {
  position: relative;
  z-index: 1;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  justify-content: center;
  width: 100%;
  min-height: 50px;
  padding: 0 22px;
  border: 1px solid #222;
  border-radius: var(--star-border-radius);
  background: #000;
  color: var(--light-text);
  font-size: 16px;
  box-shadow: 0 0 0 rgba(255, 255, 255, 0);
  transition: background 120ms ease, border-color 120ms ease, box-shadow 120ms ease, transform 120ms ease;
}

.quick-memory-form .star-inner {
  height: var(--quick-control-height);
  min-height: var(--quick-control-height);
  border-color: rgba(255, 248, 236, 0.18);
  background: rgba(9, 16, 11, 0.34);
  box-shadow: none;
  backdrop-filter: blur(18px) saturate(1.05);
  -webkit-backdrop-filter: blur(18px) saturate(1.05);
}

.quick-memory-form .file-box:hover .file-title,
.quick-memory-form .file-picker:focus-within .file-title,
.quick-memory-form .file-picker:focus-within .star-inner,
.button:hover .star-inner,
.button:focus-visible .star-inner,
.mobile-memory-toggle:hover .star-inner,
.mobile-memory-toggle:focus-visible .star-inner {
  border-color: #333;
  background: #020202;
}

.quick-memory-form .file-picker:hover .star-inner,
.quick-memory-form .file-picker:focus-within .star-inner,
.quick-memory-form .button:hover .star-inner,
.quick-memory-form .button:focus-visible .star-inner {
  border-color: rgba(255, 248, 236, 0.26);
  background: rgba(9, 16, 11, 0.42);
  box-shadow: none;
}

.button:active .star-inner,
.button.is-pressing .star-inner,
.quick-memory-form .file-picker:active .star-inner,
.quick-memory-form .file-picker.is-pressing .star-inner,
.mobile-memory-toggle:active .star-inner,
.mobile-memory-toggle.is-pressing .star-inner,
.memory-drawer-close:active,
.memory-drawer-close.is-pressing,
.photo-lightbox-close:active,
.photo-lightbox-close.is-pressing,
.photo-lightbox-nav:active,
.photo-lightbox-nav.is-pressing {
  border-color: rgba(255, 255, 255, 0.52);
  background: #111;
  box-shadow:
    0 0 0 1px rgba(255, 255, 255, 0.18) inset,
    0 0 18px rgba(255, 255, 255, 0.16);
  transform: translateY(1px) scale(0.985);
}

.quick-memory-form .button:active .star-inner,
.quick-memory-form .button.is-pressing .star-inner,
.quick-memory-form .file-picker:active .star-inner,
.quick-memory-form .file-picker.is-pressing .star-inner {
  border-color: rgba(255, 248, 236, 0.26);
  background: rgba(9, 16, 11, 0.42);
  box-shadow: none;
}

.file-icon {
  width: 18px;
  height: 18px;
  flex: 0 0 auto;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.9;
}

.quick-memory-form .file-name {
  position: relative;
  z-index: 1;
  display: none;
  color: rgba(255, 248, 236, 0.62);
  font-size: 0.78rem;
  font-weight: 700;
}

.quick-memory-form .file-name:not(:empty) {
  display: inline;
}

.quick-memory-form .form-footer {
  display: grid;
  grid-template-columns: 1fr;
}

.quick-memory-form .button {
  position: relative;
  z-index: 0;
  width: 100%;
  justify-self: stretch;
  min-height: 52px;
  padding: 0;
  border: 0;
  border-radius: var(--star-border-radius);
  background: transparent;
  color: var(--light-text);
  box-shadow:
    0 12px 28px rgba(0, 0, 0, 0.18),
    0 0 0 1px rgba(255, 255, 255, 0.04) inset;
  font-size: 16px;
  text-shadow: none;
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
  transition: background 180ms ease, border-color 180ms ease;
}

.quick-memory-form .button:hover,
.quick-memory-form .button:focus-visible {
  background: transparent;
  transform: none;
}

.quick-memory-form .button:active {
  transform: none;
  background: transparent;
}

.quick-memory-form #formStatus {
  position: absolute;
  left: 12px;
  bottom: -28px;
  color: var(--dim-light);
  text-shadow: 0 2px 16px rgba(0, 0, 0, 0.5);
}

.quick-memory-form .preview {
  position: absolute;
  right: 116px;
  bottom: calc(100% + 10px);
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(54px, 1fr));
  gap: 8px;
  width: min(330px, 42vw);
  max-height: 154px;
  overflow: auto;
  padding: 8px;
  border: 1px solid rgba(255, 248, 236, 0.2);
  border-radius: 12px;
  background: rgba(8, 12, 9, 0.28);
  box-shadow: 0 16px 42px rgba(0, 0, 0, 0.28);
  backdrop-filter: blur(18px) saturate(1.12);
  -webkit-backdrop-filter: blur(18px) saturate(1.12);
  scrollbar-width: none;
}

.quick-memory-form .preview[hidden] {
  display: none;
}

.quick-memory-form .preview::-webkit-scrollbar {
  display: none;
}

.selected-photo {
  position: relative;
  aspect-ratio: 1;
  overflow: hidden;
  border-radius: 9px;
  background: rgba(255, 255, 255, 0.08);
}

.quick-memory-form .selected-photo img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.selected-photo-remove {
  position: absolute;
  top: 4px;
  right: 4px;
  display: grid;
  place-items: center;
  width: 20px;
  height: 20px;
  padding: 0;
  overflow: hidden;
  border: 1px solid rgba(255, 248, 236, 0.28);
  border-radius: 999px;
  background: rgba(5, 8, 6, 0.68);
  color: rgba(255, 248, 236, 0.96);
  cursor: pointer;
  font-size: 0.9rem;
  font-weight: 800;
  line-height: 1;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  isolation: isolate;
}

.selected-photo-remove:hover {
  background: rgba(5, 8, 6, 0.82);
}

.selected-photo-remove::before,
.selected-photo-remove::after {
  position: absolute;
  z-index: 0;
  width: 300%;
  height: 50%;
  border-radius: 50%;
  content: "";
  pointer-events: none;
  background: radial-gradient(circle, var(--star-border-color), transparent 10%);
  opacity: 0.72;
}

.selected-photo-remove::before {
  right: -250%;
  bottom: -8px;
  animation: starMovementBottom 4.8s linear infinite alternate;
}

.selected-photo-remove::after {
  top: -8px;
  left: -250%;
  animation: starMovementTop 4.8s linear infinite alternate;
}

.quick-memory-form.is-burning {
  --burn-progress: 0;
  pointer-events: none;
  opacity: 0.56;
}

.ritual-overlay {
  --burn-progress: 0;
  --burn-left: 0%;
  --burn-right: 100%;
  position: fixed;
  inset: 0;
  z-index: 38;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(3, 7, 4, 0.34);
  opacity: 0;
  pointer-events: none;
  transition: opacity 220ms ease;
}

.ritual-overlay[hidden] {
  display: none;
}

.ritual-overlay.is-active {
  opacity: 1;
}

.ritual-stage {
  position: relative;
  width: min(520px, calc(100vw - 42px));
  height: min(340px, calc(100vh - 120px));
  border: 1px solid rgba(255, 248, 236, 0.16);
  border-radius: 18px;
  background: rgba(8, 11, 8, 0.38);
  box-shadow: 0 32px 110px rgba(0, 0, 0, 0.46);
  backdrop-filter: blur(18px) saturate(1.05);
  -webkit-backdrop-filter: blur(18px) saturate(1.05);
  overflow: hidden;
}

.ritual-envelope {
  position: absolute;
  top: 96px;
  left: 50%;
  width: 210px;
  height: 132px;
  filter: drop-shadow(0 22px 26px rgba(0, 0, 0, 0.36));
  opacity: 1;
  transform: translateX(-50%);
  transition: opacity 260ms ease, transform 260ms ease;
}

.ritual-overlay.is-burning .ritual-envelope {
  opacity: 0;
  transform: translateX(-50%) translateY(26px) scale(0.72);
}

.ritual-envelope-back,
.ritual-envelope-front,
.ritual-envelope-flap {
  position: absolute;
  inset: 0;
  border: 1px solid rgba(83, 55, 31, 0.42);
  border-radius: 8px;
  background: linear-gradient(180deg, #f0dfb9, #bd843c);
}

.ritual-envelope-back {
  background: linear-gradient(180deg, #e9d4a8, #a97536);
}

.ritual-envelope-front {
  z-index: 2;
  clip-path: polygon(0 0, 50% 48%, 100% 0, 100% 100%, 0 100%);
}

.ritual-envelope-flap {
  z-index: 4;
  clip-path: polygon(0 0, 50% 58%, 100% 0);
  transform-origin: 50% 0;
}

.ritual-overlay.is-active .ritual-envelope-flap {
  animation: envelopeClose 650ms ease 300ms forwards;
}

.ritual-inserts {
  position: absolute;
  inset: 0;
  z-index: 3;
}

.ritual-overlay.is-active .ritual-inserts {
  animation: insertIntoEnvelope 840ms ease forwards;
}

.ritual-photo,
.ritual-letter {
  position: absolute;
  left: 50%;
  bottom: 40px;
  width: 92px;
  height: 70px;
  border-radius: 5px;
  background: linear-gradient(145deg, #dce8e0, #6b7d62 48%, #2f402e);
  box-shadow: 0 8px 16px rgba(0, 0, 0, 0.24);
  transform: translateX(-72px) rotate(-8deg);
}

.ritual-letter {
  width: 112px;
  height: 82px;
  background:
    linear-gradient(90deg, rgba(96, 60, 38, 0.13) 1px, transparent 1px) 0 0 / 18px 100%,
    linear-gradient(180deg, #fff5dc, #e7cf9e);
  transform: translateX(-18px) rotate(7deg);
}

.ritual-progress {
  position: absolute;
  top: 178px;
  left: 50%;
  width: min(360px, calc(100% - 74px));
  opacity: 0;
  transform: translateX(-50%) translateY(20px);
  transition: opacity 220ms ease, transform 220ms ease;
}

.ritual-overlay.is-burning .ritual-progress {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

.ritual-progress-track {
  display: block;
  width: 100%;
  height: 12px;
  overflow: hidden;
  border: 1px solid rgba(255, 248, 236, 0.22);
  border-radius: 999px;
  background: rgba(255, 248, 236, 0.12);
  box-shadow:
    0 18px 42px rgba(0, 0, 0, 0.32),
    0 1px 0 rgba(255, 255, 255, 0.08) inset;
}

.ritual-progress-fill {
  display: block;
  width: 100%;
  height: 100%;
  border-radius: inherit;
  background:
    linear-gradient(90deg, rgba(255, 248, 236, 0.92), rgba(180, 219, 183, 0.92)),
    rgba(255, 248, 236, 0.7);
  transform: scaleX(var(--burn-progress));
  transform-origin: left center;
  transition: transform 100ms linear;
}

.ritual-status {
  position: absolute;
  right: 24px;
  bottom: 20px;
  left: 24px;
  margin: 0;
  color: rgba(255, 248, 236, 0.84);
  font-weight: 800;
  text-align: center;
  text-shadow: 0 2px 16px rgba(0, 0, 0, 0.5);
}

.memory-form label {
  display: grid;
  gap: 8px;
  color: var(--muted);
  font-weight: 700;
}

.memory-form label:nth-child(2),
.file-picker,
.preview,
.form-footer {
  grid-column: 1 / -1;
}

input,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 250, 241, 0.74);
  color: var(--ink);
  outline: none;
}

input {
  min-height: 48px;
  padding: 0 14px;
}

textarea {
  min-height: 150px;
  padding: 14px;
  resize: vertical;
}

input:focus,
textarea:focus,
.file-picker:focus-within .file-box {
  border-color: rgba(255, 255, 255, 0.48);
  box-shadow: none;
}

.file-picker input {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
}

.quick-memory-form .file-picker input {
  position: absolute;
  z-index: -1;
  width: 1px;
  min-width: 0;
  height: 1px;
  min-height: 0;
  padding: 0;
  border: 0;
  opacity: 0;
  pointer-events: none;
  clip: rect(0, 0, 0, 0);
  clip-path: inset(50%);
}

.file-box {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  min-height: 76px;
  padding: 18px;
  border: 1px dashed rgba(46, 91, 66, 0.38);
  border-radius: 8px;
  background: rgba(255, 250, 241, 0.55);
  cursor: pointer;
}

.file-title {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--leaf);
  font-size: 1.05rem;
}

.file-name {
  color: var(--muted);
  font-size: 0.92rem;
  font-weight: 600;
  overflow-wrap: anywhere;
  text-align: right;
}

.preview {
  overflow: hidden;
  border-radius: 8px;
  background: rgba(255, 250, 241, 0.68);
}

.preview img {
  width: 100%;
  max-height: 360px;
  object-fit: contain;
}

.form-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

#formStatus {
  min-height: 1.4em;
  margin: 0;
  color: var(--muted);
  font-weight: 700;
}

.quick-memory-form label.name-field {
  grid-column: 1 / 2;
}

.quick-memory-form label.message-field {
  grid-column: 2 / 3;
}

.quick-memory-form label.quick-file {
  grid-column: 3 / 4;
}

.quick-memory-form label.quick-file.button {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0;
}

.quick-memory-form .form-footer {
  grid-column: 4 / 5;
}

.quick-memory-form .preview {
  grid-column: 1 / -1;
}

.quick-memory-form #formStatus {
  margin: 0;
  color: var(--dim-light);
}

.memory-drawer {
  position: fixed;
  top: 68px;
  right: 0;
  bottom: 0;
  z-index: 24;
  width: clamp(340px, 26vw, 450px);
  padding: 26px 26px 92px;
  overflow: hidden;
  border-left: 1px solid rgba(255, 248, 236, 0.18);
  background: rgba(10, 15, 11, 0.32);
  box-shadow: -24px 0 70px rgba(0, 0, 0, 0.22);
  backdrop-filter: blur(3px) saturate(1.1);
  transform: translateX(0);
  transition: none;
}

.memory-drawer::after {
  position: absolute;
  right: 0;
  bottom: 0;
  left: 0;
  height: 180px;
  content: "";
  pointer-events: none;
  background: linear-gradient(180deg, rgba(10, 15, 11, 0), rgba(10, 15, 11, 0.86));
}

.drawer-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 22px;
}

.drawer-heading h2 {
  color: var(--light-text);
  font-size: clamp(1.6rem, 3vw, 2.4rem);
}

.memories {
  position: relative;
  z-index: 1;
  display: grid;
  gap: 18px;
  max-height: calc(100vh - 220px);
  overflow: auto;
  padding: 2px 8px 140px 0;
  -webkit-mask-image: linear-gradient(180deg, transparent 0, #000 28px, #000 calc(100% - 86px), transparent 100%);
  mask-image: linear-gradient(180deg, transparent 0, #000 28px, #000 calc(100% - 86px), transparent 100%);
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 248, 236, 0.2) transparent;
}

.memories::-webkit-scrollbar {
  width: 10px;
}

.memories::-webkit-scrollbar-track {
  background: transparent;
}

.memories::-webkit-scrollbar-thumb {
  border: 3px solid transparent;
  border-radius: 999px;
  background: linear-gradient(180deg, rgba(255, 248, 236, 0.2), rgba(255, 248, 236, 0.1));
  background-clip: padding-box;
}

.memories::-webkit-scrollbar-thumb:hover {
  background: linear-gradient(180deg, rgba(255, 248, 236, 0.34), rgba(255, 248, 236, 0.16));
  background-clip: padding-box;
}

.memory-card {
  border-left: 2px solid rgba(230, 72, 62, 0.72);
  padding-left: 14px;
  color: rgba(255, 248, 236, 0.9);
  text-shadow: 0 1px 12px rgba(0, 0, 0, 0.45);
}

.memory-photo-button {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  max-width: 100%;
  margin-top: 12px;
  padding: 8px 12px;
  overflow: hidden;
  border: 1px solid rgba(255, 248, 236, 0.18);
  border-radius: 999px;
  background: rgba(5, 9, 7, 0.58);
  color: rgba(255, 248, 236, 0.92);
  cursor: pointer;
  font-size: 0.86rem;
  font-weight: 800;
  line-height: 1.2;
  text-align: left;
  text-shadow: 0 1px 10px rgba(0, 0, 0, 0.34);
  backdrop-filter: blur(18px) saturate(1.16);
  -webkit-backdrop-filter: blur(18px) saturate(1.16);
  transition: border-color 180ms ease, background 180ms ease, transform 180ms ease;
  isolation: isolate;
}

.memory-photo-button:hover {
  border-color: rgba(255, 248, 236, 0.38);
  background: rgba(8, 13, 10, 0.72);
  transform: translateY(-1px);
}

.memory-photo-button:active {
  border-color: rgba(255, 255, 255, 0.52);
  background: rgba(20, 26, 22, 0.86);
  box-shadow:
    0 0 0 1px rgba(255, 255, 255, 0.14) inset,
    0 0 16px rgba(255, 255, 255, 0.12);
  transform: translateY(1px) scale(0.985);
}

.memory-photo-button.is-pressing {
  border-color: rgba(255, 255, 255, 0.52);
  background: rgba(20, 26, 22, 0.86);
  box-shadow:
    0 0 0 1px rgba(255, 255, 255, 0.14) inset,
    0 0 16px rgba(255, 255, 255, 0.12);
  transform: translateY(1px) scale(0.985);
}

.memory-photo-button::before,
.memory-photo-button::after {
  position: absolute;
  z-index: 0;
  width: 300%;
  height: 50%;
  border-radius: 50%;
  content: "";
  pointer-events: none;
  background: radial-gradient(circle, var(--star-border-color), transparent 6%);
  opacity: 0.46;
}

.memory-photo-button::before {
  right: -250%;
  bottom: -8px;
  animation: starMovementBottom var(--star-border-speed) linear infinite alternate;
}

.memory-photo-button::after {
  top: -8px;
  left: -250%;
  animation: starMovementTop var(--star-border-speed) linear infinite alternate;
}

.memory-photo-button:focus-visible {
  outline: 2px solid rgba(255, 248, 236, 0.68);
  outline-offset: 4px;
}

.memory-photo-count {
  flex: 0 0 auto;
  color: rgba(255, 248, 236, 0.66);
  font-size: 0.76rem;
  font-weight: 700;
}

.memory-body {
  padding: 0;
}

.memory-message {
  margin: 6px 0 0;
  color: rgba(255, 118, 105, 0.96);
  line-height: 1.68;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.memory-meta {
  display: block;
  color: rgba(255, 118, 105, 0.98);
  font-size: 0.95rem;
  font-weight: 800;
}

.memory-meta time {
  display: inline;
}

.empty-state {
  margin: 28px 0 0;
  padding: 28px 16px;
  border: 1px dashed rgba(255, 248, 236, 0.34);
  border-radius: 8px;
  background: rgba(255, 248, 236, 0.08);
  color: var(--dim-light);
  text-align: center;
}

.photo-lightbox {
  position: fixed;
  inset: 0;
  z-index: 70;
  display: grid;
  place-items: center;
  padding: 24px;
  overflow: hidden;
  background: rgba(5, 8, 6, 0.72);
  backdrop-filter: blur(16px) saturate(0.9);
  opacity: 0;
  transition: opacity 180ms ease;
}

.photo-lightbox[hidden] {
  display: none;
}

.photo-lightbox.is-open {
  opacity: 1;
}

.photo-lightbox-frame {
  position: relative;
  display: grid;
  place-items: center;
  width: min(82vw, 980px);
  height: min(78vh, 760px);
  margin: 0;
  perspective: 1200px;
}

.photo-lightbox-deck {
  position: relative;
  width: 100%;
  height: 100%;
}

.photo-stack-item {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 0;
  border: 0;
  background: transparent;
  cursor: pointer;
  opacity: 0;
  transform: translate3d(calc(var(--stack-drift, 0) * 32px), calc(44px + var(--stack-depth, 2) * 10px), -160px) scale(calc(0.86 - var(--stack-depth, 2) * 0.035)) rotate(calc(var(--stack-drift, 0) * 2.4deg));
  filter: blur(calc(7px + var(--stack-depth, 2) * 3px)) brightness(calc(0.72 - var(--stack-depth, 2) * 0.08)) saturate(0.82);
  transition:
    opacity 420ms ease,
    filter 420ms ease,
    transform 520ms cubic-bezier(0.22, 1, 0.36, 1);
  will-change: transform, filter, opacity;
}

.photo-stack-item img {
  display: block;
  width: auto;
  height: auto;
  max-width: min(82vw, 980px);
  max-height: min(78vh, 760px);
  border-radius: 10px;
  object-fit: contain;
}

.photo-card-shell {
  --photo-zoom-factor: 1;
  display: grid;
  place-items: center;
  width: fit-content;
  height: fit-content;
  max-width: min(82vw, 980px);
  max-height: min(78vh, 760px);
  padding: 0;
  border: 1px solid rgba(255, 248, 236, 0.16);
  border-radius: 18px;
  background: transparent;
  box-shadow:
    0 32px 86px rgba(0, 0, 0, 0.48),
    0 0 0 1px rgba(255, 255, 255, 0.04) inset;
  transform: scale(var(--photo-zoom-factor));
  transform-origin: center center;
  transition: transform 120ms ease-out;
}

.photo-stack-item.is-active {
  z-index: 20;
  cursor: default;
  opacity: 1;
  transform: translate3d(0, 0, 0) scale(1) rotate(0deg);
  filter: none;
}

.photo-stack-item.is-next {
  z-index: 12;
  opacity: 0.82;
  transform: translate3d(92px, 52px, -54px) scale(0.93) rotate(5deg);
  filter: blur(2.8px) brightness(0.86) saturate(0.92);
}

.photo-stack-item.is-prev {
  z-index: 11;
  opacity: 0.74;
  transform: translate3d(-84px, 64px, -72px) scale(0.91) rotate(-5deg);
  filter: blur(4px) brightness(0.8) saturate(0.88);
}

.photo-stack-item.is-deep {
  z-index: calc(5 - var(--stack-depth, 2));
  opacity: calc(0.4 - var(--stack-depth, 2) * 0.05);
}

.photo-stack-item:focus-visible {
  outline: 2px solid rgba(255, 248, 236, 0.76);
  outline-offset: 8px;
}

.photo-lightbox-close {
  position: absolute;
  top: 20px;
  right: 20px;
  width: 48px;
  height: 48px;
  overflow: hidden;
  border: 1px solid rgba(255, 248, 236, 0.18);
  border-radius: 999px;
  background: rgba(5, 9, 7, 0.58);
  color: var(--light-text);
  cursor: pointer;
  font-size: 1.6rem;
  line-height: 1;
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  isolation: isolate;
}

.photo-lightbox-zoom {
  position: absolute;
  left: 50%;
  bottom: 24px;
  z-index: 2;
  min-width: 72px;
  padding: 8px 14px;
  border: 1px solid rgba(255, 248, 236, 0.18);
  border-radius: 999px;
  background: rgba(10, 15, 11, 0.3);
  color: rgba(255, 248, 236, 0.9);
  font-size: 0.86rem;
  font-weight: 800;
  line-height: 1;
  text-align: center;
  transform: translateX(-50%);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  box-shadow: 0 12px 34px rgba(0, 0, 0, 0.28);
  pointer-events: none;
}

.photo-lightbox-close:hover {
  background: rgba(8, 13, 10, 0.72);
}

.photo-lightbox-close::before,
.photo-lightbox-close::after {
  position: absolute;
  z-index: 0;
  width: 300%;
  height: 50%;
  border-radius: 50%;
  content: "";
  pointer-events: none;
  background: radial-gradient(circle, var(--star-border-color), transparent 10%);
  opacity: 0.68;
}

.photo-lightbox-close::before {
  right: -250%;
  bottom: -12px;
  animation: starMovementBottom var(--star-border-speed) linear infinite alternate;
}

.photo-lightbox-close::after {
  top: -12px;
  left: -250%;
  animation: starMovementTop var(--star-border-speed) linear infinite alternate;
}

.photo-lightbox-nav {
  position: absolute;
  top: 50%;
  z-index: 1;
  display: grid;
  place-items: center;
  width: 54px;
  height: 54px;
  overflow: hidden;
  border: 1px solid rgba(255, 248, 236, 0.18);
  border-radius: 999px;
  background: rgba(5, 9, 7, 0.58);
  color: var(--light-text);
  cursor: pointer;
  font-size: 0;
  transform: translateY(-50%);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  transition: background 180ms ease, border-color 180ms ease, transform 180ms ease;
  isolation: isolate;
}

.photo-lightbox-nav::before {
  position: relative;
  z-index: 1;
  display: block;
  width: 13px;
  height: 13px;
  border-top: 3px solid currentColor;
  border-left: 3px solid currentColor;
  content: "";
}

.photo-lightbox-prev::before {
  transform: translate(2px, 6px) rotate(-45deg);
}

.photo-lightbox-next::before {
  transform: translate(-2px, 6px) rotate(135deg);
}

.photo-lightbox-nav:hover {
  border-color: rgba(255, 248, 236, 0.34);
  background: rgba(8, 13, 10, 0.72);
  transform: translateY(-50%) scale(1.04);
}

.photo-lightbox-nav::after {
  position: absolute;
  top: -12px;
  left: -250%;
  z-index: 0;
  width: 300%;
  height: 50%;
  border-radius: 50%;
  content: "";
  pointer-events: none;
  background: radial-gradient(circle, var(--star-border-color), transparent 10%);
  opacity: 0.68;
  animation: starMovementTop var(--star-border-speed) linear infinite alternate;
}

.photo-lightbox-nav[hidden] {
  display: none;
}

.photo-lightbox-prev {
  left: clamp(14px, 5vw, 70px);
}

.photo-lightbox-next {
  right: clamp(14px, 5vw, 70px);
}

@media (max-width: 820px) {
  body::before {
    background-image: url("./assets/tomb-background-mobile.png?v=2");
    background-position: center center;
  }

  body.mobile-drawer-open {
    overflow: hidden;
  }

  .site-header {
    position: fixed;
    right: 0;
    left: 0;
    min-height: 62px;
    padding-inline: 16px;
    border-bottom: 0;
    background: linear-gradient(180deg, rgba(7, 12, 8, 0.58), rgba(7, 12, 8, 0.18));
    backdrop-filter: blur(16px) saturate(1.05);
    -webkit-backdrop-filter: blur(16px) saturate(1.05);
  }

  .mobile-memory-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 40px;
    padding: 1px 0;
    border: 0;
    border-radius: var(--star-border-radius);
    background: transparent;
    color: var(--light-text);
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: 800;
    backdrop-filter: blur(18px) saturate(1.16);
    -webkit-backdrop-filter: blur(18px) saturate(1.16);
  }

  .hero {
    --mobile-form-bottom: 10px;
    --mobile-form-gap: 18px;
    --mobile-form-height: 114px;
    grid-template-columns: 1fr;
    height: 100svh;
    min-height: 100svh;
    padding: 62px 16px 214px;
    gap: 10px;
  }

  .hero-copy {
    position: fixed;
    right: 12px;
    bottom: calc(var(--mobile-form-bottom) + var(--mobile-form-height) + var(--mobile-form-gap) + env(safe-area-inset-bottom));
    left: 12px;
    z-index: 5;
    max-width: none;
  }

  .mound-scene {
    order: -1;
    min-height: min(58vh, 460px);
  }

  .mound-button {
    min-height: min(58vh, 460px);
  }

  .speech {
    top: clamp(156px, calc(29vh - 50px), 218px);
    left: 43%;
    width: min(300px, calc(100% - 92px));
    max-width: calc(100% - 92px);
    padding: 18px 42px 46px 54px;
    font-size: clamp(0.96rem, 4.5vw, 1.34rem);
  }

  .hero-actions .button {
    flex: 1 1 160px;
  }

  .quick-leave {
    position: fixed;
    right: 12px;
    bottom: calc(var(--mobile-form-bottom) + env(safe-area-inset-bottom));
    left: 12px;
    width: auto;
    max-width: none;
    transform: none;
  }

  .memory-form {
    grid-template-columns: 1fr;
  }

  .quick-memory-form {
    grid-template-columns: 106px minmax(0, 1fr) 108px;
    gap: 8px;
    padding: 0;
  }

  .quick-memory-form label.name-field {
    grid-column: 1 / 2;
    width: auto;
  }

  .quick-memory-form label.message-field {
    grid-column: 2 / -1;
  }

  .quick-memory-form label.quick-file {
    grid-column: 1 / 3;
  }

  .quick-memory-form .form-footer {
    grid-column: 3 / 4;
  }

  .quick-memory-form .file-box {
    align-items: center;
    flex-direction: row;
    justify-content: center;
  }

  .quick-memory-form .button,
  .quick-memory-form .file-box,
  .quick-memory-form input,
  .quick-memory-form textarea {
    min-height: 52px;
  }

  .quick-memory-form .button,
  .quick-memory-form .file-title {
    font-size: 16px;
  }

  .quick-memory-form .button {
    padding: 0;
    white-space: nowrap;
  }

  .quick-memory-form #formStatus {
    bottom: calc(100% + 8px);
    left: 0;
    font-size: 0.82rem;
  }

  .memory-drawer {
    top: 0;
    bottom: 0;
    z-index: 42;
    width: min(88vw, 380px);
    padding: 74px 18px 76px;
    border-left: 1px solid rgba(255, 248, 236, 0.18);
    background: rgba(8, 12, 9, 0.62);
    box-shadow: -24px 0 70px rgba(0, 0, 0, 0.34);
    backdrop-filter: blur(18px) saturate(1.08);
    -webkit-backdrop-filter: blur(18px) saturate(1.08);
    transform: translateX(104%);
    transition: transform 260ms cubic-bezier(0.22, 1, 0.36, 1);
  }

  body.mobile-drawer-open .memory-drawer {
    transform: translateX(0);
  }

  .memory-drawer-close {
    display: grid;
    place-items: center;
    width: 38px;
    height: 38px;
    border: 1px solid rgba(255, 248, 236, 0.18);
    border-radius: 999px;
    background: rgba(5, 9, 7, 0.58);
    color: var(--light-text);
    cursor: pointer;
    font-size: 1.25rem;
    line-height: 1;
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
  }

  .mobile-drawer-backdrop {
    position: fixed;
    inset: 0;
    z-index: 36;
    display: block;
    border: 0;
    background: rgba(0, 0, 0, 0.28);
    opacity: 0;
    pointer-events: none;
    transition: opacity 220ms ease;
  }

  body.mobile-drawer-open .mobile-drawer-backdrop {
    opacity: 1;
    pointer-events: auto;
  }

  .memories {
    max-height: calc(100svh - 164px);
    padding-right: 2px;
  }

  .form-footer,
  .file-box {
    align-items: stretch;
    flex-direction: column;
  }

  .file-name {
    text-align: left;
  }
}

@media (max-width: 520px) {
  .hero {
    padding-inline: 16px;
  }

  .button {
    width: 100%;
  }

  .quick-leave {
    margin-top: 12px;
    right: 10px;
    bottom: calc(var(--mobile-form-bottom) + env(safe-area-inset-bottom));
    left: 10px;
  }

  .quick-memory-form {
    grid-template-columns: 96px minmax(0, 1fr) 104px;
    gap: 8px;
    padding: 0;
  }

  .quick-memory-form label.name-field {
    grid-column: 1 / 2;
    width: auto;
  }

  .quick-memory-form label.message-field {
    grid-column: 2 / -1;
  }

  .quick-memory-form label.quick-file {
    grid-column: 1 / 3;
  }

  .quick-memory-form .form-footer {
    grid-column: 3 / 4;
  }

  .quick-memory-form input,
  .quick-memory-form textarea,
  .quick-memory-form .file-box,
  .quick-memory-form .button {
    min-height: 52px;
  }

  .quick-memory-form input,
  .quick-memory-form textarea {
    padding-inline: 10px;
  }

  .quick-memory-form .file-box {
    padding-inline: 10px;
  }

  .quick-memory-form .file-title {
    gap: 6px;
    font-size: 16px;
  }

  .quick-memory-form #formStatus {
    bottom: -24px;
    font-size: 0.82rem;
  }

  .quick-memory-form .preview {
    right: 8px;
    width: min(180px, calc(100vw - 32px));
  }

  .mound-button {
    min-height: 330px;
  }

  .speech {
    top: clamp(162px, calc(29vh - 50px), 208px);
    left: 43%;
    width: min(292px, calc(100% - 92px));
    max-width: calc(100% - 92px);
    padding: 16px 40px 48px 52px;
    font-size: clamp(0.94rem, 4.4vw, 1.26rem);
  }
}

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

  .atmosphere {
    display: none;
  }
}
