:root {
  --bg: #c6e9fc;
  --text: #0d0d0d;
  --muted: #5d6b73;
  --card-radius: 32px;
  --pill-bg: #ffffff;
  --telegram: #2aabee;
}

* { box-sizing: border-box; }

html, body { margin: 0; }

body {
  min-height: 100vh;
  min-height: 100dvh;
  background: var(--bg);
  color: var(--text);
  font-family: "Inter", system-ui, -apple-system, sans-serif;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

body::after {
  content: "";
  position: fixed;
  inset: auto 0 0 0;
  height: 56px;
  background: linear-gradient(to bottom, transparent, rgba(150, 190, 210, 0.45));
  pointer-events: none;
}

.page {
  max-width: 600px;
  margin: 0 auto;
  padding: 72px 16px 40px;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.profile {
  display: flex;
  align-items: center;
  gap: 22px;
}

.avatar {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  object-fit: cover;
  object-position: center 12%;
  background: #e7f5fd;
}

.name {
  margin: 0;
  font-size: 30px;
  font-weight: 800;
  letter-spacing: -0.04em;
}

.tagline {
  margin: 22px 0 34px;
  font-size: 18px;
  text-align: center;
}

/* Card stack */
.stack-wrap {
  position: relative;
  width: min(536px, 100%);
  aspect-ratio: 536 / 480;
}

.stack {
  position: absolute;
  inset: 0;
  touch-action: pan-y;
}

.card {
  position: absolute;
  inset: 0;
  border-radius: var(--card-radius);
  overflow: hidden;
  background: #9fb8c6;
  box-shadow: 0 10px 30px rgba(20, 60, 80, 0.18);
  transition: transform 0.45s cubic-bezier(0.22, 1, 0.36, 1), opacity 0.35s ease;
  will-change: transform;
  user-select: none;
  -webkit-user-select: none;
}

.card img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center 30%;
  display: block;
  pointer-events: none;
}

.card[data-pos="0"] { z-index: 3; transform: none; }
.card[data-pos="1"] { z-index: 2; transform: translateX(-12px) rotate(-2.5deg) scale(0.985); }
.card[data-pos="rest"] { z-index: 1; transform: translateX(-12px) rotate(-2.5deg) scale(0.97); opacity: 0; }
.card.leaving { z-index: 4; transform: translateX(-115%) rotate(-14deg); opacity: 0; }

.nav-btn {
  position: absolute;
  left: -10px;
  top: 50%;
  translate: 0 -50%;
  z-index: 5;
  width: 52px;
  height: 52px;
  border-radius: 50%;
  border: 4px solid rgba(255, 255, 255, 0.55);
  background: #f3f3f3;
  background-clip: padding-box;
  color: #333;
  display: grid;
  place-items: center;
  cursor: pointer;
  transition: transform 0.15s ease;
}
.nav-btn:active { transform: scale(0.94); }

/* Link pills over the stack */
.links {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 40px;
  z-index: 5;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  pointer-events: none;
}

.pill {
  pointer-events: auto;
  display: inline-flex;
  align-items: center;
  gap: 14px;
  padding: 10px 26px 10px 14px;
  background: var(--pill-bg);
  border-radius: 999px;
  border: 1px solid rgba(0, 0, 0, 0.12);
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.12);
  color: #222;
  text-decoration: none;
  font-size: 16px;
  font-weight: 500;
  transition: transform 0.15s ease;
}
.pill:active { transform: scale(0.96); }

.pill-icon { width: 34px; height: 34px; flex-shrink: 0; }

.footer {
  margin-top: 44px;
  font-size: 12px;
  color: var(--muted);
  text-align: center;
}

/* Fallback overlay */
.overlay {
  position: fixed;
  inset: 0;
  z-index: 50;
  background: rgba(0, 0, 0, 0.72);
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  padding: 12px 16px;
}
.overlay[hidden] { display: none; }

.overlay-arrow { margin-right: 4px; animation: nudge 1.2s ease-in-out infinite; }

@keyframes nudge {
  50% { transform: translate(4px, -4px); }
}

.overlay-card {
  align-self: center;
  margin-top: 24px;
  width: min(340px, 100%);
  background: #fff;
  border-radius: 20px;
  padding: 22px;
  text-align: center;
}
.overlay-title { margin: 0 0 8px; font-weight: 700; font-size: 18px; }
.overlay-text { margin: 0 0 18px; color: #333; line-height: 1.45; }
.overlay-close {
  border: 0;
  border-radius: 999px;
  background: var(--telegram);
  color: #fff;
  font: inherit;
  font-weight: 600;
  padding: 10px 28px;
  cursor: pointer;
}

@media (max-width: 480px) {
  .page { padding-top: 48px; }
  .stack-wrap { aspect-ratio: 4 / 5; }
  .avatar { width: 64px; height: 64px; }
  .name { font-size: 26px; }
  .tagline { font-size: 16px; margin: 18px 0 28px; }
  .nav-btn { left: -6px; }
}

@media (prefers-reduced-motion: reduce) {
  .card, .overlay-arrow { transition: none; animation: none; }
}
