:root {
  --yellow: #ffd400;
  --ink: #111111;
  --paper: #fff9df;
  --green: #00c86b;
  --pink: #ff3d86;
  --blue: #2f80ed;
  --orange: #ff8a2a;
  --shadow: #000000;
  --muted: rgba(17, 17, 17, 0.68);
  --radius: 8px;
  --gap: 22px;
  --cursor-home: url("assets/cursor-wand.svg") 10 8, auto;
  --cursor-page: url("assets/cursor-watermelon.svg") 10 8, auto;
  --cursor-active: var(--cursor-home);
}

* {
  box-sizing: border-box;
}

html,
body {
  width: 100%;
  height: 100%;
}

body {
  margin: 0;
  color: var(--ink);
  font-family:
    "Arial Black", "Microsoft YaHei", "PingFang SC", "Noto Sans CJK SC",
    system-ui, sans-serif;
  background: #000;
  overflow: hidden;
  cursor: var(--cursor-active);
}

body.is-home {
  --cursor-active: var(--cursor-home);
}

body.is-page {
  --cursor-active: var(--cursor-page);
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  cursor: var(--cursor-active);
}

.app-shell {
  width: 100%;
  height: 100vh;
  overflow: hidden;
}

.view {
  display: none;
}

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

.music-dock {
  position: fixed;
  z-index: 12;
  left: clamp(14px, 3vw, 28px);
  bottom: clamp(14px, 3vw, 28px);
  display: grid;
  grid-template-columns: auto auto minmax(120px, 230px);
  gap: 8px;
  align-items: center;
  max-width: calc(100vw - 28px);
  padding: 0;
  color: #fffdf3;
  background: transparent;
  border: 0;
  box-shadow: none;
  pointer-events: none;
  transform: translateY(1em);
}

.music-toggle-button,
.music-next-button {
  display: inline-flex;
  width: 34px;
  height: 34px;
  align-items: center;
  justify-content: center;
  padding: 0;
  color: rgba(255, 253, 243, 0.88);
  background: transparent;
  border: 0;
  border-radius: 0;
  box-shadow: none;
  font-family: "Lavishly Yours", "Cormorant Garamond", cursive;
  font-size: 34px;
  line-height: 1;
  transform-origin: center;
  text-shadow:
    0 0 12px rgba(255, 255, 255, 0.32),
    0 0 28px rgba(159, 228, 255, 0.2);
  pointer-events: auto;
  transition:
    color 150ms ease,
    text-shadow 150ms ease,
    transform 150ms ease;
}

.music-toggle-button.is-playing {
  align-items: flex-start;
  padding-top: 9px;
  font-family: "Arial Black", "Microsoft YaHei", system-ui, sans-serif;
  font-size: 17px;
  letter-spacing: 0;
  line-height: 1.2;
}

.music-next-button {
  font-family: "Arial Black", "Microsoft YaHei", system-ui, sans-serif;
  font-size: 17px;
  letter-spacing: 0;
  text-indent: -0.12em;
}

.music-toggle-button:disabled,
.music-next-button:disabled {
  opacity: 0.42;
}

.music-toggle-button:not(:disabled):hover,
.music-next-button:not(:disabled):hover {
  color: #fff;
  text-shadow:
    0 0 12px rgba(255, 255, 255, 0.82),
    0 0 26px rgba(159, 228, 255, 0.72),
    0 0 54px rgba(255, 212, 0, 0.24);
}

.music-toggle-button:not(:disabled):active,
.music-next-button:not(:disabled):active {
  transform: scale(1.12);
}

.music-status {
  min-width: 0;
  overflow: hidden;
  color: rgba(255, 253, 243, 0.86);
  font-family: "Dancing Script", "Cormorant Garamond", cursive;
  font-size: clamp(14px, 1.9vw, 24px);
  font-weight: 400;
  line-height: 1.45;
  padding: 0.16em 0 0.28em;
  text-shadow:
    0 0 10px rgba(255, 255, 255, 0.34),
    0 0 24px rgba(159, 228, 255, 0.22),
    1px 1px 8px rgba(0, 0, 0, 0.62);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.music-status-text {
  display: inline-block;
  min-width: 100%;
  vertical-align: middle;
  will-change: transform;
}

.music-status.is-marquee {
  text-overflow: clip;
}

.music-status.is-marquee .music-status-text {
  padding-left: 100%;
  animation: musicNameScroll var(--music-scroll-duration, 9s) linear infinite;
}

.click-burst {
  position: fixed;
  left: 0;
  top: 0;
  z-index: 120;
  width: 0;
  height: 0;
  pointer-events: none;
}

.cursor-comet {
  position: fixed;
  left: 0;
  top: 0;
  z-index: 119;
  width: var(--comet-size, 8px);
  height: var(--comet-size, 8px);
  pointer-events: none;
  background: rgba(255, 255, 255, 0.96);
  clip-path: polygon(50% 0, 61% 39%, 100% 50%, 61% 61%, 50% 100%, 39% 61%, 0 50%, 39% 39%);
  box-shadow:
    0 0 10px rgba(255, 255, 255, 0.92),
    0 0 22px rgba(160, 214, 255, 0.72),
    0 0 42px rgba(255, 255, 255, 0.36);
  transform: translate(-50%, -50%) rotate(var(--comet-rotate, 0deg));
  animation: cometTrailFade var(--comet-life, 920ms) ease-out forwards;
}

.cursor-comet::after {
  display: none;
}

.click-meteor {
  position: absolute;
  left: 0;
  top: 0;
  width: var(--meteor-size, 22px);
  height: var(--meteor-size, 22px);
  background: #fff;
  clip-path: polygon(50% 0, 61% 39%, 100% 50%, 61% 61%, 50% 100%, 39% 61%, 0 50%, 39% 39%);
  box-shadow:
    0 0 18px rgba(255, 255, 255, 0.95),
    0 0 44px rgba(159, 228, 255, 0.74),
    0 0 86px rgba(255, 255, 255, 0.38);
  transform: translate(-50%, -50%) rotate(var(--meteor-rotate, 0deg));
  animation: meteorBurst 900ms cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

.click-meteor::after {
  display: none;
}

.click-star-yellow {
  position: absolute;
  left: 0;
  top: 0;
  width: var(--star-size, 18px);
  height: var(--star-size, 18px);
  background: #b45cff;
  clip-path: polygon(50% 0, 62% 34%, 98% 35%, 69% 56%, 79% 91%, 50% 70%, 21% 91%, 31% 56%, 2% 35%, 38% 34%);
  filter:
    drop-shadow(0 0 10px rgba(180, 92, 255, 0.82))
    drop-shadow(0 0 24px rgba(255, 255, 255, 0.34))
    drop-shadow(0 0 38px rgba(255, 61, 220, 0.24));
  transform: translate(-50%, -50%);
  will-change: transform, opacity;
  animation: yellowStarPop 760ms cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

.home-view {
  position: relative;
  width: 100%;
  height: 100vh;
  overflow: hidden;
  color: #fffdf3;
  opacity: 1;
  background:
    radial-gradient(circle at 50% 58%, rgba(255, 255, 255, 0.09), transparent 24rem),
    linear-gradient(rgba(0, 0, 0, 0.72), rgba(0, 0, 0, 0.88)),
    url("assets/background.jpg") center / cover no-repeat,
    #000;
  transition: opacity 0.6s ease;
}

.home-view::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  opacity: 0.28;
  background-image:
    radial-gradient(circle at 22% 18%, rgba(224, 245, 255, 0.18), transparent 12rem),
    radial-gradient(circle at 80% 42%, rgba(202, 164, 255, 0.16), transparent 16rem),
    linear-gradient(rgba(255, 255, 255, 0.055) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.045) 1px, transparent 1px);
  background-size: auto, auto, 54px 54px, 54px 54px;
  mask-image: radial-gradient(circle at center, #000, transparent 78%);
}

.home-view.home-hidden {
  opacity: 0;
  pointer-events: none;
}

.home-heading {
  position: absolute;
  z-index: 6;
  top: 18px;
  left: 50%;
  margin: 0;
  width: min(920px, calc(100% - 36px));
  text-align: center;
  pointer-events: none;
  transform: translateX(-50%);
  transition: opacity 0.6s ease;
}

.home-heading h1 {
  margin: 0;
  color: rgba(255, 255, 255, 0.98);
  font-family: "Kaushan Script", "Cormorant Garamond", "Noto Serif SC", cursive;
  font-size: clamp(42px, 6vw, 96px);
  font-weight: 400;
  letter-spacing: 0;
  line-height: 0.98;
  text-shadow:
    0 2px 0 rgba(255, 255, 255, 0.14),
    0 0 18px rgba(255, 255, 255, 0.54),
    0 0 48px rgba(148, 207, 255, 0.42),
    0 0 92px rgba(135, 114, 255, 0.22);
}

.home-heading p {
  margin: 14px 0 0;
  color: rgba(232, 246, 255, 0.82);
  font-family: "Cormorant Garamond", "Noto Serif SC", serif;
  font-size: clamp(14px, 1.6vw, 24px);
  font-style: italic;
  font-weight: 700;
  letter-spacing: 0.2em;
  line-height: 1;
  text-shadow:
    0 0 14px rgba(255, 255, 255, 0.5),
    0 0 42px rgba(118, 204, 255, 0.36);
}

.panel-kicker {
  display: inline-block;
  margin: 0 0 18px;
  padding: 10px 14px;
  color: var(--yellow);
  background: var(--ink);
  border: 3px solid var(--yellow);
  box-shadow: 6px 6px 0 rgba(255, 212, 0, 0.26);
}

.home-view.home-exiting .home-heading {
  opacity: 0;
}

.sphere-stage {
  position: absolute;
  z-index: 2;
  inset: 0;
  touch-action: none;
  user-select: none;
}

.sphere-stage canvas {
  display: block;
  width: 100%;
  height: 100%;
}

.sphere-stage::after {
  content: "";
  position: absolute;
  left: 50%;
  top: 75%;
  width: min(42vw, 500px);
  height: min(9vw, 82px);
  border-radius: 50%;
  transform: translate(-50%, -50%);
  pointer-events: none;
  background: radial-gradient(ellipse, rgba(0, 0, 0, 0.74), transparent 68%);
  filter: blur(12px);
}

.fallback-sphere {
  position: absolute;
  left: 50%;
  top: 53%;
  display: grid;
  width: min(62vw, 660px);
  height: min(62vw, 660px);
  grid-template-columns: repeat(8, 1fr);
  gap: 10px;
  overflow: hidden;
  padding: 34px;
  border-radius: 50%;
  background: #050505;
  box-shadow:
    inset 0 0 80px rgba(255, 255, 255, 0.12),
    0 0 80px rgba(177, 207, 255, 0.16);
  transform: translate(-50%, -50%);
}

.fallback-sphere .memory-tile {
  height: 100%;
  min-height: 0;
  padding: 0;
  overflow: hidden;
  background: #111;
  border: 0;
  border-radius: 3px;
  box-shadow: none;
}

.fallback-sphere .memory-tile img {
  height: 100%;
  border: 0;
}

.fallback-sphere .tile-title {
  display: none;
}

.memory-tile {
  position: relative;
  display: block;
  width: 100%;
  height: 100%;
  padding: 8px;
  overflow: visible;
  color: var(--ink);
  background: var(--paper);
  border: 4px solid var(--ink);
  border-radius: var(--radius);
  box-shadow: 9px 9px 0 var(--shadow);
  transform: rotate(var(--tilt, -2deg));
  transition:
    transform 180ms ease,
    filter 180ms ease,
    box-shadow 180ms ease;
}

button.memory-tile {
  border-color: var(--ink);
  text-align: left;
}

.memory-tile::before {
  content: "";
  position: absolute;
  inset: -13px;
  z-index: -1;
  border-radius: 14px;
  opacity: 0.25;
  background: radial-gradient(circle, rgba(255, 243, 149, 0.95), transparent 68%);
  filter: blur(8px);
  transition:
    opacity 180ms ease,
    transform 180ms ease;
}

.sphere-slot.is-hovered {
  z-index: 2000 !important;
}

.sphere-slot.is-hovered .memory-tile {
  transform: rotate(var(--tilt, -2deg)) scale(1.12);
  filter: saturate(1.12);
  box-shadow: 13px 13px 0 var(--shadow), 0 0 32px rgba(255, 244, 168, 0.84);
}

.memory-card:hover {
  transform: rotate(var(--tilt, -2deg)) scale(1.06);
  filter: saturate(1.12);
  box-shadow: 13px 13px 0 var(--shadow), 0 0 32px rgba(255, 244, 168, 0.84);
}

.memory-card:hover {
  z-index: 8;
}

.sphere-slot.is-hovered .memory-tile::before,
.memory-card:hover::before {
  opacity: 0.95;
  transform: scale(1.18);
}

.memory-tile img,
.memory-card img,
.detail-media img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.memory-tile img {
  height: 88px;
  border: 3px solid var(--ink);
  border-radius: 4px;
}

.tile-title {
  display: block;
  margin-top: 8px;
  overflow: hidden;
  font-size: 12px;
  line-height: 1.2;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.tile-meta {
  display: block;
  margin-top: 3px;
  overflow: hidden;
  color: rgba(17, 17, 17, 0.7);
  font-family: "Microsoft YaHei", "PingFang SC", system-ui, sans-serif;
  font-size: 10px;
  font-weight: 800;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.enter-button {
  position: fixed;
  z-index: 7;
  right: clamp(18px, 4vw, 66px);
  top: 50%;
  width: 126px;
  height: 54px;
  color: rgba(255, 253, 243, 0.9);
  background:
    radial-gradient(circle at 28% 18%, rgba(255, 255, 255, 0.42) 0 7%, transparent 8%),
    linear-gradient(145deg, rgba(255, 253, 243, 0.16), rgba(159, 228, 255, 0.18) 54%, rgba(255, 212, 0, 0.16));
  border: 1px solid rgba(255, 253, 243, 0.32);
  border-radius: 54% 46% 58% 42% / 48% 56% 44% 52%;
  box-shadow:
    inset 0 7px 16px rgba(255, 255, 255, 0.1),
    0 0 20px rgba(159, 228, 255, 0.16),
    0 0 48px rgba(0, 0, 0, 0.28);
  text-shadow:
    0 0 10px rgba(255, 255, 255, 0.34),
    0 0 20px rgba(159, 228, 255, 0.26);
  transform: translateY(-50%);
  animation: enterWobble 4.2s ease-in-out infinite;
  transition:
    transform 180ms ease,
    box-shadow 180ms ease,
    filter 180ms ease;
  display: flex;
  align-items: center;
  justify-content: center;
}

.enter-button::before,
.enter-button::after {
  content: "";
  position: absolute;
  pointer-events: none;
}

.enter-button::before {
  inset: -7px -9px -9px -7px;
  z-index: -1;
  border: 1px dashed rgba(159, 228, 255, 0.24);
  border-radius: 52% 48% 56% 44% / 42% 60% 40% 58%;
  transform: rotate(-5deg);
}

.enter-button::after {
  right: 14px;
  bottom: -7px;
  width: 13px;
  height: 17px;
  background: rgba(159, 228, 255, 0.38);
  border: 1px solid rgba(255, 253, 243, 0.36);
  border-top: 0;
  border-radius: 0 0 999px 999px;
  box-shadow: 0 0 12px rgba(159, 228, 255, 0.18);
  transform: rotate(10deg);
}

.enter-button:hover {
  filter: saturate(1.08) brightness(1.08);
  transform: translateY(-50%) translateX(-4px) rotate(-1deg) scale(1.04);
  box-shadow:
    inset 0 9px 18px rgba(255, 255, 255, 0.13),
    0 0 28px rgba(159, 228, 255, 0.28),
    0 0 64px rgba(255, 212, 0, 0.12);
}

.enter-button span {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  padding: 1px 7px 0 0;
  font-family: "Ceviche One", "Bebas Neue", "Arial Black", cursive;
  font-size: 30px;
  font-weight: 400;
  letter-spacing: 0.02em;
  line-height: 0.82;
  text-transform: uppercase;
  text-align: center;
}

@keyframes enterWobble {
  0%, 100% {
    border-radius: 54% 46% 58% 42% / 48% 56% 44% 52%;
  }
  50% {
    border-radius: 46% 54% 43% 57% / 56% 42% 58% 44%;
  }
}

.page-view {
  width: 100%;
  height: 100vh;
  min-height: 0;
  padding: clamp(36px, 5vh, 58px) 20px clamp(18px, 3vh, 30px);
  overflow: hidden;
  opacity: 0;
  background:
    linear-gradient(rgba(0, 0, 0, 0.03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(0, 0, 0, 0.03) 1px, transparent 1px),
    var(--yellow);
  background-size: 34px 34px;
  transition: opacity 0.45s ease;
}

.page-view.view.is-active {
  display: flex;
  opacity: 1;
}

.page-inner {
  width: min(1050px, 100%);
  height: 100%;
  margin: 0 auto;
  display: flex;
  min-height: 0;
  flex-direction: column;
  perspective: 1200px;
  animation: pageSlideIn 620ms cubic-bezier(0.16, 1, 0.3, 1) both;
}

.hero-panel,
.page-heading {
  text-align: center;
}

.top-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: clamp(34px, 5vh, 42px);
  padding: 7px 16px;
  color: #fff;
  background: var(--ink);
  border: 4px solid var(--ink);
  box-shadow: 6px 6px 0 rgba(0, 0, 0, 0.25);
}

.hero-panel h1,
.page-heading h1 {
  margin: clamp(10px, 2vh, 18px) auto 0;
  max-width: 760px;
  font-size: clamp(42px, 6.2vw, 82px);
  line-height: 0.86;
}

.page-heading h1 {
  font-size: clamp(36px, 5.2vw, 66px);
}

.hero-copy,
.page-copy {
  max-width: 650px;
  margin: clamp(10px, 2vh, 18px) auto 0;
  font-family: "Microsoft YaHei", "PingFang SC", system-ui, sans-serif;
  font-size: clamp(14px, 1.8vh, 18px);
  font-weight: 800;
  line-height: 1.6;
}

.sub-actions,
.heading-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
  justify-content: center;
  margin-top: clamp(10px, 2vh, 18px);
}

.plain-button,
.solid-button,
.small-button,
.chip-button {
  min-height: 40px;
  padding: 9px 16px;
  color: var(--ink);
  background: #fffdf3;
  border: 3px solid var(--ink);
  border-radius: 4px;
  box-shadow: 5px 5px 0 var(--shadow);
  transition:
    transform 150ms ease,
    box-shadow 150ms ease;
}

.plain-button:hover,
.solid-button:hover,
.small-button:hover,
.chip-button:hover {
  transform: translate(-2px, -2px);
  box-shadow: 7px 7px 0 var(--shadow);
}

.plain-button:disabled,
.solid-button:disabled,
.small-button:disabled,
.chip-button:disabled {
  cursor: wait;
  opacity: 0.72;
  transform: none;
  box-shadow: 5px 5px 0 var(--shadow);
}

.solid-button {
  color: #fff;
  background: var(--ink);
}

.solid-button.is-loading {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
}

.button-spinner {
  width: 1em;
  height: 1em;
  border: 2px solid rgba(255, 253, 243, 0.42);
  border-top-color: #fffdf3;
  border-radius: 50%;
  animation: buttonSpin 720ms linear infinite;
}

@keyframes buttonSpin {
  to {
    transform: rotate(360deg);
  }
}

.year-grid {
  --button-width: min(100%, 418px);
  display: grid;
  grid-template-columns: repeat(2, minmax(240px, 1fr));
  gap: clamp(24px, 4vh, 38px);
  width: min(930px, 100%);
  margin: clamp(26px, 5vh, 46px) auto 0;
}

.nav-card {
  position: relative;
  min-height: clamp(78px, 12vh, 106px);
  padding: clamp(14px, 2vh, 20px) 24px;
  color: var(--ink);
  background: #fffdf3;
  border: 5px solid var(--ink);
  border-radius: 4px;
  box-shadow: 12px 12px 0 var(--shadow);
  text-align: center;
  transform: rotate(var(--tilt, -1.2deg));
  transition:
    transform 160ms ease,
    box-shadow 160ms ease;
  transform-origin: 50% 70%;
  animation: cardDealIn 560ms cubic-bezier(0.16, 1, 0.3, 1) both;
}

.nav-card:nth-child(2) {
  animation-delay: 40ms;
}

.nav-card:nth-child(3) {
  animation-delay: 80ms;
}

.nav-card:nth-child(4) {
  animation-delay: 120ms;
}

.nav-card:nth-child(5) {
  animation-delay: 160ms;
}

.nav-card:nth-child(6) {
  animation-delay: 200ms;
}

.nav-card:hover {
  transform: rotate(var(--tilt, -1.2deg)) translate(-3px, -3px);
  box-shadow: 16px 16px 0 var(--shadow);
}

.nav-card strong {
  display: block;
  font-size: 28px;
}

.nav-card span {
  display: block;
  margin-top: 8px;
  font-family: "Microsoft YaHei", "PingFang SC", system-ui, sans-serif;
  font-size: 14px;
  font-weight: 900;
}

.nav-freshman {
  --tilt: -1.5deg;
  background: var(--green);
}

.nav-sophomore {
  --tilt: 1.4deg;
  background: var(--pink);
}

.nav-junior {
  --tilt: 1.1deg;
  color: #fffdf3;
  background: #5b2b8f;
}

.nav-senior {
  --tilt: -0.9deg;
  color: var(--yellow);
  background: var(--ink);
}

.nav-random {
  --tilt: 0.6deg;
  background: var(--blue);
}

.nav-pure {
  --tilt: -0.7deg;
  color: #fffdf3;
  background: var(--orange);
}

.month-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(150px, 1fr));
  gap: clamp(12px, 1.8vh, 18px);
  margin-top: clamp(18px, 3vh, 32px);
}

.month-card {
  position: relative;
  min-height: clamp(78px, 12vh, 114px);
  padding: clamp(12px, 1.8vh, 18px);
  color: var(--ink);
  background: #fffdf3;
  border: 5px solid var(--ink);
  border-radius: 4px;
  box-shadow: 9px 9px 0 var(--shadow);
  text-align: left;
  transform: rotate(var(--tilt, 0deg));
  transition:
    transform 150ms ease,
    box-shadow 150ms ease,
    background 150ms ease;
  transform-origin: 50% 70%;
  animation: cardDealIn 520ms cubic-bezier(0.16, 1, 0.3, 1) both;
}

.month-card:nth-child(3n + 2) {
  animation-delay: 35ms;
}

.month-card:nth-child(3n + 3) {
  animation-delay: 70ms;
}

.month-card:hover {
  transform: rotate(var(--tilt, 0deg)) translate(-2px, -2px);
  box-shadow: 12px 12px 0 var(--shadow);
}

.month-card.has-items:nth-child(4n + 1) {
  background: var(--green);
}

.month-card.has-items:nth-child(4n + 2) {
  background: var(--pink);
}

.month-card.has-items:nth-child(4n + 3) {
  background: var(--blue);
}

.month-card.has-items:nth-child(4n + 4) {
  background: #fffdf3;
}

.month-number {
  display: block;
  font-size: 38px;
  line-height: 1;
}

.month-count,
.month-note {
  display: block;
  margin-top: 10px;
  font-family: "Microsoft YaHei", "PingFang SC", system-ui, sans-serif;
  font-weight: 900;
}

.month-note {
  color: rgba(17, 17, 17, 0.66);
  font-size: 13px;
}

.month-toolbar {
  flex: 0 0 auto;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  justify-content: center;
  margin: clamp(14px, 2.2vh, 22px) auto;
}

.chip-button {
  min-height: 36px;
  padding: 7px 13px;
  font-size: 14px;
}

.chip-button.is-active {
  color: var(--yellow);
  background: var(--ink);
}

.photo-grid {
  flex: 1 1 auto;
  min-height: 0;
  overflow: auto;
  padding: 28px 44px 56px 28px;
  scroll-padding: 32px;
  scrollbar-color: rgba(17, 17, 17, 0.7) rgba(255, 253, 243, 0.28);
  scrollbar-width: thin;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: clamp(24px, 3.2vh, 34px);
  align-items: start;
}

.pure-heading h1 {
  font-family: "Cormorant Garamond", "Noto Serif SC", serif;
}

.pure-photo-grid {
  flex: 1 1 auto;
  min-height: 0;
  overflow: auto;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(132px, 1fr));
  grid-auto-rows: 132px;
  gap: 10px;
  padding: 18px 30px 42px 18px;
  scroll-padding: 28px;
  scrollbar-color: rgba(17, 17, 17, 0.7) rgba(255, 253, 243, 0.28);
  scrollbar-width: thin;
}

.pure-photo-grid::-webkit-scrollbar {
  width: 12px;
}

.pure-photo-grid::-webkit-scrollbar-track {
  background: rgba(255, 253, 243, 0.42);
  border-radius: 999px;
}

.pure-photo-grid::-webkit-scrollbar-thumb {
  background: linear-gradient(180deg, var(--blue), var(--pink));
  border: 3px solid rgba(255, 253, 243, 0.78);
  border-radius: 999px;
}

.pure-photo-tile {
  display: block;
  width: 100%;
  height: 100%;
  overflow: hidden;
  padding: 0;
  background: var(--ink);
  border: 4px solid var(--ink);
  border-radius: 4px;
  box-shadow: 6px 6px 0 var(--shadow);
  transition:
    transform 150ms ease,
    box-shadow 150ms ease;
  animation: photoFloatIn 460ms cubic-bezier(0.16, 1, 0.3, 1) both;
}

.pure-photo-tile:hover {
  transform: translate(-2px, -2px) scale(1.02);
  box-shadow: 8px 8px 0 var(--shadow);
}

.pure-photo-tile img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.photo-grid::-webkit-scrollbar,
.detail-card::-webkit-scrollbar,
.add-panel::-webkit-scrollbar,
.detail-feeling::-webkit-scrollbar {
  width: 12px;
}

.photo-grid::-webkit-scrollbar-track,
.detail-card::-webkit-scrollbar-track,
.add-panel::-webkit-scrollbar-track,
.detail-feeling::-webkit-scrollbar-track {
  background: rgba(255, 253, 243, 0.42);
  border: 2px solid rgba(17, 17, 17, 0.12);
  border-radius: 999px;
}

.photo-grid::-webkit-scrollbar-thumb,
.detail-card::-webkit-scrollbar-thumb,
.add-panel::-webkit-scrollbar-thumb,
.detail-feeling::-webkit-scrollbar-thumb {
  min-height: 42px;
  background:
    linear-gradient(180deg, rgba(255, 212, 0, 0.96), rgba(255, 61, 134, 0.9)),
    var(--ink);
  border: 3px solid rgba(255, 253, 243, 0.78);
  border-radius: 999px;
  box-shadow: inset 0 0 0 1px rgba(17, 17, 17, 0.36);
}

.memory-card {
  position: relative;
  z-index: 0;
  display: block;
  width: 100%;
  min-height: 378px;
  padding: 10px;
  color: var(--ink);
  background: var(--paper);
  border: 5px solid var(--ink);
  border-radius: var(--radius);
  box-shadow: 10px 10px 0 var(--shadow);
  text-align: left;
  transform: rotate(var(--tilt, -1deg));
  transform-origin: center;
  transition:
    transform 180ms ease,
    filter 180ms ease,
    box-shadow 180ms ease;
  will-change: transform;
  animation: photoFloatIn 560ms cubic-bezier(0.16, 1, 0.3, 1) both;
}

.memory-card:nth-child(3n + 2) {
  animation-delay: 35ms;
}

.memory-card:nth-child(3n + 3) {
  animation-delay: 70ms;
}

.memory-card.is-detail-returning,
.pure-photo-tile.is-detail-returning {
  opacity: 0;
  pointer-events: none;
  transition: none !important;
}

.memory-card:focus-visible {
  outline: 4px solid #fff;
  outline-offset: 5px;
}

.memory-card::before {
  content: "";
  position: absolute;
  inset: -10px;
  z-index: -1;
  border-radius: 14px;
  opacity: 0;
  background: radial-gradient(circle, rgba(255, 243, 149, 0.9), transparent 70%);
  filter: blur(9px);
  transition:
    opacity 180ms ease,
    transform 180ms ease;
}

.memory-card img {
  height: auto;
  aspect-ratio: 4 / 3;
  border: 4px solid var(--ink);
  border-radius: 4px;
  background: #111;
}

.card-body {
  display: block;
  padding: 12px 4px 2px;
}

.card-body h3 {
  margin: 0;
  font-size: 20px;
  line-height: 1.2;
}

.card-meta {
  margin: 8px 0 0;
  color: var(--muted);
  font-family: "Microsoft YaHei", "PingFang SC", system-ui, sans-serif;
  font-size: 13px;
  font-weight: 900;
  line-height: 1.5;
}

.card-feeling-panel {
  margin: 10px 0 0;
  font-family: "Microsoft YaHei", "PingFang SC", system-ui, sans-serif;
  font-weight: 700;
}

.card-feeling-panel summary {
  display: inline-flex;
  min-height: 30px;
  align-items: center;
  padding: 4px 10px;
  color: #fffdf3;
  background: var(--ink);
  border: 2px solid var(--ink);
  border-radius: 999px;
  font-size: 13px;
  font-weight: 900;
  list-style: none;
}

.card-feeling-panel summary::-webkit-details-marker {
  display: none;
}

.card-feeling-panel p {
  max-height: 0;
  margin: 0;
  overflow: auto;
  font-size: 14px;
  line-height: 1.65;
  opacity: 0;
  transition:
    max-height 180ms ease,
    margin 180ms ease,
    opacity 180ms ease;
}

.card-feeling-panel[open] p {
  max-height: 96px;
  margin-top: 8px;
  opacity: 1;
}

.tag-row {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin-top: 12px;
}

.tag-pill {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 3px 8px;
  color: var(--yellow);
  background: var(--ink);
  border: 2px solid var(--ink);
  border-radius: 999px;
  font-family: "Microsoft YaHei", "PingFang SC", system-ui, sans-serif;
  font-size: 12px;
  font-weight: 900;
}

.delete-memory-button {
  position: absolute;
  z-index: 3;
  top: -12px;
  right: -12px;
  display: inline-flex;
  width: 34px;
  height: 34px;
  align-items: center;
  justify-content: center;
  color: #fffdf3;
  background: var(--ink);
  border: 3px solid #fffdf3;
  border-radius: 50%;
  box-shadow: 4px 4px 0 var(--shadow);
  font-size: 23px;
  font-weight: 900;
  line-height: 1;
  transition:
    transform 140ms ease,
    background 140ms ease;
}

.delete-memory-button:hover {
  background: var(--pink);
  transform: scale(1.08) rotate(5deg);
}

.trash-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 14px;
}

.trash-card {
  min-height: 330px;
  filter: saturate(0.72);
}

.empty-state {
  margin: 40px auto 0;
  padding: 28px;
  max-width: 620px;
  background: #fffdf3;
  border: 5px solid var(--ink);
  border-radius: 4px;
  box-shadow: 10px 10px 0 var(--shadow);
  text-align: center;
}

.fab-add {
  position: fixed;
  right: 28px;
  bottom: 28px;
  z-index: 6;
  width: 68px;
  height: 68px;
  color: var(--ink);
  background: var(--yellow);
  border: 5px solid var(--ink);
  border-radius: 50%;
  box-shadow:
    8px 8px 0 var(--shadow),
    0 0 36px rgba(255, 212, 0, 0.74);
  font-size: 38px;
  line-height: 1;
  transition:
    transform 150ms ease,
    box-shadow 150ms ease;
}

.fab-add:hover {
  transform: translate(-3px, -3px) scale(1.04);
  box-shadow:
    11px 11px 0 var(--shadow),
    0 0 52px rgba(255, 212, 0, 0.92);
}

.detail-modal,
.add-modal,
.confirm-modal,
.admin-modal {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: none;
  align-items: center;
  justify-content: center;
  padding: clamp(10px, 2.5vh, 24px);
}

.detail-modal.is-active,
.add-modal.is-active,
.confirm-modal.is-active,
.admin-modal.is-active {
  display: flex;
}

.detail-source-marker {
  position: fixed;
  z-index: -1;
  pointer-events: none;
}

.detail-backdrop,
.add-backdrop,
.confirm-backdrop,
.admin-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.66);
  backdrop-filter: blur(6px);
}

.detail-card,
.add-panel,
.confirm-panel,
.admin-panel {
  position: relative;
  z-index: 1;
  width: min(980px, calc(100vw - 48px));
  max-height: min(82vh, 760px);
  overflow: auto;
  color: var(--ink);
  background: var(--paper);
  border: 6px solid var(--ink);
  border-radius: var(--radius);
  box-shadow: 16px 16px 0 var(--shadow);
}

.detail-card {
  display: grid;
  grid-template-columns: minmax(320px, 1.15fr) minmax(300px, 0.85fr);
  gap: 20px;
  padding: 16px;
  overflow: auto;
  transform: none;
}

.detail-media {
  min-height: 0;
  height: min(58vh, 520px);
  border: 5px solid var(--ink);
  border-radius: 4px;
  overflow: hidden;
  background: var(--ink);
}

.detail-content {
  display: flex;
  min-width: 0;
  flex-direction: column;
  justify-content: flex-start;
  padding: 6px 6px 6px 0;
  position: relative;
}

.detail-content h2 {
  margin: 0;
  font-size: clamp(24px, 3.6vw, 38px);
  line-height: 1;
}

.detail-meta {
  margin: 14px 0 0;
  color: rgba(17, 17, 17, 0.72);
  font-family: "Microsoft YaHei", "PingFang SC", system-ui, sans-serif;
  font-size: 15px;
  font-weight: 900;
  line-height: 1.7;
}

.detail-feeling {
  max-height: 180px;
  margin: 12px 0 0;
  overflow: auto;
  font-family: "Microsoft YaHei", "PingFang SC", system-ui, sans-serif;
  font-size: 16px;
  font-weight: 800;
  line-height: 1.8;
}

.detail-hint {
  margin-top: 18px;
  color: rgba(17, 17, 17, 0.56);
  font-family: "Microsoft YaHei", "PingFang SC", system-ui, sans-serif;
  font-size: 13px;
  font-weight: 900;
}

.detail-actions {
  position: absolute;
  right: 4px;
  bottom: 6px;
  margin: 0;
}

.detail-edit-button {
  min-height: 30px;
  padding: 5px 10px;
  font-size: 13px;
  box-shadow: 3px 3px 0 var(--shadow);
}

.detail-image-button {
  display: block;
  width: 100%;
  height: 100%;
  padding: 0;
  overflow: hidden;
  background: var(--ink);
  border: 0;
  border-radius: 0;
}

.detail-image-button:hover img {
  transform: scale(1.025);
}

.detail-image-button img {
  object-fit: contain;
  transition: transform 160ms ease;
}

.add-panel {
  width: min(760px, calc(100vw - 42px));
  padding: 24px;
}

.confirm-panel {
  width: min(500px, calc(100vw - 42px));
  padding: 24px;
  transform: rotate(-0.4deg);
}

.admin-panel {
  width: min(460px, calc(100vw - 42px));
  padding: 24px;
  transform: rotate(0.4deg);
}

.confirm-panel h2 {
  margin: 0;
  font-size: clamp(28px, 5vw, 44px);
  line-height: 1;
}

.admin-panel h2 {
  margin: 0 0 14px;
  font-size: clamp(28px, 5vw, 42px);
  line-height: 1;
}

.confirm-copy {
  margin: 16px 0 0;
  font-family: "Microsoft YaHei", "PingFang SC", system-ui, sans-serif;
  font-size: 16px;
  font-weight: 800;
  line-height: 1.7;
}

.danger-button {
  color: #fffdf3;
  background: var(--pink);
}

.admin-error {
  min-height: 22px;
  margin: 12px 0 0;
  color: var(--pink);
  font-family: "Microsoft YaHei", "PingFang SC", system-ui, sans-serif;
  font-size: 14px;
  font-weight: 900;
}

.admin-welcome {
  position: fixed;
  inset: 0;
  z-index: 90;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 24px;
  pointer-events: none;
}

.admin-welcome.is-active {
  display: flex;
}

.admin-welcome-card {
  width: min(470px, calc(100vw - 42px));
  padding: 24px;
  color: var(--ink);
  background:
    radial-gradient(circle at 18% 12%, rgba(255, 255, 255, 0.74), transparent 18%),
    linear-gradient(135deg, #fffdf3, #9fe4ff 56%, #ffd400);
  border: 5px solid var(--ink);
  border-radius: var(--radius);
  box-shadow:
    14px 14px 0 rgba(0, 0, 0, 0.86),
    0 0 70px rgba(159, 228, 255, 0.34);
  text-align: center;
  transform: rotate(-0.6deg);
  animation: adminWelcomeIn 520ms cubic-bezier(0.16, 1, 0.3, 1) both;
}

.admin-welcome.is-leaving .admin-welcome-card {
  animation: adminWelcomeOut 260ms ease both;
}

.admin-welcome-card h2 {
  margin: 0;
  font-size: clamp(30px, 5.5vw, 50px);
  line-height: 1;
}

.admin-welcome-card p:last-child {
  margin: 14px 0 0;
  font-family: "Microsoft YaHei", "PingFang SC", system-ui, sans-serif;
  font-size: 15px;
  font-weight: 900;
}

.form-heading h2 {
  margin: 0 0 18px;
  font-size: clamp(30px, 5vw, 48px);
  line-height: 1;
}

.field {
  display: grid;
  gap: 7px;
  margin-top: 14px;
  font-family: "Microsoft YaHei", "PingFang SC", system-ui, sans-serif;
  font-weight: 900;
}

.field span {
  font-size: 14px;
}

.field input,
.field select,
.field textarea {
  width: 100%;
  padding: 11px 12px;
  color: var(--ink);
  background: #fff;
  border: 3px solid var(--ink);
  border-radius: 4px;
  box-shadow: 4px 4px 0 var(--shadow);
}

.field textarea {
  resize: vertical;
}

.field-file input {
  background: #fffdf3;
}

.tag-editor {
  gap: 10px;
}

.selected-tag-list,
.tag-pick-list,
.tag-manage-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.tag-choice {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 34px;
  padding: 5px 10px;
  background: #fffdf3;
  border: 3px solid var(--ink);
  border-radius: 999px;
  box-shadow: 3px 3px 0 var(--shadow);
}

.tag-choice input {
  width: auto;
  box-shadow: none;
}

.selected-tag-chip,
.tag-suggestion {
  min-height: 34px;
  padding: 5px 11px;
  color: var(--ink);
  background: #fffdf3;
  border: 3px solid var(--ink);
  border-radius: 999px;
  box-shadow: 3px 3px 0 var(--shadow);
  font-size: 13px;
  font-weight: 900;
}

.selected-tag-chip {
  color: var(--yellow);
  background: var(--ink);
}

.selected-tag-chip span {
  margin-left: 5px;
  color: #fffdf3;
}

.tag-suggestion.is-selected {
  color: var(--yellow);
  background: var(--ink);
}

.tag-create-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
}

.tag-manage-row {
  display: grid;
  grid-template-columns: minmax(130px, 1fr) auto auto;
  gap: 8px;
  width: 100%;
  align-items: center;
}

.image-viewer {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: none;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  padding: 28px;
}

.image-viewer.is-active {
  display: flex;
}

.image-viewer-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.88);
  backdrop-filter: blur(8px);
}

.image-viewer img {
  position: relative;
  z-index: 1;
  display: block;
  max-width: 88vw;
  max-height: 86vh;
  object-fit: contain;
  transform-origin: center;
  transition: transform 80ms linear;
  box-shadow: 0 0 0 4px rgba(255, 253, 243, 0.82), 0 0 70px rgba(255, 255, 255, 0.2);
}

.image-viewer-close {
  position: fixed;
  z-index: 2;
  top: 22px;
  right: 26px;
  width: 42px;
  height: 42px;
  color: #fffdf3;
  background: rgba(17, 17, 17, 0.82);
  border: 2px solid rgba(255, 253, 243, 0.88);
  border-radius: 50%;
  font-size: 30px;
  line-height: 1;
}

.tag-empty {
  margin: 0;
  color: rgba(17, 17, 17, 0.62);
  font-size: 13px;
}

.form-row {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.form-actions {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  margin-top: 22px;
}

@keyframes pageSlideIn {
  from {
    opacity: 0;
    transform: translateY(26px) rotateX(4deg) scale(0.985);
    filter: blur(5px) saturate(0.86);
  }
  to {
    opacity: 1;
    transform: translateY(0) rotateX(0deg) scale(1);
    filter: blur(0) saturate(1);
  }
}

@keyframes cardDealIn {
  from {
    opacity: 0;
    transform: translateY(28px) rotate(calc(var(--tilt, 0deg) - 5deg)) rotateX(7deg) scale(0.94);
    filter: blur(3px) saturate(0.9);
  }
  72% {
    opacity: 1;
    transform: translateY(-3px) rotate(calc(var(--tilt, 0deg) + 0.6deg)) rotateX(0deg) scale(1.015);
    filter: blur(0) saturate(1.06);
  }
  to {
    opacity: 1;
    transform: translateY(0) rotate(var(--tilt, 0deg)) scale(1);
    filter: blur(0) saturate(1);
  }
}

@keyframes photoFloatIn {
  from {
    opacity: 0;
    transform: translate3d(0, 24px, 0) rotate(calc(var(--tilt, -1deg) - 3deg)) scale(0.92);
    filter: blur(4px) saturate(0.82);
  }
  66% {
    opacity: 1;
    transform: translate3d(0, -4px, 0) rotate(calc(var(--tilt, -1deg) + 0.5deg)) scale(1.015);
    filter: blur(0) saturate(1.06);
  }
  to {
    opacity: 1;
    transform: translate3d(0, 0, 0) rotate(var(--tilt, -1deg)) scale(1);
    filter: blur(0) saturate(1);
  }
}

@keyframes cometTrailFade {
  0% {
    opacity: 0;
    transform: translate(-50%, -50%) rotate(var(--comet-rotate, 0deg)) scale(0.35);
  }
  15% {
    opacity: 0.95;
  }
  100% {
    opacity: 0;
    transform: translate(calc(-50% + var(--comet-drift-x, 0px)), calc(-50% + var(--comet-drift-y, 0px))) rotate(var(--comet-rotate, 0deg)) scale(0);
  }
}

@keyframes meteorBurst {
  0% {
    opacity: 1;
    transform: translate(-50%, -50%) rotate(var(--meteor-rotate, 0deg)) scale(0.35);
  }
  100% {
    opacity: 0;
    transform: translate(calc(-50% + var(--meteor-x, 0px)), calc(-50% + var(--meteor-y, 0px))) rotate(var(--meteor-rotate, 0deg)) scale(1.1);
  }
}

@keyframes yellowStarPop {
  0% {
    opacity: 1;
    transform: translate(-50%, -50%) scale(0.7) rotate(0deg);
  }
  42% {
    opacity: 1;
    transform: translate(calc(-50% + var(--star-x, 0px) * 0.62), calc(-50% + var(--star-y, 0px) * 0.62)) scale(1.04) rotate(calc(var(--star-rotate, 160deg) * 0.55));
  }
  100% {
    opacity: 0;
    transform: translate(calc(-50% + var(--star-x, 0px)), calc(-50% + var(--star-y, 0px))) scale(1.08) rotate(var(--star-rotate, 160deg));
  }
}

@keyframes adminWelcomeIn {
  from {
    opacity: 0;
    transform: translateY(26px) rotate(-3deg) scale(0.9);
    filter: blur(5px) saturate(0.86);
  }
  76% {
    opacity: 1;
    transform: translateY(-4px) rotate(-0.2deg) scale(1.02);
    filter: blur(0) saturate(1.08);
  }
  to {
    opacity: 1;
    transform: translateY(0) rotate(-0.6deg) scale(1);
    filter: blur(0) saturate(1);
  }
}

@keyframes adminWelcomeOut {
  to {
    opacity: 0;
    transform: translateY(-18px) rotate(1.2deg) scale(0.96);
    filter: blur(4px);
  }
}

@keyframes musicNameScroll {
  from {
    transform: translateX(0);
  }
  to {
    transform: translateX(-100%);
  }
}

@media (max-width: 840px) {
  .home-heading {
    top: 20px;
  }

  .enter-button {
    right: 50%;
    top: auto;
    bottom: 26px;
    width: 118px;
    height: 52px;
    transform: translateX(50%);
  }

  .enter-button:hover {
    transform: translateX(50%) scale(1.04);
  }

  .year-grid,
  .month-grid {
    grid-template-columns: 1fr;
  }

  .nav-random {
    width: 100%;
  }

  .detail-card {
    grid-template-columns: 1fr;
  }

  .detail-media {
    height: auto;
    min-height: min(48vh, 360px);
  }

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

@media (max-width: 560px) {
  .page-view {
    padding-inline: 14px;
  }

  .hero-panel h1,
  .page-heading h1 {
    font-size: 40px;
  }

  .photo-grid {
    grid-template-columns: 1fr;
    padding-inline: 22px;
  }

  .music-dock {
    grid-template-columns: auto auto minmax(0, 180px);
  }

  .music-status {
    max-width: 180px;
  }

  .detail-modal,
  .add-modal,
  .admin-modal {
    padding: 14px;
  }
}

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