:root {
  --lemon: #ffda17;
  --ink: #20201e;
  --paper: #fffef8;
  --depth: #b38c00;
}

* { box-sizing: border-box; }
html { min-height: 100%; }
body {
  min-height: 100vh;
  margin: 0;
  color: var(--ink);
  font-family: "DM Sans", sans-serif;
  background: var(--lemon);
  overflow-x: hidden;
}
body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  opacity: .19;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 180 180' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='.22'/%3E%3C/svg%3E");
  mix-blend-mode: soft-light;
}

.photo-backdrop { position: fixed; inset: 0; overflow: hidden; pointer-events: none; }
.polaroid {
  position: absolute;
  width: clamp(108px, 12vw, 184px);
  padding: 7px 7px 24px;
  background: var(--paper);
  border: 1px solid #8c762638;
  border-radius: 2px;
  box-shadow: 0 12px 24px #40330038;
  opacity: .52;
  transform: rotate(var(--tilt));
  animation: photo-drift var(--duration) ease-in-out var(--delay) infinite alternate;
}
.polaroid img {
  display: block;
  width: 100%;
  aspect-ratio: 4 / 5;
  object-fit: cover;
  object-position: center 28%;
  filter: saturate(.7) contrast(.88);
}
.polaroid:nth-child(1) { top: 3%; left: 5%; --tilt: -13deg; --duration: 10s; --delay: -2s; }
.polaroid:nth-child(2) { top: 40%; left: max(-24px, calc(50% - 650px)); --tilt: 10deg; --duration: 12s; --delay: -7s; }
.polaroid:nth-child(3) { bottom: -11%; left: 12%; --tilt: -9deg; --duration: 11s; --delay: -4s; }
.polaroid:nth-child(4) { top: 8%; right: 7%; --tilt: 12deg; --duration: 12s; --delay: -3s; }
.polaroid:nth-child(5) { top: 48%; right: max(-24px, calc(50% - 642px)); --tilt: -12deg; --duration: 10s; --delay: -6s; }
.polaroid:nth-child(6) { bottom: -8%; right: 15%; --tilt: 10deg; --duration: 13s; --delay: -8s; }

@media (max-width: 760px) {
  .polaroid { width: clamp(88px, 24vw, 130px); padding: 5px 5px 17px; opacity: .42; }
  .polaroid:nth-child(1) { left: -29px; top: 4%; }
  .polaroid:nth-child(4) { right: -28px; top: 13%; }
  .polaroid:nth-child(2) { left: -38px; top: 54%; }
  .polaroid:nth-child(5) { right: -36px; top: 67%; }
  .polaroid:nth-child(3), .polaroid:nth-child(6) { display: none; }
}

.link-page {
  position: relative;
  z-index: 1;
  width: min(760px, calc(100% - 32px));
  min-height: 100vh;
  margin: 0 auto;
  padding: 60px 0 54px;
  display: flex;
  flex-direction: column;
  justify-content: center;
}
.profile { text-align: center; }
.avatar-wrap {
  position: relative;
  width: 188px;
  height: 188px;
  margin: 0 auto 12px;
  padding: 5px;
  border-radius: 50%;
  background: var(--ink);
  box-shadow: 0 14px 32px #40330026, 0 0 0 7px #fff5a266;
}
.avatar-wrap img {
  width: 100%; height: 100%;
  border-radius: 50%;
  object-fit: cover;
  object-position: center 20%;
  border: 4px solid white;
}
.mini-heart {
  position: absolute;
  right: -26px; top: 2px;
  color: var(--ink);
  font-size: 3.5rem;
  transform: rotate(13deg);
  text-shadow: 0 3px 0 var(--paper), 0 7px 16px #40330033;
  animation: heartbeat 1.8s ease-in-out infinite;
}
h1 {
  margin: 6px 0 20px;
  color: var(--ink);
  font-family: "Fredoka", sans-serif;
  font-size: clamp(2.4rem, 5.4vw, 3.96rem);
  line-height: .95;
  letter-spacing: -.07em;
  -webkit-text-stroke: 7px white;
  paint-order: stroke fill;
  text-shadow: 0 4px 0 var(--depth), 0 8px 18px #40330033;
}
.profile-title {
  width: min(80%, 480px);
  margin: 4px auto 8px;
  line-height: 0;
  letter-spacing: 0;
  -webkit-text-stroke: 0;
  text-shadow: none;
}
.profile-title img {
  display: block;
  width: 100%;
  height: auto;
  filter: drop-shadow(0 10px 14px #40330026);
}

.ticker {
  width: 100%;
  margin: 16px 0 20px;
  overflow: hidden;
  border: 2px solid var(--ink);
  border-radius: 999px;
  background: var(--paper);
  box-shadow: 0 4px 0 var(--ink);
}
.ticker-track {
  width: max-content;
  display: flex;
  animation: ticker-slide 18s linear infinite;
}
.ticker-set {
  display: flex;
  align-items: center;
  padding: 10px 0;
}
.ticker span {
  display: flex;
  align-items: center;
  white-space: nowrap;
  color: var(--ink);
  font-family: "Fredoka", sans-serif;
  font-size: .86rem;
  letter-spacing: .035em;
  text-transform: none;
}
.ticker span::after {
  content: "♥";
  margin: 0 1.25rem;
  color: #866500;
  font-size: .62rem;
}
.ticker:hover .ticker-track { animation-play-state: paused; }

.social-links {
  display: flex;
  justify-content: center;
  gap: 28px;
  margin: 0 0 24px;
}
.social-link {
  width: 74px;
  display: grid;
  justify-items: center;
  gap: 9px;
  color: var(--ink);
  font-family: "Fredoka", sans-serif;
  font-size: .78rem;
  font-weight: 600;
  letter-spacing: .01em;
  text-decoration: none;
}
.icon-bubble {
  width: 58px;
  height: 58px;
  display: grid;
  place-items: center;
  border: 2px solid var(--ink);
  border-radius: 50%;
  color: var(--ink);
  background: var(--paper);
  box-shadow: 0 5px 0 var(--ink);
  transition: transform .2s ease, box-shadow .2s ease, color .2s ease;
}
.icon-bubble svg { width: 27px; height: 27px; }
.social-link:hover .icon-bubble,
.social-link:focus-visible .icon-bubble {
  color: var(--ink);
  transform: translateY(-4px) rotate(-3deg);
  box-shadow: 0 8px 0 var(--ink);
}
.social-link:focus-visible { outline: 3px solid var(--ink); outline-offset: 5px; border-radius: 14px; }

.links { display: grid; gap: 0; }
.link-banner {
  position: relative;
  isolation: isolate;
  min-height: 190px;
  overflow: hidden;
  display: block;
  border: 5px solid rgba(255,255,255,.92);
  border-radius: 38px;
  box-shadow: 0 13px 35px rgba(198,28,91,.18), inset 0 0 0 2px rgba(255,95,151,.36);
  text-decoration: none;
  transform: translateZ(0);
  transition: transform .25s ease, box-shadow .25s ease;
}
.link-banner img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
  transition: transform .35s ease, filter .35s ease;
}
.link-banner::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  opacity: 0;
  background: rgba(255,255,255,.12);
  transition: opacity .25s ease;
}
.link-banner:hover { transform: translateY(-5px) scale(1.008); box-shadow: 0 20px 46px rgba(198,28,91,.27), inset 0 0 0 2px rgba(255,95,151,.45); }
.link-banner:hover::after { opacity: 1; }
.link-banner:hover img { transform: scale(1.035); filter: saturate(1.06); }
.telegram,
.beacons,
.mini-game {
  min-height: 0;
  aspect-ratio: 3 / 1;
  overflow: visible;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}
.telegram::after,
.beacons::after,
.mini-game::after { display: none; }
.telegram:hover,
.beacons:hover,
.mini-game:hover { box-shadow: none; }
.telegram img,
.beacons img,
.mini-game img { object-fit: contain; object-position: center; }

@keyframes photo-drift {
  to { transform: translate3d(8px, -18px, 0) rotate(calc(var(--tilt) + 4deg)); }
}
@keyframes heartbeat { 50% { transform: rotate(13deg) scale(1.12); } }
@keyframes ticker-slide { to { transform: translateX(-50%); } }

@media (max-width: 620px) {
  .link-page { width: min(100% - 22px, 520px); padding: 48px 0 34px; justify-content: flex-start; }
  .avatar-wrap { width: 144px; height: 144px; }
  .mini-heart { right: -20px; font-size: 2.7rem; }
  h1 { margin-bottom: 16px; font-size: clamp(2.22rem, 12vw, 3.24rem); -webkit-text-stroke-width: 4px; }
  .profile-title { width: 80%; margin: 2px auto 4px; -webkit-text-stroke: 0; }
  .ticker { margin: 16px 0 14px; }
  .ticker-set { padding: 8px 0; }
  .ticker span { font-size: .78rem; }
  .social-links { gap: 18px; margin-bottom: 20px; }
  .social-link { width: 66px; gap: 8px; font-size: .72rem; }
  .icon-bubble { width: 52px; height: 52px; }
  .icon-bubble svg { width: 24px; height: 24px; }
  .links { gap: 0; }
  .link-banner { min-height: 160px; border-width: 4px; border-radius: 29px; }
  .telegram,
  .beacons,
  .mini-game { min-height: 0; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* Instagram-style profile stories */
.avatar-wrap.story-trigger {
  display: block;
  border: 0;
  color: inherit;
  font: inherit;
  cursor: pointer;
  isolation: isolate;
}
.avatar-wrap.story-trigger::after {
  content: "";
  position: absolute;
  inset: -7px;
  z-index: -1;
  border: 2px solid #20201e80;
  border-radius: 50%;
  animation: story-ring 2.2s ease-in-out infinite;
}
.story-hint {
  position: absolute;
  left: 50%;
  bottom: -17px;
  padding: 4px 9px;
  border-radius: 999px;
  color: white;
  background: var(--ink);
  font: 700 .58rem/1 "DM Sans", sans-serif;
  white-space: nowrap;
  transform: translateX(-50%);
  box-shadow: 0 4px 12px #40330033;
}
.story-dialog {
  inset: 0;
  width: 100vw;
  max-width: none;
  height: 100dvh;
  max-height: none;
  margin: 0;
  padding: 0;
  border: 0;
  overflow: hidden;
  background: rgba(22,5,13,.94);
  opacity: 0;
  transition: opacity .28s ease;
}
.story-dialog[open] { display: grid; place-items: center; }
.story-dialog::backdrop { background: rgba(22,5,13,.72); backdrop-filter: blur(10px); }
.story-dialog.is-open { opacity: 1; }
.story-viewer {
  position: relative;
  width: min(100vw, 450px, 56.25dvh);
  aspect-ratio: 9 / 16;
  overflow: hidden;
  border-radius: 24px;
  background: #14040a;
  box-shadow: 0 30px 90px rgba(0,0,0,.55);
  transform: translateY(16px) scale(.96);
  transition: transform .36s cubic-bezier(.22,.9,.28,1);
}
.story-dialog.is-open .story-viewer { transform: translateY(0) scale(1); }
.story-progress {
  position: absolute;
  z-index: 8;
  top: 12px;
  left: 12px;
  right: 12px;
  display: flex;
  gap: 4px;
}
.story-progress span { height: 3px; flex: 1; overflow: hidden; border-radius: 3px; background: rgba(255,255,255,.34); }
.story-progress i { display: block; width: 100%; height: 100%; background: white; transform: scaleX(0); transform-origin: left; }
.story-header {
  position: absolute;
  z-index: 8;
  top: 28px;
  left: 14px;
  right: 12px;
  display: grid;
  grid-template-columns: 35px 1fr 34px 34px;
  gap: 9px;
  align-items: center;
  color: white;
  text-shadow: 0 1px 7px rgba(0,0,0,.65);
}
.story-header > img { width: 35px; height: 35px; border: 2px solid white; border-radius: 50%; object-fit: cover; }
.story-header > div { display: grid; gap: 1px; }
.story-header strong { font: 700 .82rem/1.1 "DM Sans", sans-serif; }
.story-header span { color: rgba(255,255,255,.74); font: 600 .64rem/1.1 "DM Sans", sans-serif; }
.story-close,
.story-sound { width: 34px; height: 34px; padding: 0; border: 0; border-radius: 50%; color: white; background: rgba(0,0,0,.24); backdrop-filter: blur(7px); font-size: 1.45rem; line-height: 1; }
.story-sound { font-size: 1rem; }
.story-stage { position: absolute; inset: 0; background: #1a080f; }
.story-stage.is-changing .story-media { animation: story-media-in .32s ease both; }
.story-media { position: absolute; inset: 0; width: 100%; height: 100%; display: none; object-fit: cover; }
.story-media.is-active { display: block; }
.story-stage::after { content: ""; position: absolute; inset: 0; pointer-events: none; background: linear-gradient(180deg,rgba(0,0,0,.38),transparent 22%,transparent 67%,rgba(0,0,0,.48)); }
.story-loading { position: absolute; z-index: 2; inset: 0; display: grid; place-items: center; color: white; font: 700 .75rem "DM Sans", sans-serif; }
.story-loading.is-hidden { display: none; }
.story-zone { position: absolute; z-index: 5; top: 75px; bottom: 90px; width: 43%; border: 0; background: transparent; }
.story-previous { left: 0; }
.story-next { right: 0; }
.story-footer { position: absolute; z-index: 8; left: 18px; right: 18px; bottom: 18px; }
.story-cta { min-height: 52px; padding: 0 20px; border: 1px solid rgba(255,255,255,.5); border-radius: 999px; display: flex; align-items: center; justify-content: center; gap: 12px; color: var(--ink); background: rgba(255,255,255,.94); font: 800 .9rem/1 "DM Sans", sans-serif; text-decoration: none; box-shadow: 0 10px 30px rgba(0,0,0,.22); backdrop-filter: blur(12px); transition: transform .2s ease, background .2s ease; }
.story-cta:hover { transform: translateY(-2px); background: white; }
.story-cta span { font-size: 1.25rem; }
body.story-open { overflow: hidden; }
@keyframes story-ring { 50% { transform: scale(1.045); opacity: .45; } }
@keyframes story-media-in { from { opacity: .55; transform: scale(1.035); } }
@media (max-width: 500px) {
  .story-viewer { width: min(100vw, 56.25dvh); border-radius: 18px; }
}
@media (prefers-reduced-motion: reduce) {
  .avatar-wrap.story-trigger::after { animation: none; }
  .story-dialog,
  .story-viewer { transition: none; }
  .story-stage.is-changing .story-media { animation: none; }
}
