.gym-referral {
  --referral-accent: #ffb612;
  --referral-accent-text: #141414;
  --referral-accent-hover: #ffd165;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: clamp(16px, 3vw, 32px);
  margin-block: clamp(36px, 6vw, 72px);
}
[data-gym-referral="liv-up"] {
  --referral-accent: #e40246;
  --referral-accent-text: #fff;
  --referral-accent-hover: #bf003b;
}
.gym-referral > h2 {
  grid-column: 1 / -1;
  margin: 0;
  color: var(--primary);
  font-size: clamp(1.65rem, 4vw, 3rem);
  letter-spacing: -.045em;
  line-height: 1.15;
  text-align: center;
  text-wrap: balance;
}
.gym-referral > h2::after {
  content: "";
  display: block;
  width: 56px;
  height: 3px;
  margin: 14px auto 0;
  border-radius: 2px;
  background: var(--primary);
}
.gym-referral-card {
  display: grid;
  grid-template-rows: auto 1fr;
  min-width: 0;
  overflow: hidden;
  background: linear-gradient(145deg, var(--surface), color-mix(in srgb, var(--surface) 95%, var(--primary)));
  border: 1px solid var(--line);
  border-radius: 22px;
  box-shadow: var(--shadow-subtle);
  transition: border-color var(--transition-fast);
}
.gym-referral-card:hover, .gym-referral-card:focus-within {
  border-color: var(--border-hover);
}
.gym-referral-art {
  position: relative;
  height: clamp(145px, 15vw, 192px);
  overflow: hidden;
  border-bottom: 1px solid var(--line);
  background: radial-gradient(ellipse at 50% 30%, #303139, #101116 75%);
}
.gym-referral-art:focus-visible { outline: 2px solid var(--text); outline-offset: -4px; }
.gym-referral-art img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
}
[data-gym-referral="gym-referral"] .gym-referral-art > img:first-child {
  inset: 0 0 0 auto;
  width: 46%;
  object-fit: cover;
  object-position: 50% 12%;
  mask-image: linear-gradient(to right, transparent, #000 33%);
}
[data-gym-referral="liv-up"] .gym-referral-art {
  background: #dd0144;
}
.gym-referral-art .referral-brand-logo {
  inset: 0 auto 0 6%;
  width: 42%;
  padding: 12px 0;
  mix-blend-mode: screen;
}
[data-gym-referral="liv-up"] .gym-referral-art > img:first-child {
  inset: 0 0 0 auto;
  width: 58%;
  mask-image: linear-gradient(to right, transparent, #000 14% 86%, transparent);
}
[data-gym-referral="liv-up"] .referral-brand-logo {
  inset-inline-start: 10%;
  width: 24%;
  padding-block: clamp(19px, 4vw, 36px);
  mix-blend-mode: normal;
}
.gym-referral-content { min-width: 0; padding: clamp(16px, 3vw, 28px); }
.gym-referral-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-block: 0 10px;
}
.gym-referral-heading h3 {
  margin: 0;
  color: var(--primary);
  font-size: 1.5em;
  line-height: 1.25;
  text-wrap: balance;
}
[data-gym-referral="gym-referral"] .gym-referral-heading h3 {
  color: #ffb612;
  color: light-dark(#785100, #ffb612);
}
.gym-referral-social {
  position: relative;
  display: grid;
  place-items: center;
  flex: 0 0 44px;
  height: 44px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--text);
}
.gym-referral-social::after {
  content: "";
  position: absolute;
  inset: -1px;
  padding: 2px;
  border-radius: inherit;
  background: linear-gradient(135deg, #feda75, #fa7e1e 24%, #d62976 52%, #962fbf 78%, #4f5bd5);
  mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  mask-composite: exclude;
  opacity: 0;
  pointer-events: none;
  transition: opacity 220ms ease;
}
.gym-referral-social:is(:hover, :focus-visible) { background: var(--surface-2); }
.gym-referral-social:is(:hover, :focus-visible)::after { opacity: 1; }
.gym-referral-social:focus-visible { outline: 2px solid var(--text); outline-offset: 2px; }
.gym-referral-content > p { margin-block: 0 8px; }
.gym-referral-content .gym-referral-benefit {
  padding: 10px 12px;
  border-inline-start: 4px solid var(--referral-accent);
  background: var(--surface-2);
  border-radius: 6px;
}
.gym-referral-benefit strong { font-size: clamp(1.15rem, 3vw, 1.55rem); }
.gym-referral-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-block: 14px 4px; }
.gym-referral-actions > * { min-height: 44px; max-width: 100%; }
.gym-referral-actions .button.primary {
  border-color: var(--referral-accent);
  background: var(--referral-accent);
  color: var(--referral-accent-text);
}
.gym-referral-actions .button.primary:hover { background: var(--referral-accent-hover); }
.gym-referral-copy {
  display: flex;
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--bg);
}
.gym-referral-code {
  width: calc(13ch + 22px);
  min-width: 0;
  padding: 8px 10px;
  border: 0;
  border-radius: 7px 0 0 7px;
  color: var(--text);
  background: transparent;
  font-family: "DM Mono", monospace;
}
.gym-referral-copy .gym-referral-copy-button {
  display: grid;
  place-items: center;
  flex: 0 0 44px;
  min-height: 44px;
  margin: 0;
  padding: 0;
  border: 0;
  border-inline-start: 1px solid var(--line);
  border-radius: 0 7px 7px 0;
}
.gym-referral-copy :focus-visible { z-index: 1; }
.gym-referral-content .gym-referral-status:empty { margin: 0; }
.referral-toast {
  position: fixed;
  z-index: 6;
  inset-inline-start: 50%;
  inset-block-end: calc(16px + env(safe-area-inset-bottom));
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 0.5rem;
  max-width: calc(100% - 144px);
  padding: 0.6rem 0.85rem;
  border: 1px solid var(--primary);
  border-radius: 12px;
  background: var(--primary);
  color: light-dark(#fff, #19090d);
  box-shadow: var(--shadow-subtle);
  font-size: 0.85rem;
  font-weight: 700;
  pointer-events: none;
}
.referral-toast:has([data-referral-toast]:empty) {
  padding: 0;
  border: 0;
  background: transparent;
  box-shadow: none;
}
.referral-toast:has([data-referral-toast]:empty) > [aria-hidden] { display: none; }
.gym-referral-note { color: var(--muted); font-size: .85rem; }
.gym-referral-actions :focus-visible { outline: 2px solid var(--text); outline-offset: 2px; }
.referral-copy-dialog {
  width: min(420px, calc(100% - 32px));
  max-height: 90dvh;
  padding: 22px;
  border: 1px solid var(--line);
  border-radius: var(--radius-xl);
  background: var(--surface);
  color: var(--text);
  box-shadow: var(--shadow);
  overflow-wrap: anywhere;
}
.referral-copy-dialog::backdrop { background: #0009; }
.referral-copy-dialog h3 { margin-block-end: 8px; }
.referral-copy-dialog-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px; }
.referral-copy-dialog-actions .button { min-height: 44px; display: inline-flex; align-items: center; }
@media (max-width: 720px) {
  .gym-referral { grid-template-columns: minmax(0, 1fr); }
  .gym-referral-art { height: clamp(138px, 42vw, 192px); }
}

.referral-shortcuts {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  max-width: var(--page-width);
  margin: 0.65rem auto 0;
  padding-inline: var(--page-gutter);
}
.referral-shortcuts a {
  display: inline-flex;
  flex-wrap: wrap;
  align-items: center;
  column-gap: 0.4rem;
  min-height: 44px;
  align-content: center;
  padding: 0.35rem 0.75rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--text);
  font-size: 0.8rem;
  line-height: 1.35;
}
.referral-shortcuts img {
  width: auto;
  height: 26px;
  object-fit: contain;
  border-radius: 4px;
}
.referral-shortcuts a[href="#gym-referral"] img {
  filter: drop-shadow(0 1px 1px light-dark(#332829, transparent));
}
.referral-shortcuts a[href="#liv-up"] img { height: 28px; }
.referral-shortcuts a:hover { background: var(--surface-hover); border-color: var(--border-hover); }
.referral-shortcuts a[href="#gym-referral"] { border-color: #ffb612; }
.referral-shortcuts a[href="#liv-up"] { border-color: #e40246; }
.referral-shortcuts a:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
.referral-shortcuts span { color: var(--muted); }
.gym-referral-card { scroll-margin-block-start: 5rem; }
@media (max-width: 650px) {
  .referral-shortcuts { padding-inline: 16px; }
}
