:root {
  --ink: #fffaf3;
  --muted: rgba(255, 250, 243, 0.76);
  --night: #071821;
  --panel: rgba(10, 20, 26, 0.68);
  --panel-strong: rgba(9, 17, 22, 0.84);
  --rose: #ff8da1;
  --coral: #ff654f;
  --gold: #ffd98a;
  --mint: #95f0d1;
  --line: rgba(255, 250, 243, 0.18);
  color-scheme: dark;
}

* {
  box-sizing: border-box;
}

html {
  width: 100%;
  min-height: 100%;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  width: 100%;
  min-height: 100vh;
  min-height: 100svh;
  margin: 0;
  overflow-x: hidden;
  overscroll-behavior-x: none;
  background: var(--night) url("assets/hero-night.png") center / cover no-repeat;
  color: var(--ink);
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
}

body::before {
  position: fixed;
  inset: 0;
  z-index: -1;
  content: "";
  background:
    linear-gradient(90deg, rgba(3, 10, 14, 0.82), rgba(3, 10, 14, 0.34) 48%, rgba(3, 10, 14, 0.74)),
    linear-gradient(180deg, rgba(3, 10, 14, 0.18), rgba(3, 10, 14, 0.88));
}

button,
input {
  font: inherit;
}

button {
  min-height: 44px;
  border: 0;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}

input {
  font-size: 16px;
}

#sparkles {
  position: fixed;
  inset: 0;
  z-index: 1;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

.experience {
  position: relative;
  z-index: 2;
}

.gate,
.hero {
  display: grid;
  min-height: 100svh;
  padding: max(18px, env(safe-area-inset-top)) 18px max(18px, env(safe-area-inset-bottom));
  place-items: center;
}

.gate__panel {
  position: relative;
  z-index: 2;
  width: min(560px, 100%);
  padding: clamp(26px, 5vw, 48px);
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: 0 28px 90px rgba(0, 0, 0, 0.34);
  -webkit-backdrop-filter: blur(18px);
  backdrop-filter: blur(18px);
  animation: riseIn 760ms cubic-bezier(0.2, 0.8, 0.2, 1) both;
}

.phone-orbit {
  position: absolute;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
}

.phone-orbit span {
  position: absolute;
  width: 74px;
  height: 74px;
  border: 1px solid rgba(255, 217, 138, 0.28);
  border-radius: 999px;
  box-shadow: 0 0 42px rgba(255, 141, 161, 0.24);
  animation: floatHeart 7s ease-in-out infinite;
}

.phone-orbit span:nth-child(1) {
  left: 8%;
  top: 14%;
}

.phone-orbit span:nth-child(2) {
  right: 7%;
  top: 31%;
  width: 42px;
  height: 42px;
  animation-delay: -2s;
}

.phone-orbit span:nth-child(3) {
  left: 18%;
  bottom: 15%;
  width: 34px;
  height: 34px;
  animation-delay: -4s;
}

.eyebrow {
  margin: 0 0 14px;
  color: var(--gold);
  font-size: 0.76rem;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1,
h2 {
  max-width: 860px;
  margin-bottom: 18px;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(2.4rem, 4.4rem, 6.4rem);
  font-weight: 700;
  letter-spacing: 0;
  line-height: 0.95;
}

.gate h1 {
  font-size: clamp(2.1rem, 3.7rem, 4.8rem);
}

.gate__copy,
.hero p {
  max-width: 650px;
  color: var(--muted);
  font-size: clamp(1rem, 1.12rem, 1.24rem);
  line-height: 1.65;
}

.secret-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  margin-top: 28px;
}

.secret-form input {
  width: 100%;
  min-height: 52px;
  border: 1px solid rgba(255, 250, 243, 0.28);
  border-radius: 8px;
  outline: 0;
  background: rgba(255, 255, 255, 0.1);
  color: var(--ink);
  padding: 0 16px;
}

.secret-form input:focus {
  border-color: var(--gold);
  box-shadow: 0 0 0 4px rgba(255, 217, 138, 0.16);
}

.secret-form button,
.primary {
  border-radius: 8px;
  background: linear-gradient(135deg, var(--rose), var(--coral));
  color: #1c0a0b;
  font-weight: 850;
  padding: 0 20px;
  box-shadow: 0 14px 34px rgba(255, 101, 79, 0.24);
  transition:
    transform 180ms ease,
    box-shadow 180ms ease,
    filter 180ms ease;
}

.secret-form button:active,
.primary:active,
.ghost:active,
.gallery-head button:active {
  transform: scale(0.97);
}

.secret-form button:hover,
.primary:hover {
  filter: brightness(1.06);
  box-shadow: 0 18px 46px rgba(255, 101, 79, 0.34);
}

.hint {
  min-height: 24px;
  margin: 16px 0 0;
  color: var(--muted);
  font-size: 0.92rem;
}

.hero {
  align-items: end;
  justify-items: start;
  padding: max(20px, env(safe-area-inset-top)) clamp(18px, 5vw, 72px) max(28px, env(safe-area-inset-bottom));
}

.hero__content {
  width: min(980px, 100%);
  padding-bottom: min(13vh, 92px);
  animation: riseIn 760ms 120ms cubic-bezier(0.2, 0.8, 0.2, 1) both;
}

.hero-photo {
  position: relative;
  width: min(43vh, 320px);
  aspect-ratio: 4 / 5;
  margin: 0 0 22px;
  border: 1px solid rgba(255, 250, 243, 0.22);
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 26px 80px rgba(0, 0, 0, 0.44);
  transform: rotate(-2deg);
  animation: photoReveal 900ms 260ms cubic-bezier(0.2, 0.8, 0.2, 1) both;
}

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

.hero-photo span {
  position: absolute;
  left: 10px;
  bottom: 10px;
  padding: 7px 9px;
  border-radius: 6px;
  background: rgba(4, 11, 15, 0.68);
  color: var(--gold);
  font-size: 0.74rem;
  font-weight: 900;
}

.hero__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 28px;
}

.hero__actions button,
.gallery-head button,
#replay-button {
  min-width: 132px;
  padding-inline: 18px;
}

.ghost,
.gallery-head button {
  border: 1px solid rgba(255, 250, 243, 0.32);
  border-radius: 8px;
  background: rgba(255, 250, 243, 0.1);
  color: var(--ink);
  font-weight: 750;
}

.dashboard {
  min-height: 100svh;
  padding: max(14px, env(safe-area-inset-top)) clamp(12px, 3vw, 34px) max(22px, env(safe-area-inset-bottom));
  background: rgba(2, 8, 11, 0.56);
  -webkit-backdrop-filter: blur(9px);
  backdrop-filter: blur(9px);
  animation: fadeIn 360ms ease both;
}

.mobile-header {
  display: none;
}

.tabs {
  position: sticky;
  top: 14px;
  z-index: 5;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  max-width: 900px;
  margin: 0 auto 18px;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(8, 18, 23, 0.82);
  box-shadow: 0 14px 44px rgba(0, 0, 0, 0.28);
}

.tab {
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  font-size: clamp(0.78rem, 0.88rem, 0.98rem);
  font-weight: 800;
}

.tab.is-active {
  background: rgba(255, 250, 243, 0.14);
  color: var(--ink);
}

.progress-dots {
  display: none;
}

.views {
  max-width: 1120px;
  margin: 0 auto;
}

.view {
  display: none;
}

.view.is-active {
  display: block;
  animation: slideSoft 360ms cubic-bezier(0.2, 0.8, 0.2, 1) both;
}

.constellation-wrap {
  position: relative;
  overflow: hidden;
  min-height: 72vh;
  border: 1px solid var(--line);
  border-radius: 8px;
  background:
    radial-gradient(circle at 24% 16%, rgba(149, 240, 209, 0.16), transparent 26%),
    radial-gradient(circle at 78% 28%, rgba(255, 141, 161, 0.18), transparent 30%),
    rgba(7, 17, 23, 0.78);
  box-shadow: inset 0 0 80px rgba(255, 141, 161, 0.08);
}

.constellation-message {
  position: absolute;
  top: 24px;
  left: 50%;
  z-index: 2;
  width: min(720px, calc(100% - 32px));
  padding: 16px 18px;
  border: 1px solid rgba(255, 217, 138, 0.36);
  border-radius: 8px;
  background: rgba(4, 11, 15, 0.72);
  box-shadow: 0 18px 70px rgba(255, 141, 161, 0.18);
  color: var(--ink);
  text-align: center;
  transform: translateX(-50%);
  -webkit-backdrop-filter: blur(14px);
  backdrop-filter: blur(14px);
}

.constellation-message strong {
  display: block;
  color: var(--gold);
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(1.55rem, 2.1rem, 2.4rem);
  line-height: 1;
}

.constellation-message span {
  display: block;
  margin-top: 6px;
  color: var(--ink);
  font-weight: 800;
}

#constellation {
  width: 100%;
  height: 72vh;
  display: block;
}

.counter {
  position: absolute;
  right: 18px;
  bottom: 18px;
  min-width: 180px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(6, 15, 20, 0.76);
}

.counter span {
  display: block;
  color: var(--gold);
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(2.4rem, 3.2rem, 4.2rem);
  line-height: 0.9;
}

.counter small {
  color: var(--muted);
  font-weight: 750;
  display: block;
  white-space: normal;
  overflow-wrap: break-word;
}

.timeline {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
}

.memory,
.photo-card,
.letter {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-strong);
  box-shadow: 0 20px 70px rgba(0, 0, 0, 0.24);
}

.memory {
  min-height: 245px;
  padding: 24px;
  transform-origin: center bottom;
  animation: cardIn 520ms ease both;
}

.memory:nth-child(2) {
  animation-delay: 90ms;
}

.memory:nth-child(3) {
  animation-delay: 180ms;
}

.memory span {
  color: var(--mint);
  font-size: 0.82rem;
  font-weight: 850;
  text-transform: uppercase;
}

.memory h3,
.letter h3,
.gallery-head h3 {
  margin: 12px 0;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(1.45rem, 1.9rem, 2.3rem);
  letter-spacing: 0;
}

.memory p,
.letter p {
  color: var(--muted);
  line-height: 1.7;
}

.gallery-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 16px;
}

.gallery-head h3 {
  margin: 0;
}

.gallery {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
}

.photo-card {
  overflow: hidden;
  min-height: 310px;
  animation: cardIn 520ms ease both;
}

.photo-card:nth-child(2) {
  animation-delay: 80ms;
}

.photo-card:nth-child(3) {
  animation-delay: 160ms;
}

.photo-card:nth-child(4) {
  animation-delay: 240ms;
}

.photo-card__image {
  display: grid;
  min-height: 224px;
  padding: 18px;
  place-items: end start;
  background:
    linear-gradient(180deg, rgba(4, 11, 15, 0.02), rgba(4, 11, 15, 0.42)),
    var(--photo, none) center / cover no-repeat;
  transition: transform 500ms ease;
}

.photo-card:active .photo-card__image,
.photo-card:hover .photo-card__image {
  transform: scale(1.025);
}

.photo-card__image span {
  max-width: 100%;
  padding: 8px 10px;
  border-radius: 6px;
  background: rgba(4, 11, 15, 0.64);
  color: var(--ink);
  font-size: 0.8rem;
  font-weight: 850;
}

.photo-card p {
  margin: 0;
  padding: 16px;
  color: var(--muted);
  line-height: 1.55;
}

.letter {
  max-width: 760px;
  margin: 0 auto;
  padding: clamp(26px, 5vw, 56px);
}

.letter p {
  font-size: 1.08rem;
}

.is-hidden {
  display: none;
}

@keyframes riseIn {
  from {
    opacity: 0;
    transform: translateY(22px) scale(0.98);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

@keyframes slideSoft {
  from {
    opacity: 0;
    transform: translateX(16px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

@keyframes cardIn {
  from {
    opacity: 0;
    transform: translateY(16px) scale(0.98);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes photoReveal {
  from {
    opacity: 0;
    transform: translateY(20px) rotate(3deg) scale(0.92);
  }
  to {
    opacity: 1;
    transform: translateY(0) rotate(-2deg) scale(1);
  }
}

@keyframes floatHeart {
  0%,
  100% {
    transform: translate3d(0, 0, 0) scale(1);
    opacity: 0.42;
  }
  50% {
    transform: translate3d(12px, -28px, 0) scale(1.12);
    opacity: 0.9;
  }
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
}

@media (max-width: 860px) {
  body {
    background-position: 54% center;
  }

  body::before {
    background:
      linear-gradient(180deg, rgba(3, 10, 14, 0.28), rgba(3, 10, 14, 0.74) 46%, rgba(3, 10, 14, 0.92)),
      linear-gradient(90deg, rgba(3, 10, 14, 0.56), rgba(3, 10, 14, 0.18));
  }

  h1,
  h2 {
    font-size: clamp(2.18rem, 2.72rem, 3.3rem);
    line-height: 0.98;
  }

  .gate {
    align-items: end;
  }

  .gate__panel {
    padding: 24px;
  }

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

  .secret-form input,
  .secret-form button,
  .hero__actions button,
  .gallery-head button,
  #replay-button {
    width: 100%;
    min-height: 54px;
  }

  .hero {
    align-items: end;
  }

  .hero__content {
    padding-bottom: 0;
  }

  .hero p {
    font-size: 1rem;
    line-height: 1.56;
  }

  .hero-photo {
    width: min(62vw, 246px);
    margin-bottom: 18px;
  }

  .hero__actions {
    display: grid;
    grid-template-columns: 1fr;
    gap: 10px;
  }

  .dashboard {
    padding-inline: 10px;
    width: min(100%, 430px);
    max-width: 430px;
    margin-inline: 0;
    overflow-x: hidden;
  }

  .tabs,
  .views,
  .view,
  .timeline,
  .memory,
  .gallery,
  .photo-card,
  .letter,
  .constellation-wrap {
    width: 100%;
    max-width: 100%;
  }

  .mobile-header {
    display: block;
    padding: 4px 4px 10px;
  }

  .mobile-header .eyebrow {
    margin-bottom: 4px;
  }

  .mobile-header h2 {
    margin: 0;
    font-size: 2.2rem;
  }

  .secret-form,
  .timeline,
  .gallery {
    grid-template-columns: 1fr;
  }

  .tabs {
    top: max(8px, env(safe-area-inset-top));
    grid-template-columns: repeat(2, minmax(0, 1fr));
    max-width: none;
    margin-bottom: 10px;
    overflow-x: visible;
    overscroll-behavior-x: contain;
    scrollbar-width: none;
  }

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

  .tab {
    min-height: 46px;
    white-space: nowrap;
  }

  .progress-dots {
    display: flex;
    justify-content: center;
    gap: 7px;
    margin: 6px 0 12px;
  }

  .progress-dots span {
    width: 7px;
    height: 7px;
    border-radius: 999px;
    background: rgba(255, 250, 243, 0.28);
    transition:
      width 240ms ease,
      background 240ms ease;
  }

  .progress-dots span.is-active {
    width: 22px;
    background: var(--gold);
  }

  .constellation-wrap {
    min-height: 68svh;
  }

  #constellation {
    height: 68svh;
  }

  .counter {
    right: 12px;
    bottom: 12px;
    left: 12px;
    display: block;
    gap: 12px;
    padding: 14px;
  }

  .counter small {
    min-width: 0;
    margin-top: 5px;
    text-align: left;
    overflow-wrap: anywhere;
    font-size: 0.78rem;
  }

  .constellation-message {
    top: 12px;
    padding: 13px 14px;
  }

  .constellation-message strong {
    font-size: 1.55rem;
  }

  .gallery-head {
    align-items: stretch;
    flex-direction: column;
  }

  .photo-card {
    min-height: auto;
  }

  .photo-card__image {
    min-height: 62svh;
    background-position: center top;
  }

  .letter {
    padding: 24px;
  }
}

@media (max-width: 480px) {
  .gate,
  .hero {
    padding-inline: 14px;
  }

  .gate__panel {
    padding: 22px 18px;
  }

  .hero-photo {
    width: min(58vw, 218px);
  }

  .hero p,
  .gate__copy {
    font-size: 0.98rem;
  }

  .tabs {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 6px;
    padding: 6px;
  }

  .constellation-wrap {
    min-height: 70svh;
  }

  #constellation {
    height: 70svh;
  }

  .counter span {
    font-size: 2.15rem;
  }

  .counter small {
    max-width: none;
    line-height: 1.25;
  }
}

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