*,
*::before,
*::after {
  box-sizing: border-box;
}

:root {
  --bg: #0a1628;
  --bg-soft: #122038;
  --gold: #c9a962;
  --gold-light: #e8d5b5;
  --aqua: #7eb8da;
  --mint: #4a9b8e;
  --text: #f4f0e8;
  --text-muted: rgba(244, 240, 232, 0.65);
  --card-w: min(92vw, 340px);
  --card-h: calc(var(--card-w) * 1.45);
  --radius: 20px;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

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

body {
  margin: 0;
  min-height: 100dvh;
  font-family: "Cormorant Garamond", Georgia, serif;
  color: var(--text);
  background: var(--bg);
  overflow-x: hidden;
  padding: calc(16px + var(--safe-top)) 16px calc(24px + var(--safe-bottom));
}

.mono {
  font-family: "JetBrains Mono", ui-monospace, monospace;
  font-size: 0.72rem;
  letter-spacing: 0.06em;
  text-transform: lowercase;
}

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

.orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(80px);
  opacity: 0.45;
  animation: drift 18s ease-in-out infinite alternate;
}

.orb-a {
  width: 55vw;
  height: 55vw;
  top: -10%;
  left: -15%;
  background: radial-gradient(circle, var(--mint) 0%, transparent 70%);
}

.orb-b {
  width: 65vw;
  height: 65vw;
  bottom: -20%;
  right: -20%;
  background: radial-gradient(circle, #2a4a7a 0%, transparent 70%);
  animation-delay: -6s;
}

.orb-c {
  width: 40vw;
  height: 40vw;
  top: 35%;
  right: 10%;
  background: radial-gradient(circle, rgba(201, 169, 98, 0.35) 0%, transparent 70%);
  animation: drift 22s ease-in-out infinite alternate-reverse;
  opacity: 0.35;
}

.grain {
  position: absolute;
  inset: 0;
  opacity: 0.35;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='0.5'/%3E%3C/svg%3E");
  mix-blend-mode: overlay;
}

@keyframes drift {
  from {
    transform: translate(0, 0) scale(1);
  }
  to {
    transform: translate(8%, 6%) scale(1.08);
  }
}

.app {
  position: relative;
  z-index: 1;
  max-width: 480px;
  margin: 0 auto;
  min-height: calc(100dvh - var(--safe-top) - var(--safe-bottom) - 40px);
  display: flex;
  flex-direction: column;
}

#sparkles {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 2;
}

body.ready .reveal {
  animation: fade-up 0.85s cubic-bezier(0.22, 1, 0.36, 1) backwards;
}

.d1 { animation-delay: 0.05s; }
.d2 { animation-delay: 0.12s; }
.d3 { animation-delay: 0.2s; }
.d4 { animation-delay: 0.28s; }
.d5 { animation-delay: 0.36s; }
.d6 { animation-delay: 0.46s; }
.d7 { animation-delay: 0.55s; }

@keyframes fade-up {
  from {
    opacity: 0;
    transform: translateY(18px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.hero {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: flex-start;
  gap: 1rem;
  transition: opacity 0.45s ease, transform 0.45s ease;
}

.hero.exit {
  opacity: 0;
  transform: translateY(-12px);
  pointer-events: none;
  position: absolute;
  width: 100%;
}

.eyebrow {
  color: var(--aqua);
  margin: 0;
  opacity: 0.9;
}

.title {
  margin: 0;
  font-weight: 600;
  font-size: clamp(2.4rem, 9vw, 3.2rem);
  line-height: 1.05;
}

.title-line {
  display: block;
  font-weight: 400;
  color: var(--text-muted);
  font-size: 0.55em;
  letter-spacing: 0.02em;
}

.title-name {
  display: block;
  background: linear-gradient(
    120deg,
    var(--gold-light),
    var(--gold),
    var(--aqua),
    var(--gold-light)
  );
  background-size: 200% auto;
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  animation: title-shimmer 5s ease-in-out infinite;
}

@keyframes title-shimmer {
  0%,
  100% {
    background-position: 0% center;
  }
  50% {
    background-position: 100% center;
  }
}

.from-line {
  margin: -0.25rem 0 0;
  font-size: 1.15rem;
  font-style: italic;
  color: var(--gold-light);
  letter-spacing: 0.02em;
}

.subtitle {
  margin: 0;
  font-size: 1.25rem;
  color: var(--text-muted);
  max-width: 28ch;
  line-height: 1.45;
}

.cta {
  position: relative;
  margin-top: 0.75rem;
  border: none;
  border-radius: 999px;
  padding: 1rem 1.75rem;
  font-family: inherit;
  font-size: 1.15rem;
  font-weight: 600;
  color: var(--bg);
  background: linear-gradient(135deg, var(--gold-light), var(--gold));
  cursor: pointer;
  overflow: hidden;
  box-shadow:
    0 4px 24px rgba(201, 169, 98, 0.35),
    inset 0 1px 0 rgba(255, 255, 255, 0.35);
  -webkit-tap-highlight-color: transparent;
  animation: cta-pulse 2.8s ease-in-out 1s infinite;
}

.cta:active {
  transform: scale(0.98);
}

.cta-shimmer {
  position: absolute;
  inset: 0;
  background: linear-gradient(
    105deg,
    transparent 40%,
    rgba(255, 255, 255, 0.45) 50%,
    transparent 60%
  );
  transform: translateX(-120%);
  animation: cta-sweep 3.5s ease-in-out infinite;
}

@keyframes cta-pulse {
  0%,
  100% {
    box-shadow:
      0 4px 24px rgba(201, 169, 98, 0.35),
      inset 0 1px 0 rgba(255, 255, 255, 0.35);
  }
  50% {
    box-shadow:
      0 6px 32px rgba(201, 169, 98, 0.55),
      inset 0 1px 0 rgba(255, 255, 255, 0.35);
  }
}

@keyframes cta-sweep {
  0%,
  70%,
  100% {
    transform: translateX(-120%);
  }
  85% {
    transform: translateX(120%);
  }
}

.cta-glow {
  position: absolute;
  inset: -50%;
  background: conic-gradient(from 0deg, transparent, rgba(255, 255, 255, 0.4), transparent);
  animation: spin 4s linear infinite;
  opacity: 0.5;
}

.cta-label {
  position: relative;
}

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

.hint {
  margin: 0.5rem 0 0;
  font-size: 0.95rem;
  color: var(--text-muted);
  opacity: 0.7;
}

.stage {
  flex: 1;
  display: flex;
  flex-direction: column;
  opacity: 0;
  transform: translateY(16px);
  transition: opacity 0.5s ease, transform 0.5s ease;
}

.stage.visible {
  opacity: 1;
  transform: translateY(0);
}

.stage.hidden {
  display: none;
}

.stage-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1rem;
}

.ghost-btn {
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: var(--text-muted);
  border-radius: 999px;
  padding: 0.45rem 0.85rem;
  font-family: inherit;
  font-size: 0.95rem;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.badge {
  color: var(--mint);
  opacity: 0.85;
}

.card-scene {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  perspective: 1200px;
  touch-action: none;
  min-height: min(62dvh, 520px);
  --rot-y: 0deg;
  --rot-x: 8deg;
  position: relative;
}

.card-scene.entered .card {
  animation: card-enter 0.9s cubic-bezier(0.22, 1, 0.36, 1);
}

@keyframes card-enter {
  from {
    opacity: 0;
    transform: rotateX(24deg) rotateY(-40deg) scale(0.72);
  }
  to {
    opacity: 1;
    transform: rotateX(var(--rot-x)) rotateY(var(--rot-y)) scale(1);
  }
}

.scene-glow {
  position: absolute;
  width: min(90vw, 360px);
  height: min(90vw, 360px);
  border-radius: 50%;
  background: radial-gradient(circle, rgba(126, 184, 218, 0.22), transparent 70%);
  animation: glow-pulse 3s ease-in-out infinite;
  pointer-events: none;
}

@keyframes glow-pulse {
  0%,
  100% {
    transform: scale(0.95);
    opacity: 0.7;
  }
  50% {
    transform: scale(1.08);
    opacity: 1;
  }
}

.card {
  width: var(--card-w);
  height: var(--card-h);
  position: relative;
  transform-style: preserve-3d;
  transform: rotateX(var(--rot-x)) rotateY(var(--rot-y));
  transition: transform 0.35s cubic-bezier(0.2, 0.8, 0.2, 1);
  cursor: grab;
  outline: none;
  -webkit-tap-highlight-color: transparent;
  z-index: 1;
}

.card.dragging {
  transition: none;
  cursor: grabbing;
}

.card.unwrapped {
  cursor: default;
  transform: rotateX(0deg) rotateY(180deg) scale(1.02);
  transition: transform 0.9s cubic-bezier(0.22, 1, 0.36, 1);
}

.card-inner {
  width: 100%;
  height: 100%;
  position: relative;
  transform-style: preserve-3d;
}

.card-face {
  position: absolute;
  inset: 0;
  border-radius: var(--radius);
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
  overflow: hidden;
  box-shadow:
    0 25px 50px rgba(0, 0, 0, 0.45),
    0 0 0 1px rgba(255, 255, 255, 0.08);
}

.card-front {
  background: linear-gradient(145deg, #1a3050 0%, #0d1a2e 55%, #152a45 100%);
  display: flex;
  align-items: stretch;
  justify-content: center;
}

.card-front::before {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(
    ellipse 80% 50% at 50% 0%,
    rgba(126, 184, 218, 0.25),
    transparent 60%
  );
  pointer-events: none;
}

.foil {
  position: absolute;
  inset: 0;
  background: linear-gradient(
    125deg,
    transparent 30%,
    rgba(201, 169, 98, 0.15) 45%,
    rgba(255, 255, 255, 0.12) 50%,
    rgba(201, 169, 98, 0.1) 55%,
    transparent 70%
  );
  background-size: 200% 200%;
  animation: foil 6s ease-in-out infinite;
  pointer-events: none;
}

@keyframes foil {
  0%,
  100% {
    background-position: 0% 50%;
  }
  50% {
    background-position: 100% 50%;
  }
}

.card-content {
  position: relative;
  z-index: 1;
  padding: 1.75rem 1.5rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  width: 100%;
}

.card-kicker {
  color: var(--aqua);
  margin: 0 0 1rem;
}

.card-heading {
  margin: 0;
  font-size: clamp(2rem, 8vw, 2.5rem);
  font-weight: 600;
  letter-spacing: 0.02em;
}

.card-tagline {
  margin: 0.75rem 0 0.2rem;
  font-size: 1.15rem;
  color: var(--text-muted);
  font-style: italic;
}

.card-tagline-detail {
  margin: 0 0 auto;
  font-size: 0.95rem;
  color: var(--text-muted);
  font-style: italic;
}

.card-tagline-detail em {
  font-style: italic;
}

.card-seal {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  margin: 1.5rem 0;
  background: linear-gradient(145deg, var(--gold), #8a7340);
  box-shadow:
    inset 0 2px 4px rgba(255, 255, 255, 0.35),
    0 8px 20px rgba(0, 0, 0, 0.35);
  font-size: 1.35rem;
  font-weight: 600;
  color: var(--bg);
  letter-spacing: 0.05em;
}

.card-from {
  margin: 0 0 0.35rem;
  font-size: 0.98rem;
  font-style: italic;
  color: var(--gold-light);
}

.card-tap {
  margin: 0;
  color: var(--gold);
  opacity: 0.85;
}

.pulse-text {
  animation: text-pulse 2s ease-in-out infinite;
}

@keyframes text-pulse {
  0%,
  100% {
    opacity: 0.65;
  }
  50% {
    opacity: 1;
  }
}

.card-back {
  transform: rotateY(180deg);
  background: linear-gradient(160deg, #f8f4ec 0%, #ebe3d4 100%);
  color: #1a2433;
}

.voucher {
  height: 100%;
  padding: 1.5rem 1.35rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.voucher-head {
  border-bottom: 1px solid rgba(26, 36, 51, 0.12);
  padding-bottom: 0.75rem;
}

.voucher-label {
  margin: 0;
  color: var(--mint);
}

.voucher-title {
  margin: 0.25rem 0 0;
  font-size: 1.75rem;
  font-weight: 600;
  color: #1a2433;
}

.voucher-details {
  margin: 0;
  flex: 1;
  display: grid;
  gap: 0.65rem;
}

.voucher-details div {
  display: grid;
  grid-template-columns: 5.5rem 1fr;
  gap: 0.5rem;
  align-items: baseline;
}

.voucher-details dt {
  margin: 0;
  font-family: "JetBrains Mono", monospace;
  font-size: 0.65rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: rgba(26, 36, 51, 0.5);
}

.voucher-details dd {
  margin: 0;
  font-size: 1.05rem;
  line-height: 1.35;
}

.voucher-note {
  margin: 0;
  font-size: 0.95rem;
  font-style: italic;
  color: rgba(26, 36, 51, 0.65);
}

.voucher-signature {
  margin: 0;
  text-align: center;
  font-size: 1.05rem;
  font-style: italic;
  color: #1a3050;
}

.pdf-btn {
  align-self: stretch;
  margin-top: 0.35rem;
  border: none;
  border-radius: 999px;
  padding: 0.7rem 1rem;
  font-family: inherit;
  font-size: 1rem;
  font-weight: 600;
  background: linear-gradient(135deg, #1a3050, #2a4a7a);
  color: var(--gold-light);
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  box-shadow: 0 6px 18px rgba(26, 48, 80, 0.25);
}

.confetti-btn {
  align-self: center;
  margin-top: 0.35rem;
  border: none;
  border-radius: 999px;
  padding: 0.55rem 1.15rem;
  font-family: inherit;
  font-size: 0.95rem;
  background: transparent;
  color: rgba(26, 36, 51, 0.7);
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.pdf-modal {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  pointer-events: none;
}

.pdf-modal.open {
  pointer-events: auto;
}

.pdf-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(5, 12, 24, 0.72);
  opacity: 0;
  transition: opacity 0.35s ease;
}

.pdf-modal.open .pdf-modal-backdrop {
  opacity: 1;
}

.pdf-modal-panel {
  position: relative;
  width: 100%;
  max-width: 480px;
  max-height: min(92dvh, 780px);
  background: #f8f4ec;
  border-radius: 24px 24px 0 0;
  padding: 1rem 1rem calc(1rem + var(--safe-bottom));
  transform: translateY(105%);
  transition: transform 0.45s cubic-bezier(0.22, 1, 0.36, 1);
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  box-shadow: 0 -20px 60px rgba(0, 0, 0, 0.35);
}

.pdf-modal.open .pdf-modal-panel {
  transform: translateY(0);
}

.pdf-modal-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 0.75rem;
}

.pdf-modal-kicker {
  margin: 0;
  color: var(--mint);
}

.pdf-modal-title {
  margin: 0.2rem 0 0;
  font-size: 1.5rem;
  color: #1a2433;
}

.pdf-modal-from {
  margin: 0.25rem 0 0;
  font-style: italic;
  color: rgba(26, 36, 51, 0.75);
}

.pdf-close {
  border: none;
  background: rgba(26, 36, 51, 0.08);
  width: 36px;
  height: 36px;
  border-radius: 50%;
  font-size: 1.4rem;
  line-height: 1;
  cursor: pointer;
  color: #1a2433;
}

.pdf-frame-wrap {
  flex: 1;
  min-height: 52dvh;
  border-radius: 14px;
  overflow: hidden;
  border: 1px solid rgba(26, 36, 51, 0.12);
  background: #fff;
}

.pdf-frame-wrap iframe {
  width: 100%;
  height: 100%;
  min-height: 52dvh;
  border: 0;
}

.pdf-fallback {
  margin: 0.5rem;
  font-size: 0.65rem;
  color: rgba(26, 36, 51, 0.6);
}

.pdf-open-native {
  display: block;
  text-align: center;
  padding: 0.85rem;
  border-radius: 999px;
  background: linear-gradient(135deg, var(--gold-light), var(--gold));
  color: var(--bg);
  font-weight: 600;
  text-decoration: none;
}

body.modal-open {
  overflow: hidden;
}

.pdf-modal.hidden {
  display: none;
}

.stage-hint {
  text-align: center;
  font-size: 0.95rem;
  color: var(--text-muted);
  margin: 1rem 0 0;
}

#confetti {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 100;
}

@media (prefers-reduced-motion: reduce) {
  .orb,
  .foil,
  .cta-glow,
  .cta-shimmer,
  .title-name,
  .pulse-text,
  .scene-glow,
  .reveal {
    animation: none;
  }

  .cta {
    animation: none;
  }

  .card,
  .card.unwrapped,
  .hero,
  .stage {
    transition: none;
  }

  #sparkles {
    display: none;
  }
}

@media (min-width: 480px) {
  body {
    padding-left: 24px;
    padding-right: 24px;
  }
}

/* --- Fake 404 intro --- */

body.phase-404 {
  background: #f6f6f6;
  color: #171717;
  padding: 24px 20px;
}

body.phase-404 .ambient,
body.phase-404 #sparkles {
  opacity: 0;
  visibility: hidden;
}

body.phase-gift .ambient,
body.phase-gift #sparkles {
  opacity: 1;
  visibility: visible;
  transition: opacity 0.8s ease 0.2s;
}

#gift-app.hidden {
  display: none;
}

.fake-404 {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: #f6f6f6;
  transition: opacity 0.45s ease, visibility 0.45s ease;
}

.fake-404.done {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.fake-404-inner {
  width: 100%;
  max-width: 420px;
  text-align: left;
  transition: opacity 0.35s ease, transform 0.35s ease;
}

.fake-404.revealing .fake-404-inner {
  opacity: 0;
  transform: scale(0.98);
  pointer-events: none;
}

.fake-404-code {
  margin: 0;
  font-size: 3.5rem;
  font-weight: 500;
  letter-spacing: -0.04em;
  color: #171717;
  line-height: 1;
}

.fake-404-title {
  margin: 0.35rem 0 0;
  font-family: "JetBrains Mono", ui-monospace, monospace;
  font-size: 1.25rem;
  font-weight: 500;
  color: #525252;
}

.fake-404-text {
  margin: 1.25rem 0 0;
  font-family: system-ui, -apple-system, sans-serif;
  font-size: 0.95rem;
  line-height: 1.5;
  color: #737373;
  max-width: 36ch;
}

.fake-404-log {
  margin: 1.25rem 0 0;
  padding: 0.85rem 1rem;
  background: #ebebeb;
  border: 1px solid #ddd;
  border-radius: 8px;
  font-size: 0.68rem;
  line-height: 1.55;
  color: #404040;
  overflow-x: auto;
  white-space: pre-wrap;
}

.fake-404-btn {
  margin-top: 1.35rem;
  border: 1px solid #171717;
  background: #171717;
  color: #fff;
  font-family: system-ui, -apple-system, sans-serif;
  font-size: 0.9rem;
  font-weight: 500;
  padding: 0.65rem 1.1rem;
  border-radius: 6px;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.fake-404-btn:disabled {
  opacity: 0.45;
  cursor: default;
}

.fake-404-foot {
  margin: 1.5rem 0 0;
  font-size: 0.62rem;
  color: #a3a3a3;
}

.fake-404-punchline {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%) scale(0.92);
  width: min(92vw, 360px);
  margin: 0;
  text-align: center;
  font-size: clamp(1.35rem, 5.5vw, 1.75rem);
  font-style: italic;
  font-weight: 600;
  color: #171717;
  opacity: 0;
  pointer-events: none;
}

.fake-404.revealing .fake-404-punchline {
  animation: punch-in 0.55s cubic-bezier(0.22, 1, 0.36, 1) forwards;
}

@keyframes punch-in {
  from {
    opacity: 0;
    transform: translate(-50%, -46%) scale(0.92);
  }
  to {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
  }
}

body.phase-gift {
  background: var(--bg);
  color: var(--text);
  transition: background 0.6s ease, color 0.6s ease;
}

/* --- Year journey mini-game (flat) --- */

.year-game {
  --world-progress: 0;
}

.year-game:not(.hidden) {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
  opacity: 0;
  transform: translateY(12px);
  transition: opacity 0.4s ease, transform 0.4s ease;
}

.year-game.visible {
  opacity: 1;
  transform: translateY(0);
}

.year-game.hidden {
  display: none;
}

.years-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.years-badge {
  color: var(--aqua);
  font-size: 0.65rem;
}

.years-title {
  margin: 0;
  font-size: clamp(1.35rem, 5vw, 1.75rem);
  font-weight: 600;
  line-height: 1.15;
}

.years-sub {
  margin: 0;
  color: var(--text-muted);
  font-size: 0.65rem;
}

.years-display {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 0.35rem 0.65rem;
  margin-top: 0.25rem;
}

.years-cal {
  font-size: 0.72rem;
  color: var(--aqua);
  opacity: 0.9;
}

.years-caption.flash {
  color: var(--gold-light);
  transition: color 0.3s ease;
}

.years-controls {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.5rem;
  margin-top: auto;
}

.years-controls--single {
  grid-template-columns: 1fr;
}

.years-ctrl {
  border: none;
  border-radius: 999px;
  padding: 0.8rem 0.65rem;
  font-family: inherit;
  font-size: 0.92rem;
  font-weight: 600;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.years-ctrl--back {
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-muted);
  border: 1px solid rgba(255, 255, 255, 0.16);
}

.years-ctrl--back.is-blocked {
  opacity: 0.55;
  cursor: not-allowed;
}

.years-ctrl--fwd {
  color: var(--bg);
  background: linear-gradient(135deg, var(--gold-light), var(--gold));
}

.years-ctrl--fwd:disabled,
.years-ctrl--fwd.is-done {
  opacity: 0.55;
  cursor: default;
}

.years-ctrl--fwd.is-continue {
  animation: cta-pulse 2.2s ease-in-out infinite;
}


.is-running .years-scroll-inner {
  will-change: transform;
}

.years-post.checkpoint-post .years-post-pole {
  background: rgba(201, 169, 98, 0.75);
}

.years-post.ljube-post .years-post-sign {
  border-color: rgba(100, 149, 237, 0.55);
}

.years-friends-cameo {
  position: absolute;
  bottom: 2px;
  z-index: 4;
  display: flex;
  flex-direction: column;
  align-items: center;
  pointer-events: none;
}

.years-friends-cameo[hidden],
.years-friends-cameo.hidden {
  display: none !important;
}

.friends-nearby .years-friends-cameo {
  z-index: 6;
}

.years-friends-bubble {
  margin: 0 0 6px;
  padding: 0.45rem 0.65rem;
  max-width: 168px;
  text-align: center;
  font-size: 0.72rem;
  line-height: 1.25;
  border-radius: 10px;
  background: rgba(244, 240, 232, 0.96);
  color: #1a2433;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.22);
  animation: fade-in 0.3s ease;
}

.years-friends-bubble[hidden],
.years-friends-bubble.hidden {
  display: none !important;
}

.years-friends-row {
  display: flex;
  align-items: flex-end;
  gap: 4px;
  isolation: isolate;
  filter: drop-shadow(0 4px 7px rgba(0, 0, 0, 0.28));
}

.years-friends-sprite {
  --sprite-frame-w: 52px;
  --sprite-frame-h: 104px;
  width: var(--sprite-frame-w);
  height: var(--sprite-frame-h);
  overflow: hidden;
  background-repeat: no-repeat;
  background-size: 400% 200%;
  background-position: 0 0;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
  flex-shrink: 0;
}


.friends-nearby .years-hero {
  z-index: 5;
}

.years-modal {
  position: fixed;
  inset: 0;
  z-index: 120;
  display: grid;
  place-items: center;
  padding: 20px;
  pointer-events: none;
}

.years-modal.open {
  pointer-events: auto;
}

.years-modal[hidden],
.years-modal.hidden {
  display: none !important;
  pointer-events: none !important;
}

.years-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(5, 12, 24, 0.72);
  opacity: 0;
  transition: opacity 0.28s ease;
}

.years-modal.open .years-modal-backdrop {
  opacity: 1;
}

.years-modal-card {
  position: relative;
  width: min(92vw, 340px);
  padding: 1.25rem 1.15rem;
  border-radius: 16px;
  background: #f8f4ec;
  color: #1a2433;
  text-align: center;
  transform: scale(0.94);
  opacity: 0;
  transition: transform 0.28s ease, opacity 0.28s ease;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.35);
}

.years-modal.open .years-modal-card {
  transform: scale(1);
  opacity: 1;
}

.years-modal-title {
  margin: 0;
  font-size: 1.35rem;
  font-weight: 600;
}

.years-modal-sub {
  margin: 0.5rem 0 0;
  font-size: 0.65rem;
  color: rgba(26, 36, 51, 0.55);
}

.years-modal-ok {
  margin-top: 1rem;
  border: none;
  border-radius: 999px;
  padding: 0.65rem 1.25rem;
  font-family: inherit;
  font-size: 1rem;
  font-weight: 600;
  background: #1a3050;
  color: var(--gold-light);
  cursor: pointer;
}

.years-big {
  font-size: clamp(3rem, 14vw, 4rem);
  font-weight: 600;
  line-height: 1;
  background: linear-gradient(135deg, var(--gold-light), var(--gold));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.years-unit {
  font-size: 1.1rem;
  color: var(--text-muted);
}

.years-caption {
  margin: 0;
  min-height: 2.6em;
  font-size: 1.05rem;
  line-height: 1.35;
  color: var(--text-muted);
  font-style: italic;
}

.years-scene {
  flex: 1;
  min-height: 200px;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  margin: 0.25rem 0;
  touch-action: pan-y;
}

.years-world {
  position: relative;
  flex: 1;
  min-height: 188px;
  border-radius: 18px;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.1);
  box-shadow: inset 0 0 60px rgba(126, 184, 218, 0.08);
}

.years-sky {
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, #1a3050 0%, #2a5578 42%, #7eb8da 100%);
}

.years-clouds {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.years-cloud {
  position: absolute;
  top: 14%;
  width: 56px;
  height: 18px;
  background: rgba(255, 255, 255, 0.35);
  border-radius: 999px;
  animation: cloud-drift 28s linear infinite;
}

.years-cloud::before,
.years-cloud::after {
  content: "";
  position: absolute;
  background: inherit;
  border-radius: 50%;
}

.years-cloud::before {
  width: 22px;
  height: 22px;
  top: -10px;
  left: 8px;
}

.years-cloud::after {
  width: 16px;
  height: 16px;
  top: -6px;
  right: 10px;
}

.years-cloud.c1 {
  left: 10%;
  animation-duration: 32s;
}

.years-cloud.c2 {
  left: 55%;
  top: 22%;
  opacity: 0.7;
  animation-duration: 24s;
  animation-delay: -8s;
}

.years-cloud.c3 {
  left: 78%;
  opacity: 0.5;
  animation-duration: 36s;
  animation-delay: -14s;
}

@keyframes cloud-drift {
  from {
    transform: translateX(0);
  }
  to {
    transform: translateX(calc(-120px - var(--world-progress) * 180px));
  }
}

.years-hills {
  position: absolute;
  left: -10%;
  right: -10%;
  height: 38%;
  bottom: 28%;
  border-radius: 50% 50% 0 0;
  pointer-events: none;
}

.years-hills--far {
  background: #3d6a52;
  opacity: 0.55;
  transform: translateX(calc(var(--world-progress) * -60px));
  transition: transform 0.45s cubic-bezier(0.22, 1, 0.36, 1);
}

.years-hills--near {
  background: #4a9b8e;
  opacity: 0.75;
  bottom: 22%;
  height: 32%;
  transform: translateX(calc(var(--world-progress) * -110px));
  transition: transform 0.45s cubic-bezier(0.22, 1, 0.36, 1);
}

.years-ground {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 42%;
  background: linear-gradient(180deg, #5cb88a 0%, #3d8f67 55%, #2f7353 100%);
  overflow: hidden;
}

.years-ground::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 6px;
  background: rgba(255, 255, 255, 0.25);
}

.years-scroll {
  position: absolute;
  inset: 0;
  overflow: hidden;
}

.years-scroll-inner {
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  height: 100%;
  transition: transform 0.48s cubic-bezier(0.22, 1, 0.36, 1);
  will-change: transform;
}

.years-post {
  position: absolute;
  bottom: 8px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  transform: translateX(-50%);
  opacity: 0.75;
  transition: opacity 0.25s ease, transform 0.25s ease;
  border: none;
  background: transparent;
  padding: 0;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.years-post-pole {
  width: 3px;
  height: 22px;
  background: rgba(26, 36, 51, 0.35);
  border-radius: 2px;
}

.years-post-sign {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1px;
  font-size: 0.55rem;
  padding: 3px 5px;
  min-width: 52px;
  border-radius: 4px;
  background: rgba(244, 240, 232, 0.85);
  color: #1a2433;
  line-height: 1.15;
}

.years-sign-date {
  font-size: 0.48rem;
  letter-spacing: -0.02em;
}

.years-sign-age {
  font-size: 0.62rem;
  font-weight: 600;
}

.years-sign-sub {
  font-size: 0.58rem;
  font-weight: 600;
  color: #4a2030;
}

.years-post.meet-post .years-post-sign {
  background: linear-gradient(135deg, #f5d4e4, #f5a8c8);
  color: #4a2030;
  box-shadow: 0 0 14px rgba(245, 168, 200, 0.45);
}

.years-post.meet-here .years-post-pole {
  background: #d4689a;
}

.years-post.goal-post .years-post-sign {
  background: linear-gradient(135deg, var(--gold-light), var(--gold));
}

.years-post.passed .years-post-sign {
  background: rgba(126, 184, 218, 0.9);
}

.years-post.current {
  opacity: 1;
  transform: translateX(-50%) scale(1.08);
}

.years-post.current .years-post-sign {
  background: linear-gradient(135deg, var(--gold-light), var(--gold));
  font-weight: 600;
}

.years-post.goal .years-post-sign {
  box-shadow: 0 0 12px rgba(201, 169, 98, 0.65);
}

.years-tree {
  position: absolute;
  bottom: 10px;
  width: 0;
  height: 0;
  border-left: 10px solid transparent;
  border-right: 10px solid transparent;
  border-bottom: 28px solid #2a5c42;
}

.years-tree::after {
  content: "";
  position: absolute;
  left: -6px;
  top: 28px;
  width: 12px;
  height: 8px;
  background: #4a3728;
  border-radius: 2px;
}

.years-meet-bubble {
  position: absolute;
  left: 50%;
  top: 18%;
  transform: translateX(-50%);
  z-index: 6;
  text-align: center;
  padding: 0.5rem 0.75rem;
  border-radius: 12px;
  background: rgba(244, 240, 232, 0.95);
  color: #1a2433;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.25);
  animation: fade-in 0.35s ease;
}

.years-meet-bubble p {
  margin: 0;
  font-size: 0.95rem;
}

.years-meet-bubble .mono {
  font-size: 0.65rem;
  color: #d4689a;
  margin-bottom: 0.15rem;
}

.years-meet-bubble[hidden],
.years-meet-bubble.hidden {
  display: none !important;
  pointer-events: none !important;
}

.years-hero {
  position: absolute;
  left: 34%;
  bottom: 4px;
  z-index: 5;
  transform: translateX(-50%);
  pointer-events: none;
  transition: transform 0.35s ease;
}

.years-hero.party {
  left: 34%;
}

.years-hero.meet-moment {
  transform: translateX(-50%) scale(1.06);
}

.years-hero.face-left .years-party {
  transform: scaleX(-1);
}

.years-party {
  display: flex;
  align-items: flex-end;
  gap: 2px;
  transform-origin: center bottom;
  filter: none;
}

.years-laki-sprite,
.years-jova-sprite,
.years-friends-sprite {
  --sprite-frame-w: 52px;
  /* sheet cells are 125×250 (1:2) on 500×500 @ 4×2 */
  --sprite-frame-h: 104px;
  width: var(--sprite-frame-w);
  height: var(--sprite-frame-h);
  overflow: hidden;
  background-repeat: no-repeat;
  background-size: 400% 200%;
  background-position: 0 0;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
  transform-origin: center bottom;
  flex-shrink: 0;
  backface-visibility: hidden;
}

.years-jova-sprite.hidden {
  display: none;
}

.years-laki-sprite.is-walking,
.years-jova-sprite.is-walking,
.years-laki-sprite.is-cheering,
.years-jova-sprite.is-cheering,
.years-friends-sprite.is-cheering {
  animation: none !important;
}

@keyframes laki-walk-sheet {
  0% {
    background-position: 0 0;
  }
  12.5% {
    background-position: -52px 0;
  }
  25% {
    background-position: -104px 0;
  }
  37.5% {
    background-position: -156px 0;
  }
  50% {
    background-position: 0 -104px;
  }
  62.5% {
    background-position: -52px -104px;
  }
  75% {
    background-position: -104px -104px;
  }
  87.5% {
    background-position: -156px -104px;
  }
}

.years-progress {
  display: flex;
  gap: 3px;
  justify-content: center;
  flex-wrap: wrap;
  padding: 0 4px;
}

.years-dot {
  width: 6px;
  height: 6px;
  border-radius: 1px;
  background: rgba(255, 255, 255, 0.2);
  transition: background 0.2s ease, transform 0.2s ease;
}

.years-dot.passed {
  background: var(--mint);
}

.years-dot.current {
  background: var(--gold);
  transform: scale(1.35);
}


.years-win {
  position: fixed;
  inset: 0;
  z-index: 90;
  display: grid;
  place-content: center;
  justify-items: center;
  background: rgba(10, 22, 40, 0.85);
  backdrop-filter: blur(6px);
  animation: fade-in 0.35s ease;
}

.years-win[hidden],
.years-win.hidden {
  display: none !important;
  pointer-events: none !important;
}

.years-birthday-card {
  max-width: min(22rem, 92vw);
  margin: 0 1rem;
  padding: 1.35rem 1.25rem 1.5rem;
  border-radius: 16px;
  background: linear-gradient(160deg, #f8f4ec 0%, #ebe3d4 100%);
  color: #1a2433;
  box-shadow:
    0 24px 48px rgba(0, 0, 0, 0.35),
    inset 0 1px 0 rgba(255, 255, 255, 0.65);
  animation: fade-in 0.4s ease;
}

.years-win-age {
  margin: 0;
  font-size: clamp(3rem, 16vw, 4.25rem);
  font-weight: 600;
  line-height: 1;
  text-align: center;
  background: linear-gradient(135deg, #8a7340, #2a5578);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.years-birthday-text {
  margin: 1rem 0 0;
  font-size: clamp(0.95rem, 4.2vw, 1.08rem);
  line-height: 1.55;
  text-align: center;
  font-style: italic;
  color: #2a3545;
}

.years-birthday-timer-wrap {
  margin-top: 1.25rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.65rem;
}

.years-birthday-timer-label {
  margin: 0;
  font-size: 0.62rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: #6a7585;
}

.years-birthday-timer {
  position: relative;
  width: 4.5rem;
  height: 4.5rem;
}

.years-birthday-ring {
  width: 100%;
  height: 100%;
  transform: rotate(-90deg);
}

.years-birthday-ring-glow {
  fill: none;
  stroke: rgba(201, 169, 98, 0.22);
  stroke-width: 10;
  filter: blur(3px);
}

.years-birthday-ring-track {
  fill: none;
  stroke: rgba(26, 36, 51, 0.1);
  stroke-width: 4;
}

.years-birthday-ring-progress {
  fill: none;
  stroke: url(#years-birthday-ring-gradient);
  stroke-width: 4;
  stroke-linecap: round;
  transition: stroke-dashoffset 0.08s linear;
}

.years-birthday-count {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  font-size: 1.35rem;
  font-weight: 600;
  color: #1a3050;
  text-shadow: 0 0 18px rgba(126, 184, 218, 0.45);
}

.years-birthday-count.tick {
  animation: birthday-count-pop 0.45s ease;
}

@keyframes birthday-count-pop {
  0% {
    transform: scale(1.35);
    opacity: 0.65;
  }
  55% {
    transform: scale(0.92);
  }
  100% {
    transform: scale(1);
    opacity: 1;
  }
}

@keyframes fade-in {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

@media (prefers-reduced-motion: reduce) {
  .years-laki-sprite.is-walking,
  .years-jova-sprite.is-walking,
  .years-laki-sprite.is-cheering,
  .years-jova-sprite.is-cheering,
  .years-cloud {
    animation: none;
  }

  .years-scroll-inner,
  .years-hills--far,
  .years-hills--near {
    transition: none;
  }
}
