:root {
  --phone-w: 393px;
  --phone-h: 852px;
  --ios-bg: #fbfaf7;
  --ios-card: #ffffff;
  --ios-line: rgba(60, 60, 67, 0.12);
  --ios-text: #1d1d1f;
  --ios-sub: #6e6e73;
  --ios-blue: #007aff;
  --warm: #d56a4a;
  --shadow: 0 30px 90px rgba(0, 0, 0, 0.34);
  --ease: cubic-bezier(0.2, 0.8, 0.2, 1);
  color-scheme: light;
}

* {
  box-sizing: border-box;
}

html {
  background: #111113;
  -webkit-text-size-adjust: 100%;
}

body {
  min-height: 100vh;
  margin: 0;
  display: grid;
  place-items: center;
  overflow-x: hidden;
  background:
    radial-gradient(circle at 25% 8%, rgba(213, 106, 74, 0.2), transparent 32%),
    radial-gradient(circle at 82% 26%, rgba(0, 122, 255, 0.16), transparent 28%),
    linear-gradient(145deg, #111113, #252527 52%, #0d0d0f);
  color: var(--ios-text);
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", "PingFang SC", "Helvetica Neue", sans-serif;
}

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

.site-back {
  position: fixed;
  top: max(18px, env(safe-area-inset-top));
  right: 18px;
  z-index: 20;
  padding: 9px 13px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  color: rgba(255, 255, 255, 0.86);
  font-size: 13px;
  text-decoration: none;
  backdrop-filter: blur(18px);
}

.stage {
  width: min(100vw, 980px);
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 28px 16px;
}

.phone-shell {
  width: min(var(--phone-w), calc(100vw - 26px));
  aspect-ratio: 393 / 852;
  padding: 10px;
  border-radius: 58px;
  background:
    linear-gradient(145deg, rgba(255,255,255,0.7), rgba(255,255,255,0.1) 28%, rgba(0,0,0,0.45) 72%),
    #2c2c2e;
  box-shadow: var(--shadow);
}

.phone {
  position: relative;
  width: 100%;
  height: 100%;
  overflow: hidden;
  border-radius: 48px;
  background: var(--ios-bg);
}

.dynamic-island {
  position: absolute;
  top: 12px;
  left: 50%;
  z-index: 40;
  width: 126px;
  height: 37px;
  border-radius: 999px;
  background: #050505;
  transform: translateX(-50%);
  box-shadow: inset 0 0 0 1px rgba(255,255,255,0.04);
}

.status-bar {
  position: absolute;
  inset: 0 0 auto;
  z-index: 30;
  height: 48px;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  padding: 13px 28px 0;
  color: var(--ios-text);
  font-size: 14px;
  font-weight: 700;
  background: rgba(251, 250, 247, 0.72);
  backdrop-filter: blur(22px);
}

.status-icons {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding-top: 2px;
}

.status-icons i {
  display: block;
  width: 15px;
  height: 10px;
  border-radius: 2px;
  border: 1.8px solid currentColor;
}

.status-icons i:first-child {
  width: 16px;
  height: 12px;
  border-width: 0 0 2px 0;
  border-radius: 0;
  transform: skew(-18deg);
}

.status-icons b {
  display: block;
  width: 24px;
  height: 12px;
  border: 1.8px solid currentColor;
  border-radius: 3px;
  position: relative;
}

.status-icons b::before {
  content: "";
  position: absolute;
  top: 2px;
  left: 2px;
  width: 15px;
  height: 6px;
  border-radius: 2px;
  background: currentColor;
}

.app-nav {
  position: absolute;
  inset: 48px 0 auto;
  z-index: 25;
  height: 44px;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  padding: 0 18px;
  background: rgba(251, 250, 247, 0.72);
  backdrop-filter: blur(22px);
  border-bottom: 1px solid rgba(60, 60, 67, 0.08);
}

.app-nav a,
.app-nav button {
  border: 0;
  background: transparent;
  color: var(--ios-blue);
  font: inherit;
  font-size: 16px;
  text-decoration: none;
}

.app-nav button {
  justify-self: end;
  cursor: pointer;
}

.app-nav strong {
  font-size: 17px;
}

.phone-screen {
  height: calc(100% - 83px);
  overflow-y: auto;
  padding: 104px 16px 26px;
  scroll-behavior: smooth;
}

.phone-screen::-webkit-scrollbar {
  display: none;
}

.memory-card {
  position: relative;
  height: 224px;
  overflow: hidden;
  border-radius: 26px;
  background: #111;
  box-shadow: 0 14px 38px rgba(29, 29, 31, 0.18);
  animation: liftIn 0.7s var(--ease) both;
}

.memory-card img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transform: scale(1.03);
  transition: transform 0.8s var(--ease), filter 0.4s ease;
}

.memory-card.playing img {
  animation: memoryDrift 4.2s var(--ease) infinite alternate;
}

.memory-shade {
  position: absolute;
  inset: 0;
  background:
    linear-gradient(180deg, rgba(0,0,0,0.04), rgba(0,0,0,0.14) 42%, rgba(0,0,0,0.72)),
    radial-gradient(circle at 15% 18%, rgba(255,255,255,0.34), transparent 34%);
}

.memory-copy {
  position: absolute;
  left: 18px;
  right: 72px;
  bottom: 18px;
  color: white;
}

.memory-copy p,
.memory-copy h1 {
  margin: 0;
}

.memory-copy p {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.13em;
  opacity: 0.78;
}

.memory-copy h1 {
  margin-top: 5px;
  font-size: 30px;
  line-height: 1.12;
  letter-spacing: 0;
}

.memory-copy span {
  display: block;
  margin-top: 7px;
  font-size: 13px;
  opacity: 0.82;
}

.play-memory {
  position: absolute;
  right: 16px;
  bottom: 17px;
  width: 48px;
  height: 48px;
  border: 0;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.88);
  color: var(--ios-text);
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
}

.stats-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin: 14px 0;
}

.stats-row span {
  min-width: 0;
  padding: 12px 8px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.72);
  border: 1px solid var(--ios-line);
  color: var(--ios-sub);
  font-size: 12px;
  text-align: center;
}

.stats-row b {
  display: block;
  color: var(--ios-text);
  font-size: 20px;
  line-height: 1.1;
}

.scene-tabs {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 2px 0 12px;
  scrollbar-width: none;
}

.scene-tabs::-webkit-scrollbar {
  display: none;
}

.scene-tabs button {
  flex: 0 0 auto;
  height: 34px;
  padding: 0 14px;
  border: 1px solid var(--ios-line);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.66);
  color: var(--ios-text);
  font-size: 14px;
  cursor: pointer;
  transition: 0.24s var(--ease);
}

.scene-tabs button.active {
  border-color: transparent;
  background: #1d1d1f;
  color: white;
}

.today-panel {
  display: flex;
  align-items: end;
  justify-content: space-between;
  margin: 2px 0 12px;
}

.today-panel p,
.today-panel h2 {
  margin: 0;
}

.today-panel p {
  color: var(--ios-sub);
  font-size: 13px;
}

.today-panel h2 {
  margin-top: 1px;
  font-size: 28px;
  line-height: 1.12;
}

.today-panel span {
  color: var(--warm);
  font-size: 13px;
  font-weight: 700;
}

.photo-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  grid-auto-flow: dense;
  gap: 3px;
  overflow: hidden;
  border-radius: 18px;
  background: rgba(60, 60, 67, 0.08);
}

.photo-tile {
  position: relative;
  min-height: 106px;
  border: 0;
  padding: 0;
  overflow: hidden;
  background: #ddd;
  cursor: pointer;
  animation: tileIn 0.5s var(--ease) both;
}

.photo-tile:nth-child(7n + 1) {
  grid-column: span 2;
  grid-row: span 2;
}

.photo-tile:nth-child(11n + 4) {
  grid-column: span 2;
}

.photo-tile img {
  width: 100%;
  height: 100%;
  min-height: inherit;
  display: block;
  object-fit: cover;
  transition: transform 0.5s var(--ease), filter 0.25s ease;
}

.photo-tile:active img {
  transform: scale(0.95);
  filter: brightness(0.86);
}

.photo-tile::after {
  content: attr(data-mark);
  position: absolute;
  right: 6px;
  bottom: 5px;
  padding: 2px 5px;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.28);
  color: white;
  font-size: 10px;
  opacity: 0;
  transition: opacity 0.2s ease;
}

.photo-tile:nth-child(7n + 1)::after {
  opacity: 1;
}

.tab-bar {
  position: absolute;
  inset: auto 0 0;
  z-index: 26;
  height: 83px;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  padding: 8px 18px 20px;
  border-top: 1px solid rgba(60, 60, 67, 0.12);
  background: rgba(251, 250, 247, 0.86);
  backdrop-filter: blur(22px);
}

.tab-bar button {
  display: grid;
  justify-items: center;
  gap: 3px;
  border: 0;
  background: transparent;
  color: #8e8e93;
  font-size: 10px;
  cursor: pointer;
}

.tab-bar button.active {
  color: var(--ios-blue);
}

.tab-bar svg {
  width: 25px;
  height: 25px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.viewer {
  position: absolute;
  inset: 0;
  z-index: 80;
  display: grid;
  grid-template-rows: 82px 1fr 114px;
  align-items: center;
  justify-items: center;
  padding: 0 16px;
  background: rgba(8, 8, 10, 0.96);
  color: white;
  opacity: 0;
  pointer-events: none;
  transform: scale(1.04);
  transition: opacity 0.26s ease, transform 0.34s var(--ease);
}

.viewer.open {
  opacity: 1;
  pointer-events: auto;
  transform: scale(1);
}

.viewer-top {
  width: 100%;
  align-self: start;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-top: 52px;
}

.viewer-top button {
  border: 0;
  background: transparent;
  color: #0a84ff;
  font-size: 17px;
  cursor: pointer;
}

.viewer-top span {
  color: rgba(255,255,255,0.68);
  font-size: 13px;
}

.viewer img {
  max-width: 100%;
  max-height: 580px;
  border-radius: 18px;
  object-fit: contain;
  box-shadow: 0 18px 44px rgba(0,0,0,0.5);
}

.viewer-nav {
  position: absolute;
  top: 50%;
  width: 42px;
  height: 42px;
  border: 0;
  border-radius: 50%;
  background: rgba(255,255,255,0.13);
  color: white;
  font-size: 32px;
  cursor: pointer;
  transform: translateY(-50%);
}

.viewer-prev {
  left: 12px;
}

.viewer-next {
  right: 12px;
}

.viewer-caption {
  width: 100%;
  align-self: end;
  padding-bottom: 28px;
}

.viewer-caption p,
.viewer-caption span {
  display: block;
  margin: 0;
  text-align: center;
}

.viewer-caption p {
  font-size: 18px;
  font-weight: 700;
}

.viewer-caption span {
  margin-top: 4px;
  color: rgba(255,255,255,0.6);
  font-size: 12px;
}

@keyframes liftIn {
  from {
    opacity: 0;
    transform: translateY(24px) scale(0.98);
  }
}

@keyframes tileIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
}

@keyframes memoryDrift {
  to {
    transform: scale(1.13) translate3d(-2%, -1%, 0);
  }
}

@media (max-width: 520px) {
  body {
    display: block;
    background: #111113;
  }

  .stage {
    min-height: 100vh;
    padding: 0;
  }

  .phone-shell {
    width: 100vw;
    height: 100vh;
    height: 100svh;
    aspect-ratio: auto;
    padding: 0;
    border-radius: 0;
    box-shadow: none;
    background: var(--ios-bg);
  }

  .phone {
    border-radius: 0;
  }

  .site-back {
    display: none;
  }

  .viewer img {
    max-height: calc(100vh - 210px);
    max-height: calc(100svh - 210px);
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    transition-duration: 0.001ms !important;
  }
}
