.memory-page {
  position: absolute;
  inset: 0;
  z-index: 8;
  --memory-paper: #d7d7d7;
  --memory-ticket: rgba(255, 255, 255, .58);
  --memory-layer: rgba(255, 255, 255, .28);
  --memory-stamp: rgba(238, 238, 236, .94);
  --memory-border: rgba(62, 62, 62, .70);
  --memory-ink: #292929;
  --memory-muted: #626262;
  --memory-faint: rgba(42, 42, 42, .42);
  --memory-tab-bg: rgba(255, 255, 255, .09);
  --memory-tab-active: #171717;
  --memory-tab-active-ink: #f5f5f2;
  --memory-page-wash: linear-gradient(180deg, rgba(218, 218, 216, .96), rgba(205, 205, 203, .94));
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  gap: 0;
  height: 100%;
  min-height: 0;
  padding:
    max(54px, calc(env(safe-area-inset-top) + 40px))
    max(14px, env(safe-area-inset-right))
    max(16px, env(safe-area-inset-bottom))
    max(14px, env(safe-area-inset-left));
  overflow: hidden;
  color: var(--memory-ink);
  background:
    var(--memory-page-wash),
    var(--screen-wallpaper, var(--screen-default-wallpaper));
  background-position: center;
  background-size: cover;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  isolation: isolate;
  transition: opacity .22s ease, visibility 0s linear .22s;
}

.memory-page::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background:
    repeating-linear-gradient(177deg, transparent 0 7px, rgba(0, 0, 0, .014) 8px, transparent 9px 15px),
    repeating-linear-gradient(91deg, transparent 0 18px, rgba(255, 255, 255, .035) 19px, transparent 20px 34px);
  opacity: .72;
}

.memory-page.open {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  transition-delay: 0s;
}

.memory-header {
  position: relative;
  z-index: 2;
  margin-bottom: 38px;
  opacity: 0;
  transform: translateY(-10px);
}

.memory-page.open .memory-header {
  animation: memory-header-emerge .48s cubic-bezier(.2, .8, .24, 1) both;
}

.memory-masthead {
  position: relative;
  padding: 8px 0 10px;
  border-top: 3px solid var(--memory-ink);
  border-bottom: 3px solid var(--memory-ink);
  background: rgba(255, 255, 255, .09);
  text-align: center;
  -webkit-backdrop-filter: blur(10px) saturate(100%);
  backdrop-filter: blur(10px) saturate(100%);
  -webkit-mask-image: linear-gradient(83deg, #000 4%, rgba(0, 0, 0, .26) 12%, #000 22%, #000 44%, rgba(0, 0, 0, .18) 51%, #000 60%, rgba(0, 0, 0, .38) 79%, #000 93%);
  mask-image: linear-gradient(83deg, #000 4%, rgba(0, 0, 0, .26) 12%, #000 22%, #000 44%, rgba(0, 0, 0, .18) 51%, #000 60%, rgba(0, 0, 0, .38) 79%, #000 93%);
}

.memory-masthead::after {
  content: "";
  position: absolute;
  right: 0;
  bottom: 3px;
  left: 0;
  height: 1px;
  background: var(--memory-ink);
}

.memory-meta-bar {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
  margin-bottom: 7px;
  padding: 0 2px 5px;
  border-bottom: 1px solid var(--memory-ink);
  color: var(--memory-ink);
  font-family: Georgia, "Times New Roman", serif;
  font-size: 9px;
  font-weight: 700;
  line-height: 1.15;
  white-space: nowrap;
}

.memory-meta-bar span:nth-child(2) {
  overflow: hidden;
  text-overflow: ellipsis;
}

.memory-masthead h1 {
  margin: 0;
  padding: 0 42px;
  overflow-wrap: anywhere;
  color: var(--memory-ink);
  font-family: "Songti SC", SimSun, STSong, serif;
  font-size: 23px;
  font-weight: 900;
  letter-spacing: 0;
  line-height: 1.08;
  -webkit-mask-image:
    linear-gradient(8deg, #000 12%, rgba(0, 0, 0, .48) 28%, #000 43%, rgba(0, 0, 0, .72) 66%, #000 86%),
    linear-gradient(-75deg, #000 15%, rgba(0, 0, 0, .34) 40%, #000 75%);
  -webkit-mask-composite: source-in;
  mask-composite: intersect;
}

.memory-page[data-memory-view="detail"] .memory-masthead h1 {
  font-size: 18px;
  line-height: 1.16;
}

.memory-back {
  position: absolute;
  z-index: 3;
  bottom: 3px;
  left: 0;
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  color: var(--memory-ink);
  border: 0;
  border-radius: 0;
  background: transparent;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.memory-back span {
  display: block;
  width: 12px;
  height: 12px;
  border-bottom: 1.5px solid currentColor;
  border-left: 1.5px solid currentColor;
  transform: rotate(45deg) translate(2px, -2px);
}

.memory-back:focus-visible {
  outline: 1px solid currentColor;
  outline-offset: -5px;
}

.memory-content {
  min-height: 0;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 12px 10px 54px;
  scrollbar-width: none;
}

.memory-content::-webkit-scrollbar {
  width: 0;
  height: 0;
}

.memory-list {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 36px;
  width: 100%;
  max-width: 560px;
  margin: 0 auto;
}

.memory-scene {
  position: relative;
  width: 100%;
  opacity: 0;
  filter: blur(7px);
  transform: translateY(22px) scale(.985);
  content-visibility: auto;
  contain-intrinsic-size: auto 320px;
  isolation: isolate;
}

.memory-page.open .memory-scene {
  opacity: 1;
  filter: none;
  transform: none;
}

.memory-page.open .memory-scene:nth-child(-n + 9) {
  animation: memory-ticket-emerge .68s cubic-bezier(.16, .78, .23, 1) both;
  animation-delay: calc(90ms + var(--memory-index, 0) * 65ms);
}

.memory-paper-layer {
  position: absolute;
  z-index: 0;
  top: -11px;
  right: -7px;
  bottom: 10px;
  left: -4px;
  border: 1px solid color-mix(in srgb, var(--memory-border) 76%, transparent);
  background: var(--memory-layer);
  box-shadow:
    0 10px 22px rgba(0, 0, 0, .08),
    inset 0 1px 0 rgba(255, 255, 255, .42);
  transform: rotate(-1.6deg);
  -webkit-backdrop-filter: blur(9px) saturate(100%);
  backdrop-filter: blur(9px) saturate(100%);
  -webkit-mask-image:
    radial-gradient(circle at 20% 80%, rgba(0, 0, 0, .30) 0%, #000 42%),
    radial-gradient(ellipse at 85% 15%, rgba(0, 0, 0, .22) 0%, #000 52%);
  -webkit-mask-composite: source-in;
  mask-composite: intersect;
}

.memory-ticket-wrapper {
  position: relative;
  z-index: 1;
  filter:
    drop-shadow(0 12px 22px rgba(0, 0, 0, .10))
    drop-shadow(0 2px 2px rgba(0, 0, 0, .15));
  transition: transform .12s ease;
}

.memory-ticket-action {
  position: absolute;
  z-index: 7;
  inset: -3px;
  display: block;
  width: calc(100% + 6px);
  height: calc(100% + 6px);
  padding: 0;
  color: var(--memory-ink);
  border: 0;
  border-radius: 0;
  background: transparent;
  cursor: pointer;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}

.memory-ticket-action:focus-visible {
  outline: 2px solid currentColor;
  outline-offset: 2px;
}

.memory-scene:has(.memory-ticket-action:active) .memory-ticket-wrapper {
  transform: scale(.985);
}

.memory-ticket {
  position: relative;
  display: flex;
  width: 100%;
  aspect-ratio: 1.75 / 1;
  min-height: 0;
  padding: 10px;
  overflow: hidden;
  background: var(--memory-ticket);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, .70),
    inset 0 -1px 0 rgba(255, 255, 255, .22);
  -webkit-backdrop-filter: blur(17px) saturate(100%);
  backdrop-filter: blur(17px) saturate(100%);
  -webkit-mask-image:
    radial-gradient(circle at 0 50%, transparent 5px, #000 5.5px),
    radial-gradient(circle at 100% 50%, transparent 5px, #000 5.5px),
    radial-gradient(circle at 65% 0, transparent 10px, #000 10.5px),
    radial-gradient(circle at 65% 100%, transparent 10px, #000 10.5px);
  -webkit-mask-size: 100% 26px, 100% 26px, 100% 100%, 100% 100%;
  -webkit-mask-repeat: repeat-y, repeat-y, no-repeat, no-repeat;
  -webkit-mask-composite: source-in, source-in, source-in;
  mask-image:
    radial-gradient(circle at 0 50%, transparent 5px, #000 5.5px),
    radial-gradient(circle at 100% 50%, transparent 5px, #000 5.5px),
    radial-gradient(circle at 65% 0, transparent 10px, #000 10.5px),
    radial-gradient(circle at 65% 100%, transparent 10px, #000 10.5px);
  mask-size: 100% 26px, 100% 26px, 100% 100%, 100% 100%;
  mask-repeat: repeat-y, repeat-y, no-repeat, no-repeat;
  mask-composite: intersect;
}

.memory-ticket-border {
  position: absolute;
  z-index: 4;
  inset: 7px 10px;
  border: 1px solid var(--memory-border);
  pointer-events: none;
  -webkit-mask-image:
    linear-gradient(to bottom, #000 8%, transparent 15%, #000 22%, #000 45%, rgba(0, 0, 0, .16) 52%, #000 66%, #000 82%, rgba(0, 0, 0, .12) 90%, #000 96%),
    linear-gradient(to right, #000 5%, rgba(0, 0, 0, .18) 18%, #000 26%, #000 55%, transparent 68%, #000 78%, #000 89%, rgba(0, 0, 0, .24) 96%);
  -webkit-mask-composite: source-in;
  mask-composite: intersect;
}

.memory-ticket-divider {
  position: absolute;
  z-index: 3;
  top: 7px;
  bottom: 7px;
  left: 65%;
  border-left: 2px dotted var(--memory-border);
  pointer-events: none;
  -webkit-mask-image: linear-gradient(173deg, #000 12%, rgba(0, 0, 0, .12) 26%, #000 33%, #000 58%, rgba(0, 0, 0, .15) 68%, #000 76%, rgba(0, 0, 0, .28) 91%, #000 98%);
  mask-image: linear-gradient(173deg, #000 12%, rgba(0, 0, 0, .12) 26%, #000 33%, #000 58%, rgba(0, 0, 0, .15) 68%, #000 76%, rgba(0, 0, 0, .28) 91%, #000 98%);
}

.memory-character-section {
  display: flex;
  align-items: stretch;
  width: 65%;
  min-width: 0;
  padding-right: 10px;
}

.memory-character-avatar {
  position: relative;
  display: grid;
  place-items: center;
  width: 100%;
  min-width: 0;
  overflow: hidden;
  padding: 2px;
  border: 1px solid color-mix(in srgb, var(--memory-border) 88%, transparent);
  background:
    linear-gradient(145deg, rgba(255, 255, 255, .22), rgba(0, 0, 0, .035)),
    rgba(255, 255, 255, .13);
  -webkit-mask-image: radial-gradient(ellipse at 85% 85%, rgba(0, 0, 0, .45) 0%, #000 52%);
  mask-image: radial-gradient(ellipse at 85% 85%, rgba(0, 0, 0, .45) 0%, #000 52%);
}

.memory-character-avatar img,
.memory-persona-stamp img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
}

.memory-character-avatar img {
  filter: none;
}

.memory-avatar-empty {
  display: grid;
  place-items: center;
  width: 100%;
  height: 100%;
  color: color-mix(in srgb, var(--memory-ink) 76%, transparent);
  background:
    linear-gradient(153deg, transparent 49%, color-mix(in srgb, var(--memory-border) 36%, transparent) 50% 50.5%, transparent 51%),
    linear-gradient(28deg, transparent 48%, color-mix(in srgb, var(--memory-border) 24%, transparent) 49% 49.5%, transparent 50%);
  font-family: Georgia, "Times New Roman", serif;
  font-size: 40px;
  font-weight: 700;
}

.memory-info {
  position: relative;
  z-index: 2;
  display: flex;
  flex-direction: column;
  justify-content: center;
  width: 35%;
  min-width: 0;
  padding: 10px 6px 10px 14px;
  -webkit-mask-image: radial-gradient(circle at 90% 90%, rgba(0, 0, 0, .55) 0%, #000 62%);
  mask-image: radial-gradient(circle at 90% 90%, rgba(0, 0, 0, .55) 0%, #000 62%);
}

.memory-character-name {
  margin: 0 0 10px;
  overflow: hidden;
  color: var(--memory-ink);
  text-overflow: ellipsis;
  white-space: nowrap;
  font-family: Georgia, "Times New Roman", "Songti SC", serif;
  font-size: 20px;
  font-weight: 900;
  line-height: 1.12;
}

.memory-stats {
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-width: 0;
  margin: 0;
  padding: 0;
  list-style: none;
}

.memory-stats li {
  display: flex;
  align-items: center;
  min-width: 0;
  color: var(--memory-muted);
  font-family: "Songti SC", SimSun, serif;
  font-size: 11px;
  line-height: 1.2;
  white-space: nowrap;
}

.memory-stat-label {
  display: inline-block;
  flex: 0 0 2em;
  width: 2em;
  text-align: left;
}

.memory-stat-separator {
  flex: 0 0 auto;
  margin: 0 5px;
  color: var(--memory-faint);
  font-family: sans-serif;
  font-size: 9px;
}

.memory-stat-value {
  min-width: 0;
  overflow: hidden;
  color: var(--memory-ink);
  text-overflow: ellipsis;
  white-space: nowrap;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-weight: 650;
}

.memory-persona-stamp {
  position: absolute;
  z-index: 5;
  right: calc(35% + 10px);
  bottom: 16px;
  height: 34%;
  aspect-ratio: 1;
  overflow: hidden;
  border: 1px solid color-mix(in srgb, var(--memory-border) 90%, transparent);
  background: var(--memory-stamp);
  box-shadow: inset 0 0 0 2px rgba(255, 255, 255, .40);
  filter: drop-shadow(0 2px 2px rgba(0, 0, 0, .20));
  transform: rotate(-8deg);
  pointer-events: none;
  -webkit-mask-image:
    radial-gradient(circle at 0 50%, transparent 4px, #000 4.5px),
    radial-gradient(circle at 100% 50%, transparent 4px, #000 4.5px),
    radial-gradient(circle at 50% 0, transparent 4px, #000 4.5px),
    radial-gradient(circle at 50% 100%, transparent 4px, #000 4.5px);
  -webkit-mask-size: 100% 22px, 100% 22px, 22px 100%, 22px 100%;
  -webkit-mask-repeat: repeat-y, repeat-y, repeat-x, repeat-x;
  -webkit-mask-composite: source-in, source-in, source-in;
  mask-image:
    radial-gradient(circle at 0 50%, transparent 4px, #000 4.5px),
    radial-gradient(circle at 100% 50%, transparent 4px, #000 4.5px),
    radial-gradient(circle at 50% 0, transparent 4px, #000 4.5px),
    radial-gradient(circle at 50% 100%, transparent 4px, #000 4.5px);
  mask-size: 100% 22px, 100% 22px, 22px 100%, 22px 100%;
  mask-repeat: repeat-y, repeat-y, repeat-x, repeat-x;
  mask-composite: intersect;
}

.memory-persona-stamp::after {
  content: "";
  position: absolute;
  z-index: 2;
  inset: 6px;
  border: 1px solid color-mix(in srgb, var(--memory-border) 76%, transparent);
  pointer-events: none;
}

.memory-persona-stamp .memory-avatar-media {
  position: absolute;
  inset: 7px;
  overflow: hidden;
  background: rgba(255, 255, 255, .16);
}

.memory-persona-stamp img {
  filter: none;
}

.memory-persona-stamp .memory-avatar-empty {
  font-size: 22px;
}

.memory-status,
.memory-empty {
  width: min(100%, 560px);
  margin: 12px auto 0;
  color: var(--memory-muted);
  text-align: center;
  font-family: "Songti SC", SimSun, serif;
}

.memory-status {
  padding: 22px 18px;
  border-top: 1px solid color-mix(in srgb, var(--memory-border) 55%, transparent);
  border-bottom: 1px solid color-mix(in srgb, var(--memory-border) 55%, transparent);
  font-size: 13px;
  line-height: 1.65;
}

.memory-status[data-tone="error"] {
  color: var(--memory-ink);
}

.memory-empty {
  display: grid;
  justify-items: center;
  gap: 8px;
  padding: 42px 16px;
  border-top: 3px double var(--memory-border);
  border-bottom: 3px double var(--memory-border);
}

.memory-empty[hidden],
.memory-status[hidden],
.memory-list[hidden],
.memory-detail[hidden],
.memory-detail-panel[hidden] {
  display: none;
}

.memory-empty-number {
  color: var(--memory-faint);
  font-family: Georgia, "Times New Roman", serif;
  font-size: 34px;
  font-weight: 700;
  line-height: 1;
}

.memory-empty strong {
  color: var(--memory-ink);
  font-family: "Songti SC", SimSun, serif;
  font-size: 16px;
  font-weight: 700;
}

.memory-empty small {
  color: var(--memory-muted);
  font-family: Georgia, "Times New Roman", serif;
  font-size: 9px;
  font-weight: 700;
}

.memory-detail {
  display: grid;
  align-content: start;
  justify-items: stretch;
  gap: 20px;
  width: min(100%, 560px);
  min-height: 0;
  margin: 0 auto;
  padding: 0 0 64px;
  text-align: center;
  opacity: 0;
  filter: blur(7px);
  transform: translateY(18px);
}

.memory-page[data-memory-view="detail"] .memory-detail:not([hidden]) {
  animation: memory-detail-emerge .52s cubic-bezier(.16, .78, .23, 1) both;
}

.memory-detail-ticket-scene {
  position: relative;
  width: 100%;
}

.memory-detail-ticket-wrapper {
  position: relative;
  z-index: 1;
  filter:
    drop-shadow(0 12px 22px rgba(0, 0, 0, .10))
    drop-shadow(0 2px 2px rgba(0, 0, 0, .15));
}

.memory-detail-ticket {
  position: relative;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  width: 100%;
  aspect-ratio: 1.75 / 1;
  min-height: 0;
  padding: 10px;
  overflow: hidden;
  background: var(--memory-ticket);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, .70),
    inset 0 -1px 0 rgba(255, 255, 255, .22);
  -webkit-backdrop-filter: blur(17px) saturate(100%);
  backdrop-filter: blur(17px) saturate(100%);
  -webkit-mask-image:
    radial-gradient(circle at 0 50%, transparent 5px, #000 5.5px),
    radial-gradient(circle at 100% 50%, transparent 5px, #000 5.5px),
    radial-gradient(circle at 50% 0, transparent 10px, #000 10.5px),
    radial-gradient(circle at 50% 100%, transparent 10px, #000 10.5px);
  -webkit-mask-size: 100% 26px, 100% 26px, 100% 100%, 100% 100%;
  -webkit-mask-repeat: repeat-y, repeat-y, no-repeat, no-repeat;
  -webkit-mask-composite: source-in, source-in, source-in;
  mask-image:
    radial-gradient(circle at 0 50%, transparent 5px, #000 5.5px),
    radial-gradient(circle at 100% 50%, transparent 5px, #000 5.5px),
    radial-gradient(circle at 50% 0, transparent 10px, #000 10.5px),
    radial-gradient(circle at 50% 100%, transparent 10px, #000 10.5px);
  mask-size: 100% 26px, 100% 26px, 100% 100%, 100% 100%;
  mask-repeat: repeat-y, repeat-y, no-repeat, no-repeat;
  mask-composite: intersect;
}

.memory-detail-ticket-border {
  position: absolute;
  z-index: 4;
  inset: 7px 10px;
  border: 1px solid var(--memory-border);
  pointer-events: none;
  -webkit-mask-image:
    linear-gradient(to bottom, #000 8%, transparent 15%, #000 22%, #000 46%, rgba(0, 0, 0, .16) 53%, #000 66%, #000 83%, rgba(0, 0, 0, .12) 90%, #000 96%),
    linear-gradient(to right, #000 5%, rgba(0, 0, 0, .18) 18%, #000 27%, #000 45%, transparent 50%, #000 55%, #000 78%, rgba(0, 0, 0, .24) 96%);
  -webkit-mask-composite: source-in;
  mask-composite: intersect;
}

.memory-detail-ticket-divider {
  position: absolute;
  z-index: 3;
  top: 7px;
  bottom: 7px;
  left: 50%;
  border-left: 2px dotted var(--memory-border);
  pointer-events: none;
  -webkit-mask-image: linear-gradient(173deg, #000 12%, rgba(0, 0, 0, .12) 26%, #000 33%, #000 58%, rgba(0, 0, 0, .15) 68%, #000 76%, rgba(0, 0, 0, .28) 91%, #000 98%);
  mask-image: linear-gradient(173deg, #000 12%, rgba(0, 0, 0, .12) 26%, #000 33%, #000 58%, rgba(0, 0, 0, .15) 68%, #000 76%, rgba(0, 0, 0, .28) 91%, #000 98%);
}

.memory-detail-avatar-pane {
  position: relative;
  z-index: 2;
  display: flex;
  min-width: 0;
  min-height: 0;
}

.memory-detail-avatar-pane-character {
  padding: 2px 12px 2px 2px;
}

.memory-detail-avatar-pane-persona {
  padding: 2px 2px 2px 12px;
}

.memory-detail-avatar-slot,
.memory-detail-avatar-media {
  width: 100%;
  height: 100%;
  min-width: 0;
  min-height: 0;
}

.memory-detail-avatar-media {
  position: relative;
  display: grid;
  place-items: center;
  overflow: hidden;
  padding: 2px;
  border: 1px solid color-mix(in srgb, var(--memory-border) 88%, transparent);
  background:
    linear-gradient(145deg, rgba(255, 255, 255, .22), rgba(0, 0, 0, .035)),
    rgba(255, 255, 255, .13);
}

.memory-detail-avatar-media img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
  filter: none;
}

.memory-detail-avatar-media .memory-avatar-empty {
  font-size: 38px;
}

.memory-detail-tabs {
  position: relative;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0;
  width: 100%;
  min-height: 54px;
  padding: 8px 0 10px;
  border: 0;
  border-radius: 0;
  background: var(--memory-tab-bg);
  box-shadow: none;
  -webkit-backdrop-filter: blur(10px) saturate(100%);
  backdrop-filter: blur(10px) saturate(100%);
  isolation: isolate;
}

.memory-detail-tabs::before,
.memory-detail-tabs::after {
  content: "";
  position: absolute;
  z-index: 2;
  right: 0;
  left: 0;
  pointer-events: none;
}

.memory-detail-tabs::before {
  top: 0;
  height: 3px;
  background: color-mix(in srgb, var(--memory-ink) 82%, transparent);
  -webkit-mask-image: linear-gradient(90deg, #000 0 7%, rgba(0, 0, 0, .22) 11%, #000 19%, #000 38%, rgba(0, 0, 0, .30) 45%, #000 56%, rgba(0, 0, 0, .18) 73%, #000 82%, rgba(0, 0, 0, .42) 91%, #000 100%);
  mask-image: linear-gradient(90deg, #000 0 7%, rgba(0, 0, 0, .22) 11%, #000 19%, #000 38%, rgba(0, 0, 0, .30) 45%, #000 56%, rgba(0, 0, 0, .18) 73%, #000 82%, rgba(0, 0, 0, .42) 91%, #000 100%);
}

.memory-detail-tabs::after {
  bottom: 0;
  height: 7px;
  background:
    linear-gradient(
      to bottom,
      color-mix(in srgb, var(--memory-ink) 66%, transparent) 0 1px,
      transparent 1px 4px,
      color-mix(in srgb, var(--memory-ink) 82%, transparent) 4px 7px
    );
  -webkit-mask-image: linear-gradient(90deg, #000 0 5%, rgba(0, 0, 0, .32) 13%, #000 22%, rgba(0, 0, 0, .18) 35%, #000 47%, #000 63%, rgba(0, 0, 0, .24) 71%, #000 84%, rgba(0, 0, 0, .38) 94%, #000 100%);
  mask-image: linear-gradient(90deg, #000 0 5%, rgba(0, 0, 0, .32) 13%, #000 22%, rgba(0, 0, 0, .18) 35%, #000 47%, #000 63%, rgba(0, 0, 0, .24) 71%, #000 84%, rgba(0, 0, 0, .38) 94%, #000 100%);
}

.memory-detail-tabs button {
  position: relative;
  z-index: 1;
  min-width: 0;
  min-height: 36px;
  padding: 0 4px;
  overflow: hidden;
  color: var(--memory-muted);
  text-overflow: ellipsis;
  white-space: nowrap;
  border: 1px solid transparent;
  border-radius: 0;
  background: transparent;
  font-family: "Songti SC", SimSun, serif;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  transition: color .16s ease, background-color .16s ease, box-shadow .16s ease;
}

.memory-detail-tabs button + button {
  border-left-color: color-mix(in srgb, var(--memory-border) 42%, transparent);
}

.memory-detail-tabs button[aria-selected="true"] {
  color: var(--memory-tab-active-ink);
  border-color: rgba(255, 255, 255, .12);
  background: var(--memory-tab-active);
  box-shadow:
    2px 3px 9px rgba(0, 0, 0, .16),
    inset 0 0 0 1px rgba(255, 255, 255, .06);
}

.memory-detail-tabs button:focus-visible {
  outline: 1px solid var(--memory-ink);
  outline-offset: 2px;
}

.memory-detail-panels {
  min-height: 184px;
}

.memory-detail-panel {
  display: grid;
  align-content: center;
  justify-items: center;
  gap: 9px;
  min-height: 184px;
  padding: 30px 14px;
  border-top: 3px double var(--memory-border);
  border-bottom: 3px double var(--memory-border);
  opacity: 0;
  transform: translateY(8px);
  animation: memory-detail-panel-emerge .32s ease both;
}

.memory-detail-panel > span {
  display: block;
  width: 44px;
  height: 1px;
  margin-bottom: 4px;
  background: var(--memory-border);
}

.memory-detail-panel strong {
  color: var(--memory-ink);
  font-family: "Songti SC", SimSun, serif;
  font-size: 16px;
  font-weight: 700;
}

.memory-detail-panel small {
  color: var(--memory-muted);
  font-family: "Songti SC", SimSun, serif;
  font-size: 11px;
  font-weight: 600;
}

html.night-mode .memory-page {
  --memory-paper: #171717;
  --memory-ticket: rgba(238, 238, 235, .16);
  --memory-layer: rgba(238, 238, 235, .08);
  --memory-stamp: rgba(202, 202, 198, .30);
  --memory-border: rgba(232, 232, 226, .58);
  --memory-ink: #ededE8;
  --memory-muted: rgba(237, 237, 232, .66);
  --memory-faint: rgba(237, 237, 232, .38);
  --memory-tab-bg: rgba(255, 255, 255, .035);
  --memory-tab-active: #050505;
  --memory-tab-active-ink: #f2f2ee;
  --memory-page-wash: linear-gradient(180deg, rgba(13, 13, 14, .84), rgba(4, 4, 5, .88));
}

html.night-mode .memory-masthead {
  background: rgba(255, 255, 255, .035);
}

html.night-mode .memory-character-avatar,
html.night-mode .memory-persona-stamp .memory-avatar-media,
html.night-mode .memory-detail-avatar-media {
  background: rgba(255, 255, 255, .055);
}

html.night-mode .memory-detail-tabs button[aria-selected="true"] {
  border-color: rgba(255, 255, 255, .22);
  box-shadow:
    2px 3px 10px rgba(0, 0, 0, .32),
    inset 0 0 0 1px rgba(255, 255, 255, .12);
}

html.night-mode .screen.memory-open .status-bar,
html.night-mode .screen.memory-open .status-right {
  color: var(--memory-ink);
}

@media (min-width: 601px) {
  .memory-page {
    padding-right: max(20px, env(safe-area-inset-right));
    padding-left: max(20px, env(safe-area-inset-left));
  }

  .memory-header {
    margin-bottom: 50px;
  }

  .memory-masthead {
    padding: 12px 0 15px;
    border-top-width: 4px;
    border-bottom-width: 4px;
  }

  .memory-masthead::after {
    bottom: 4px;
  }

  .memory-meta-bar {
    gap: 12px;
    margin-bottom: 13px;
    padding-bottom: 8px;
    font-size: 11px;
  }

  .memory-masthead h1 {
    font-size: 32px;
  }

  .memory-page[data-memory-view="detail"] .memory-masthead h1 {
    font-size: 26px;
  }

  .memory-back {
    bottom: 5px;
  }

  .memory-ticket {
    aspect-ratio: 2.3 / 1;
    padding: 12px;
  }

  .memory-ticket-border {
    inset: 8px 12px;
  }

  .memory-ticket-divider {
    top: 8px;
    bottom: 8px;
  }

  .memory-character-section {
    padding-right: 15px;
  }

  .memory-info {
    padding: 10px 10px 10px 25px;
  }

  .memory-character-name {
    margin-bottom: 15px;
    font-size: 24px;
  }

  .memory-stats {
    gap: 11px;
  }

  .memory-stats li {
    font-size: 13px;
  }

  .memory-stat-separator {
    margin: 0 8px;
    font-size: 10px;
  }

  .memory-persona-stamp {
    right: calc(35% + 12px);
    bottom: 18px;
    height: 32%;
  }

  .memory-detail-ticket {
    aspect-ratio: 2.3 / 1;
    padding: 12px;
  }

  .memory-detail-ticket-border {
    inset: 8px 12px;
  }

  .memory-detail-ticket-divider {
    top: 8px;
    bottom: 8px;
  }

  .memory-detail-avatar-pane-character {
    padding: 2px 15px 2px 2px;
  }

  .memory-detail-avatar-pane-persona {
    padding: 2px 2px 2px 15px;
  }

  .memory-detail-tabs button {
    font-size: 13px;
  }
}

@media (max-width: 360px) {
  .memory-page {
    padding-right: max(9px, env(safe-area-inset-right));
    padding-left: max(9px, env(safe-area-inset-left));
  }

  .memory-header {
    margin-bottom: 32px;
  }

  .memory-meta-bar {
    gap: 5px;
    font-size: 8px;
  }

  .memory-masthead h1 {
    font-size: 21px;
  }

  .memory-page[data-memory-view="detail"] .memory-masthead h1 {
    font-size: 17px;
  }

  .memory-content {
    padding-right: 7px;
    padding-left: 7px;
  }

  .memory-ticket {
    aspect-ratio: 1.6 / 1;
  }

  .memory-character-section {
    padding-right: 8px;
  }

  .memory-info {
    padding: 8px 4px 8px 11px;
  }

  .memory-character-name {
    margin-bottom: 8px;
    font-size: 18px;
  }

  .memory-stats {
    gap: 6px;
  }

  .memory-stats li {
    font-size: 10px;
  }

  .memory-persona-stamp {
    right: calc(35% + 8px);
    bottom: 14px;
  }

  .memory-detail {
    gap: 16px;
  }

  .memory-detail-ticket {
    aspect-ratio: 1.6 / 1;
  }

  .memory-detail-avatar-pane-character {
    padding-right: 9px;
  }

  .memory-detail-avatar-pane-persona {
    padding-left: 9px;
  }

  .memory-detail-tabs {
    gap: 0;
    padding: 8px 0 10px;
  }

  .memory-detail-tabs button {
    padding-inline: 2px;
    font-size: 11px;
  }
}

@keyframes memory-header-emerge {
  from {
    opacity: 0;
    filter: blur(5px);
    transform: translateY(-10px);
  }
  to {
    opacity: 1;
    filter: blur(0);
    transform: translateY(0);
  }
}

@keyframes memory-ticket-emerge {
  from {
    opacity: 0;
    filter: blur(7px);
    transform: translateY(22px) scale(.985);
  }
  to {
    opacity: 1;
    filter: blur(0);
    transform: translateY(0) scale(1);
  }
}

@keyframes memory-detail-emerge {
  from {
    opacity: 0;
    filter: blur(7px);
    transform: translateY(18px);
  }
  to {
    opacity: 1;
    filter: blur(0);
    transform: translateY(0);
  }
}

@keyframes memory-detail-panel-emerge {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (prefers-reduced-motion: reduce) {
  .memory-page,
  .memory-page.open,
  .memory-page.open .memory-header,
  .memory-page.open .memory-scene,
  .memory-page[data-memory-view="detail"] .memory-detail:not([hidden]),
  .memory-detail-panel:not([hidden]) {
    animation: none;
    transition: none;
  }

  .memory-header,
  .memory-scene,
  .memory-detail,
  .memory-detail-panel {
    opacity: 1;
    filter: none;
    transform: none;
  }
}

html.low-performance-mode .memory-page,
html.low-performance-mode .memory-page.open,
html.low-performance-mode .memory-page.open .memory-header,
html.low-performance-mode .memory-page.open .memory-scene,
html.low-performance-mode .memory-page[data-memory-view="detail"] .memory-detail:not([hidden]),
html.low-performance-mode .memory-detail-panel:not([hidden]) {
  animation: none;
  transition: none;
}

html.low-performance-mode .memory-header,
html.low-performance-mode .memory-scene,
html.low-performance-mode .memory-detail,
html.low-performance-mode .memory-detail-panel {
  opacity: 1;
  filter: none;
  transform: none;
}
