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

:root {
  --bg: #e6e7dd;
  --text: #111;
  --text-muted: #5a5a52;
  --border: #000;
  --shadow: 4px 4px 0 var(--border);
  --content-pad-x: 24px;
  --content-max: 480px;
  --avatar-size: 96px;
  --avatar-shift-x: 12%;
  --avatar-shift-y: 60%;
  --avatar-scale: 2.71;
  --btn-height: 52px;
  --btn-radius: 9999px;
  --btn-border: 2px;
  --header-icon-size: 44px;
  --social-icon-size: 20px;
  --link-app-icon: 32px;
  --font: "Inter", system-ui, -apple-system, sans-serif;
}

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

body {
  margin: 0;
  min-height: 100dvh;
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.4;
}

.hidden {
  display: none !important;
}

/* Escape banner */
.escape-banner {
  position: sticky;
  top: 0;
  z-index: 100;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 10px 16px;
  padding: 12px 16px;
  background: #1a1a1a;
  color: #fff;
  font-size: 13px;
}

.escape-banner__text {
  margin: 0;
  text-align: center;
  flex: 1 1 200px;
}

.escape-banner__btn {
  flex-shrink: 0;
  padding: 8px 16px;
  border: 2px solid #fff;
  border-radius: 999px;
  background: #fff;
  color: #111;
  font-family: inherit;
  font-size: 13px;
  text-decoration: none;
  text-align: center;
  font-weight: 600;
  cursor: pointer;
}

.escape-banner__btn:active {
  transform: translate(1px, 1px);
}

/* Page layout — Linktree: full beige canvas */
.page {
  display: flex;
  justify-content: center;
  min-height: 100dvh;
  background: var(--bg);
}

.card {
  display: flex;
  flex-direction: column;
  width: 100%;
  max-width: var(--content-max);
  min-height: 100dvh;
  padding: 12px var(--content-pad-x) 40px;
  background: var(--bg);
}

@media (min-width: 768px) {
  .card {
    min-height: auto;
    margin: 48px 0;
    padding: 20px var(--content-pad-x) 48px;
    border-radius: 24px;
  }
}

.card__header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  min-height: var(--header-icon-size);
  margin-bottom: 4px;
}

.card__header-spacer {
  width: var(--header-icon-size);
  height: var(--header-icon-size);
  flex-shrink: 0;
}

.icon-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: var(--header-icon-size);
  height: var(--header-icon-size);
  border: none;
  border-radius: 50%;
  background: #fff;
  color: var(--text);
  cursor: pointer;
  box-shadow: none;
  outline: none;
  -webkit-tap-highlight-color: transparent;
}

.icon-btn svg {
  width: 18px;
  height: 18px;
}

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

.icon-btn:focus,
.icon-btn:focus-visible,
.icon-btn:active {
  outline: none;
  box-shadow: none;
}

.icon-btn:not(:disabled):active {
  transform: scale(0.96);
}

/* Profile */
.profile {
  text-align: center;
  margin-bottom: 20px;
}

.profile__avatar {
  position: relative;
  width: var(--avatar-size);
  height: var(--avatar-size);
  margin: 32px auto 16px;
  border-radius: 50%;
  overflow: hidden;
  background: #fff;
}

.profile__avatar img {
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  object-position: center center;
  transform-origin: center center;
  transform: translate(var(--avatar-shift-x), var(--avatar-shift-y))
    scale(var(--avatar-scale));
}

.profile__name {
  margin: 0 0 6px;
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.2;
}

.profile__tagline {
  margin: 0 0 16px;
  font-size: 16px;
  font-weight: 400;
  color: var(--text-muted);
  line-height: 1.35;
}

.social {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 18px;
}

.social__link {
  display: flex;
  color: var(--text);
  opacity: 0.9;
}

.social__link svg {
  width: var(--social-icon-size);
  height: var(--social-icon-size);
}

.social__link:hover {
  opacity: 1;
}

/* Link buttons — Linktree pill + hard shadow */
.links {
  display: flex;
  flex-direction: column;
  gap: 16px;
  margin-top: 4px;
}

a.link-btn {
  text-decoration: none;
}

.link-btn {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-height: var(--btn-height);
  padding: 12px 44px;
  color: var(--text);
  background: #fff;
  border: var(--btn-border) solid var(--border);
  border-radius: var(--btn-radius);
  box-shadow: var(--shadow);
  font-weight: 400;
  font-size: 15px;
  line-height: 1.25;
  text-align: center;
  transition: transform 0.08s, box-shadow 0.08s;
  cursor: pointer;
  touch-action: manipulation;
  user-select: none;
  -webkit-user-select: none;
  -webkit-tap-highlight-color: transparent;
}

.link-btn:hover {
  transform: translate(-1px, -1px);
  box-shadow: 5px 5px 0 var(--border);
}

.link-btn:active {
  transform: translate(2px, 2px);
  box-shadow: 2px 2px 0 var(--border);
}

.link-btn--with-icon {
  padding-left: 52px;
  padding-right: 44px;
}

.link-btn__icon {
  position: absolute;
  left: 16px;
  top: 50%;
  transform: translateY(-50%);
  display: flex;
  flex-shrink: 0;
}

.link-btn__icon img {
  display: block;
  width: var(--link-app-icon);
  height: var(--link-app-icon);
  border-radius: 7px;
  object-fit: cover;
}

.link-btn__text {
  width: 100%;
  line-height: 1.25;
  text-align: center;
}

.link-btn__menu {
  position: absolute;
  right: 14px;
  top: 50%;
  transform: translateY(-50%);
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  padding: 0;
  background: transparent;
  color: #888;
  cursor: pointer;
  border: none;
  border-radius: 50%;
  outline: none;
  box-shadow: none;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}

.link-btn__menu svg {
  width: 4px;
  height: 14px;
  pointer-events: none;
}

.link-btn__menu:hover {
  background: rgba(0, 0, 0, 0.04);
}

.link-btn__menu:focus,
.link-btn__menu:focus-visible,
.link-btn__menu:active {
  outline: none;
  box-shadow: none;
  background: transparent;
}

.link-btn:focus,
.link-btn:focus-visible {
  outline: none;
}

.card__footer {
  margin-top: auto;
  padding-top: 32px;
  text-align: center;
}

.join-btn {
  display: block;
  width: 100%;
  min-height: 52px;
  padding: 16px 20px;
  border: none;
  border-radius: var(--btn-radius);
  background: #fff;
  color: var(--text);
  font-family: inherit;
  font-size: 15px;
  font-weight: 400;
  line-height: 1.25;
  text-align: center;
  text-decoration: none;
  box-shadow:
    0 10px 28px rgba(0, 0, 0, 0.14),
    0 4px 10px rgba(0, 0, 0, 0.08);
  transition: transform 0.08s, box-shadow 0.08s;
}

.join-btn:hover {
  box-shadow:
    0 12px 32px rgba(0, 0, 0, 0.16),
    0 5px 12px rgba(0, 0, 0, 0.1);
}

.join-btn:active {
  transform: scale(0.98);
}

.card__hint {
  margin: 12px 0 0;
  font-size: 12px;
  color: var(--text-muted);
}

/* Modals */
.modal {
  margin: auto;
  padding: 0;
  border: none;
  border-radius: 20px;
  max-width: calc(100vw - 32px);
  width: 360px;
  background: transparent;
  opacity: 0;
  transform: translateY(8px) scale(0.96);
  transition: opacity 0.22s ease, transform 0.22s ease, overlay 0.22s ease allow-discrete,
    display 0.22s ease allow-discrete;
}

.modal[open] {
  opacity: 1;
  transform: translateY(0) scale(1);
}

@starting-style {
  .modal[open] {
    opacity: 0;
    transform: translateY(8px) scale(0.96);
  }
}

.modal::backdrop {
  background: rgba(0, 0, 0, 0);
  transition: background 0.22s ease, overlay 0.22s ease allow-discrete,
    display 0.22s ease allow-discrete;
}

.modal[open]::backdrop {
  background: rgba(0, 0, 0, 0.45);
}

@starting-style {
  .modal[open]::backdrop {
    background: rgba(0, 0, 0, 0);
  }
}

@media (prefers-reduced-motion: reduce) {
  .modal,
  .modal::backdrop {
    transition: none;
  }
}

.modal__sheet {
  position: relative;
  padding: 22px 18px 18px;
  background: #fff;
  border-radius: 20px;
}

.modal__close {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 32px;
  height: 32px;
  border: none;
  background: transparent;
  font-size: 22px;
  line-height: 1;
  color: var(--text-muted);
  cursor: pointer;
  border-radius: 50%;
  outline: none;
  box-shadow: none;
  -webkit-tap-highlight-color: transparent;
}

.modal__close:hover {
  background: rgba(0, 0, 0, 0.06);
}

.modal__close:focus,
.modal__close:focus-visible,
.modal__close:active {
  outline: none;
  box-shadow: none;
  background: transparent;
}

.modal__title {
  margin: 0 0 8px;
  font-size: 17px;
  font-weight: 700;
  text-align: center;
}

.modal__desc {
  margin: 0 0 14px;
  font-size: 14px;
  color: var(--text-muted);
  text-align: center;
  line-height: 1.4;
}

.modal__preview {
  margin-bottom: 14px;
  overflow: hidden;
  border-radius: 16px;
  font-size: 14px;
}

.modal__preview--web {
  background: #f0f0ec;
}

.modal__preview--app {
  background: #3a3a3a;
}

.preview-card--app {
  padding: 22px 18px 18px;
  text-align: center;
}

.preview-card__icon-shell {
  width: 72px;
  height: 72px;
  margin: 0 auto 14px;
  padding: 6px;
  background: #fff;
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.preview-card__icon {
  display: block;
  width: 100%;
  height: 100%;
  border-radius: 10px;
  object-fit: cover;
}

.preview-app__title {
  margin: 0 0 8px;
  font-size: 15px;
  font-weight: 600;
  line-height: 1.35;
  color: #fff;
}

.preview-app__url {
  margin: 0 0 10px;
  font-size: 13px;
  line-height: 1.35;
  color: rgba(255, 255, 255, 0.8);
  word-break: break-all;
}

.preview-app__desc {
  margin: 0;
  font-size: 13px;
  font-weight: 400;
  line-height: 1.45;
  color: rgba(255, 255, 255, 0.88);
}

.preview-app__more {
  display: inline-block;
  margin-top: 14px;
  padding: 8px 20px;
  border: none;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.16);
  color: #fff;
  font-family: inherit;
  font-size: 13px;
  font-weight: 500;
  line-height: 1.2;
  cursor: pointer;
}

.preview-app__more:active {
  transform: scale(0.98);
  background: rgba(255, 255, 255, 0.22);
}

.preview-card__domain {
  display: block;
  padding: 10px 12px 0;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-muted);
}

.preview-card__body {
  padding: 6px 12px 12px;
}

.preview-card__image-wrap {
  padding: 10px 10px 0;
  background: #ebe9e2;
}

.preview-card__image {
  display: block;
  width: 100%;
  height: auto;
  max-height: 168px;
  object-fit: contain;
  object-position: center;
  background: #ebe9e2;
  border-radius: 12px 12px 0 0;
}

.preview-card__image-wrap--profile {
  display: flex;
  justify-content: center;
  padding: 16px 10px 4px;
  background: #f0f0ec;
}

.preview-card__image--profile {
  position: relative;
  width: 112px;
  height: 112px;
  max-height: none;
  flex-shrink: 0;
  border-radius: 50%;
  overflow: hidden;
  background: #fff;
}

.preview-card__image--profile img {
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  object-position: center center;
  transform-origin: center center;
  transform: translate(var(--avatar-shift-x), var(--avatar-shift-y))
    scale(var(--avatar-scale));
}

.preview-card__title {
  display: block;
  margin: 0 0 4px;
  font-size: 15px;
  font-weight: 700;
  line-height: 1.3;
  color: var(--text);
}

.preview-card__url {
  display: block;
  color: var(--text-muted);
  font-size: 13px;
  word-break: break-all;
}

.preview-card__desc {
  margin: 6px 0 0;
  color: var(--text-muted);
  font-size: 13px;
  line-height: 1.4;
}

.modal__cta {
  display: block;
  width: 100%;
  margin-bottom: 8px;
  padding: 14px 18px;
  border: 2px solid var(--border);
  border-radius: 999px;
  background: var(--text);
  color: #fff;
  text-decoration: none;
  text-align: center;
  box-sizing: border-box;
  font-family: inherit;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
}

.modal__cta--secondary {
  background: #fff;
  color: var(--text);
}

.modal__cta--ghost {
  background: transparent;
  border-color: transparent;
  color: var(--text-muted);
  font-weight: 500;
  font-size: 13px;
}

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

.modal__help {
  margin-top: 6px;
  font-size: 13px;
  color: var(--text-muted);
}

.modal__help summary {
  cursor: pointer;
  font-weight: 500;
}

.modal__help ol {
  margin: 8px 0 0;
  padding-left: 20px;
}

/* iOS Instagram — instruction demo */
.escape-ios .modal__title {
  margin-bottom: 12px;
}

.modal__title--link {
  font-size: 17px;
  line-height: 1.3;
  text-wrap: balance;
}

.ig-demo {
  margin: 16px 0 20px;
  min-height: 268px;
  border: 1px solid #e5e5e5;
  border-radius: 14px;
  overflow: hidden;
  background: #f8f8f8;
}

.ig-demo__chrome {
  display: grid;
  grid-template-columns: 28px 1fr 34px;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  background: #fff;
  border-bottom: 1px solid #eee;
}

.ig-demo__close {
  font-size: 22px;
  line-height: 1;
  color: #8e8e8e;
  text-align: center;
}

.ig-demo__bar {
  display: block;
  height: 30px;
  border-radius: 8px;
  background: #efefef;
}

.ig-demo__dots {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  font-size: 17px;
  line-height: 1;
  font-weight: 700;
  letter-spacing: 0.04em;
  color: #262626;
}

.ig-demo__menu {
  min-height: 196px;
  padding: 6px 0;
  background: #fff;
  opacity: 0;
}

.ig-demo__item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 16px;
  font-size: 14px;
  color: #262626;
}

.ig-demo__item--dim {
  color: #a8a8a8;
}

.ig-demo__item--target {
  font-weight: 500;
  color: #262626;
}

.ig-demo__icon {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
  color: #262626;
}

.ig-steps {
  margin: 0 0 12px;
  padding-left: 20px;
  font-size: 14px;
  line-height: 1.5;
  color: var(--text);
}

.ig-steps li + li {
  margin-top: 8px;
}

.ig-steps__dots-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  margin: 0 3px;
  border-radius: 50%;
  background: #f5f5f5;
  border: 1px solid #dbdbdb;
  box-shadow: 0 0 0 2px rgba(0, 149, 246, 0.22);
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 0.04em;
  line-height: 1;
  vertical-align: -6px;
  color: #262626;
}

@keyframes ig-dots-guide {
  0% {
    background: transparent;
    box-shadow: none;
    transform: scale(1);
  }
  35% {
    transform: scale(0.9);
    background: rgba(0, 149, 246, 0.06);
  }
  100% {
    background: rgba(0, 149, 246, 0.16);
    box-shadow: 0 0 0 2.5px rgba(0, 149, 246, 0.4);
    transform: scale(1);
  }
}

@keyframes ig-menu-show {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

@keyframes ig-target-guide {
  0% {
    background: transparent;
    box-shadow: none;
  }
  100% {
    background: rgba(0, 149, 246, 0.08);
    box-shadow: inset 3px 0 0 #0095f6;
  }
}

.ig-demo--play .ig-demo__dots {
  animation: ig-dots-guide 0.55s cubic-bezier(0.2, 0.9, 0.3, 1) 0.15s forwards;
}

.ig-demo--play .ig-demo__menu {
  animation: ig-menu-show 0.55s ease-out 0.8s forwards;
}

.ig-demo--play .ig-demo__item--target {
  animation: ig-target-guide 0.65s ease-out 1.5s forwards;
}

.ig-demo--done .ig-demo__dots {
  background: rgba(0, 149, 246, 0.16);
  box-shadow: 0 0 0 2.5px rgba(0, 149, 246, 0.4);
}

.ig-demo--done .ig-demo__menu {
  opacity: 1;
}

.ig-demo--done .ig-demo__item--target {
  background: rgba(0, 149, 246, 0.08);
  box-shadow: inset 3px 0 0 #0095f6;
}

@media (prefers-reduced-motion: reduce) {
  .ig-demo__menu {
    opacity: 1;
  }

  .ig-demo--play .ig-demo__dots,
  .ig-demo--play .ig-demo__menu,
  .ig-demo--play .ig-demo__item--target {
    animation: none;
  }

  .ig-demo--play .ig-demo__dots,
  .ig-demo--done .ig-demo__dots {
    background: rgba(0, 149, 246, 0.16);
    box-shadow: 0 0 0 2.5px rgba(0, 149, 246, 0.4);
  }

  .ig-demo--play .ig-demo__item--target,
  .ig-demo--done .ig-demo__item--target {
    background: rgba(0, 149, 246, 0.08);
    box-shadow: inset 3px 0 0 #0095f6;
  }
}

.share-row {
  display: flex;
  justify-content: center;
  gap: 12px;
  flex-wrap: wrap;
}

.share-chip {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 0;
  border: none;
  background: transparent;
  cursor: pointer;
  font-family: inherit;
  min-width: 72px;
}

.share-chip__circle {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: #ececea;
  color: #444;
}

.share-chip__circle svg {
  width: 22px;
  height: 22px;
}

.share-chip__label {
  font-size: 12px;
  font-weight: 400;
  color: var(--text);
  line-height: 1.2;
}

.share-chip:active .share-chip__circle {
  transform: scale(0.96);
}
