/*
 * Public link tree page.
 * Colors come from a per-profile palette computed on the server (src/utils/palette.js)
 * and set as CSS variables inline in linkTree.ejs:
 *   --bg-1, --bg-2        page background gradient (no text sits directly on it)
 *   --surface             translucent card / pill background
 *   --surface-solid       opaque version of --surface for dialogs
 *   --text, --text-muted  text on the surface (WCAG ≥ 7:1 and ≥ 4.5:1)
 *   --accent, --accent-hover, --accent-border, --on-accent   link buttons (≥ 4.5:1)
 *   --ring                avatar ring in the avatar's own color
 */

@font-face {
  font-family: 'Inter';
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url('/static/fonts/inter-latin-4.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

@font-face {
  font-family: 'Inter';
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url('/static/fonts/inter-cyrillic-4.woff2') format('woff2');
  unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}

/* Montserrat 700 for the name with the "display" font (also in fonts.css); a face is downloaded only when used */
@font-face {
  font-family: 'Montserrat';
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url('/static/fonts/montserrat-700-cyrillic.woff2') format('woff2');
  unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}

@font-face {
  font-family: 'Montserrat';
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url('/static/fonts/montserrat-700-latin-ext.woff2') format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

@font-face {
  font-family: 'Montserrat';
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url('/static/fonts/montserrat-700-latin.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

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

html {
  background: var(--bg-1);
}

body {
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  padding: 64px 12px 16px;
  font-family: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, Arial, sans-serif;
  color: var(--text);
  background: linear-gradient(160deg, var(--bg-1) 0%, var(--bg-2) 100%) fixed;
  -webkit-font-smoothing: antialiased;
  /* Background effects sit at z-index -1 inside the body, above its own background */
  isolation: isolate;
}

button {
  font: inherit;
  color: inherit;
}

/* ---------- Card ---------- */

.container {
  width: 100%;
  max-width: 460px;
  padding: 32px 20px 20px;
  border-radius: 24px;
  background: var(--surface);
  border: 1px solid var(--surface-border);
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.18);
  backdrop-filter: blur(16px) saturate(140%);
  -webkit-backdrop-filter: blur(16px) saturate(140%);
  text-align: center;
}

.avatar {
  width: 96px;
  height: 96px;
  margin: 0 auto 16px;
  border-radius: 50%;
  border: 3px solid var(--surface-solid);
  box-shadow: 0 0 0 3px var(--ring), 0 6px 20px rgba(0, 0, 0, 0.2);
  background-color: var(--surface-solid);
  background-repeat: no-repeat;
  background-position: center;
  background-size: cover;
}

.name {
  font-size: 1.5rem;
  font-weight: 700;
  line-height: 1.25;
  letter-spacing: -0.01em;
  color: var(--text);
  overflow-wrap: anywhere;
}

.description {
  margin-top: 6px;
  font-size: 1rem;
  line-height: 1.5;
  color: var(--text-muted);
  white-space: pre-line;
  overflow-wrap: anywhere;
}

/* ---------- Banner and checkmark ---------- */

/* The banner fills the top of the card edge to edge; the avatar overlaps its lower edge */
.banner {
  height: 132px;
  margin: -32px -20px 0;
  border-radius: 24px 24px 0 0;
  background-color: var(--surface-solid);
  background-size: cover;
  background-position: center;
}

.has-banner .banner + .notice {
  margin-top: 16px;
}

/* One recognizable blue on every theme (the preview card draws the same one) */
.verified {
  display: inline-flex;
  vertical-align: -0.12em;
  margin-left: 6px;
  color: #1d8af5;
}

.verified svg {
  width: 0.92em;
  height: 0.92em;
}

/* ---------- Community notice ---------- */

.notice {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  margin: 0 0 20px;
  padding: 12px 14px;
  border-radius: 14px;
  background: #fff4d6;
  color: #4a3500;
  border: 1px solid #f0c75e;
  text-align: left;
  font-size: 0.92rem;
  line-height: 1.4;
}

.notice-icon {
  font-size: 1.2rem;
  line-height: 1.2;
}

.notice-body strong {
  display: block;
}

.notice-link {
  color: inherit;
  font-weight: 600;
}

/* ---------- Links ---------- */

.links {
  margin-top: 24px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.link {
  position: relative;
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 52px;
  padding: 10px 16px 10px 12px;
  border-radius: 14px;
  background: var(--accent);
  border: 1px solid var(--accent-border);
  color: var(--on-accent);
  font-size: 1rem;
  font-weight: 600;
  text-decoration: none;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.08);
  transition: background-color 0.2s, transform 0.2s, box-shadow 0.2s;
}

.link:hover {
  background: var(--accent-hover);
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.16);
}

.link:active {
  transform: translateY(0);
}

.favicon {
  flex-shrink: 0;
  width: 28px;
  height: 28px;
  padding: 4px;
  border-radius: 8px;
  background: #fff;
  object-fit: contain;
}

.link-title {
  flex: 1 1 auto;
  text-align: center;
  overflow-wrap: anywhere;
}

/* Keeps the title optically centered against the icon on the left. */
.link::after {
  content: '';
  flex: 0 0 28px;
}

/* ---------- Other blocks ---------- */

/* Buttons share the look of links */
button.link {
  width: 100%;
  cursor: pointer;
  font: inherit;
  font-weight: 600;
}

.block-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #333;
}

.copy-value {
  display: block;
  margin-top: 2px;
  font-size: 0.8rem;
  font-weight: 500;
  opacity: 0.8;
  overflow-wrap: anywhere;
}

.block-header {
  margin: 10px 0 -2px;
  font-size: 0.85rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.block-divider {
  border: 0;
  height: 1px;
  margin: 4px 12%;
  background: var(--surface-border);
}

.embed iframe {
  display: block;
  width: 100%;
  border: 0;
  border-radius: 14px;
  background: var(--surface-solid);
}

.embed iframe.video {
  aspect-ratio: 16 / 9;
  height: auto;
}

/* The pinned link stands out and nudges now and then */
.link.pinned {
  box-shadow: 0 0 0 3px var(--ring), 0 6px 18px rgba(0, 0, 0, 0.18);
  animation: pinned-nudge 6s ease-in-out 2s infinite;
}

@keyframes pinned-nudge {
  0%, 90%, 100% { transform: none; }
  92% { transform: rotate(-1.5deg) scale(1.02); }
  94% { transform: rotate(1.5deg) scale(1.02); }
  96% { transform: rotate(-1deg); }
  98% { transform: rotate(0.5deg); }
}

.socials {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px;
  margin-top: 14px;
}

.social {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
  transition: transform 0.2s;
}

.social:hover {
  transform: translateY(-2px) scale(1.06);
}

.social img {
  width: 24px;
  height: 24px;
  object-fit: contain;
}

/* ---------- Voyager (status, live, stats, server cards) ---------- */

.avatar-wrap {
  position: relative;
  width: 96px;
  margin: 0 auto 16px;
}

.avatar-wrap .avatar {
  margin: 0;
}

/* Over the banner's lower edge; a community notice between them keeps the avatar below it instead */
.has-banner .banner + .avatar-wrap {
  margin-top: -52px;
}

/* Live: a pulsing red ring instead of the avatar's own */
.avatar.live {
  box-shadow: 0 0 0 3px #e91916, 0 6px 20px rgba(0, 0, 0, 0.2);
  animation: live-pulse 2s ease-out infinite;
}

@keyframes live-pulse {
  0% { box-shadow: 0 0 0 3px #e91916, 0 0 0 3px rgba(233, 25, 22, 0.6); }
  100% { box-shadow: 0 0 0 3px #e91916, 0 0 0 14px rgba(233, 25, 22, 0); }
}

.presence-dot {
  position: absolute;
  right: 2px;
  bottom: 2px;
  /* Above the avatar, which a Voyager frame lifts over its ring */
  z-index: 3;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: 4px solid var(--surface-solid);
  background: #80848e;
}

.status-online { background: #23a55a; }
.status-idle { background: #f0b232; }
.status-dnd { background: #f23f43; }

.activity {
  margin-top: 4px;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-muted);
  overflow-wrap: anywhere;
}

.stats {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 6px;
  margin-top: 12px;
}

.stat {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  min-height: 28px;
  padding: 3px 10px;
  border-radius: 999px;
  background: var(--surface-solid);
  border: 1px solid var(--surface-border);
  color: var(--text);
  font-size: 0.85rem;
  font-weight: 700;
}

.stat.badge {
  padding: 3px 7px;
}

.stat img {
  width: 18px;
  height: 18px;
  object-fit: contain;
}

.link.live-link {
  background: #e91916;
  border-color: #b8120f;
  color: #fff;
}

.link.live-link:hover {
  background: #c9110e;
}

.channel-verified {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.1em;
  height: 1.1em;
  border-radius: 50%;
  background: #fff;
  color: #e91916;
  font-size: 0.8em;
  font-weight: 900;
  vertical-align: 0.05em;
}

.live-dot::before {
  content: '';
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #e91916;
  animation: live-blink 1.2s ease-in-out infinite;
}

@keyframes live-blink {
  50% { opacity: 0.3; }
}

.server-card {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-radius: 14px;
  background: var(--surface-solid);
  border: 1px solid var(--surface-border);
  text-align: left;
}

.server-icon {
  flex-shrink: 0;
  width: 48px;
  height: 48px;
  border-radius: 16px;
  object-fit: cover;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: #5865f2;
  color: #fff;
  font-weight: 700;
  font-size: 1.3rem;
}

.server-info {
  flex: 1 1 auto;
  min-width: 0;
}

.server-name {
  display: block;
  font-weight: 700;
  color: var(--text);
  overflow-wrap: anywhere;
}

.server-counts {
  display: block;
  font-size: 0.8rem;
  color: var(--text-muted);
}

.online-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  margin-right: 4px;
  border-radius: 50%;
  background: #23a55a;
}

.server-join {
  flex-shrink: 0;
  padding: 8px 14px;
  border-radius: 10px;
  background: #248046;
  color: #fff;
  font-weight: 700;
  text-decoration: none;
}

button.server-join {
  border: 0;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}

.server-join:hover {
  background: #1a6334;
}

/* A card that joins only through Voyager while its server doesn't allow it */
.server-join.closed,
.server-join.closed:hover {
  background: rgba(128, 128, 128, 0.35);
  cursor: default;
}

/* ---------- Messages, questions and answers ---------- */

.inbox {
  margin-top: 14px;
}

.inbox-buttons {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
}

.inbox-open,
.inbox-send,
.inbox-cancel {
  min-height: 38px;
  padding: 7px 14px;
  border-radius: 999px;
  border: 1px solid var(--surface-border);
  background: var(--surface-solid);
  color: var(--text);
  font: inherit;
  font-weight: 600;
  cursor: pointer;
}

.inbox-send {
  border-color: var(--accent-border);
  background: var(--accent);
  color: var(--on-accent);
}

/* display: flex below would otherwise beat the hidden attribute */
.inbox-form[hidden],
.inbox-from[hidden] {
  display: none;
}

.inbox-form {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 10px;
  text-align: left;
}

.inbox-note,
.inbox-status {
  font-size: 0.85rem;
  color: var(--text-muted);
}

.inbox-status:empty {
  display: none;
}

.inbox-text,
.inbox-from {
  width: 100%;
  padding: 9px 12px;
  border-radius: 12px;
  border: 1px solid var(--surface-border);
  background: var(--surface-solid);
  color: var(--text);
  font: inherit;
  resize: vertical;
}

.inbox-actions {
  display: flex;
  gap: 8px;
}

.answers {
  margin-top: 20px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  text-align: left;
}

.answers .block-header {
  text-align: center;
}

.answer {
  padding: 10px 12px;
  border-radius: 14px;
  background: var(--surface-solid);
  border: 1px solid var(--surface-border);
}

.answer-question {
  font-weight: 700;
  color: var(--text);
  overflow-wrap: anywhere;
  white-space: pre-line;
}

.answer-text {
  margin-top: 6px;
  color: var(--text-muted);
  overflow-wrap: anywhere;
  white-space: pre-line;
}

.inbox-open:focus-visible,
.inbox-send:focus-visible,
.inbox-cancel:focus-visible,
.inbox-text:focus-visible,
.inbox-from:focus-visible {
  outline: 3px solid var(--text);
  outline-offset: 2px;
}

/* ---------- Status line, countdowns, goals ---------- */

.status-line {
  display: inline-block;
  margin-top: 6px;
  padding: 3px 12px;
  border-radius: 999px;
  background: var(--surface-solid);
  border: 1px solid var(--surface-border);
  color: var(--text);
  font-size: 0.9rem;
  font-weight: 600;
  overflow-wrap: anywhere;
}

.countdown,
.goal {
  padding: 12px;
  border-radius: 14px;
  background: var(--surface-solid);
  border: 1px solid var(--surface-border);
}

.countdown-title,
.goal-title {
  font-weight: 700;
  color: var(--text);
  overflow-wrap: anywhere;
}

.countdown-time {
  margin-top: 4px;
  font-size: 1.6rem;
  font-weight: 800;
  color: var(--text);
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.02em;
}

.countdown.over .countdown-time {
  font-size: 1.2rem;
}

.goal-track {
  position: relative;
  height: 14px;
  margin-top: 8px;
  overflow: hidden;
  border-radius: 999px;
  background: color-mix(in srgb, var(--accent) 18%, transparent);
}

.goal-fill {
  position: absolute;
  inset: 0 auto 0 0;
  border-radius: 999px;
  background: var(--accent);
  transition: width 0.8s ease;
}

.goal.reached .goal-fill {
  background: linear-gradient(90deg, var(--accent), #23a55a);
}

.goal-numbers {
  margin-top: 6px;
  font-size: 0.85rem;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
}

/* April Fools: the page wobbles and slides once when it opens */
.april-fools .container {
  animation: april-wobble 2.4s ease-in-out 0.6s 1;
}

@keyframes april-wobble {
  0%, 100% { transform: none; }
  15% { transform: rotate(-4deg) translateX(-12px); }
  30% { transform: rotate(3deg) translateY(30px); }
  45% { transform: rotate(-2deg) skewX(6deg); }
  60% { transform: rotate(180deg) scale(0.9); }
  75% { transform: rotate(360deg) scale(1.02); }
}

/* ---------- Friends, guestbook, Voyager frame and background ---------- */

.friends,
.guestbook {
  padding: 12px;
  border-radius: 14px;
  background: var(--surface-solid);
  border: 1px solid var(--surface-border);
}

.friends-title,
.guestbook-title {
  margin-bottom: 8px;
  font-weight: 700;
  color: var(--text);
}

.friends-list {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 12px;
}

.friend {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  width: 72px;
  color: var(--text);
  font-size: 0.75rem;
  font-weight: 600;
  text-decoration: none;
  overflow-wrap: anywhere;
}

.friend img {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  object-fit: cover;
  box-shadow: 0 0 0 2px var(--ring);
  transition: transform 0.2s;
}

.friend:hover img {
  transform: scale(1.08);
}

.guestbook {
  text-align: left;
}

.guestbook-entry {
  padding: 8px 0;
  border-top: 1px solid var(--surface-border);
  color: var(--text-muted);
  overflow-wrap: anywhere;
}

.guestbook-name {
  font-weight: 700;
  color: var(--text);
}

.guestbook-empty {
  font-size: 0.85rem;
  color: var(--text-muted);
}

.guestbook-sign {
  margin-top: 8px;
}

/* A frame from Voyager: a gradient ring behind the avatar and its emoji */
.avatar-wrap.framed::before {
  content: '';
  position: absolute;
  inset: -8px;
  z-index: 0;
  border-radius: 50%;
}

/* Turned whole: the browser does it without painting anything again */
.avatar-wrap.framed.animated::before {
  animation: frame-turn 4s linear infinite;
}

@keyframes frame-turn {
  to { transform: rotate(360deg); }
}

.avatar-wrap.framed .avatar {
  position: relative;
  z-index: 1;
}

.frame-emoji {
  position: absolute;
  top: -6px;
  right: -6px;
  z-index: 2;
  font-size: 1.4rem;
  filter: drop-shadow(0 2px 3px rgba(0, 0, 0, 0.3));
}

/* A background from Voyager replaces the page's own: the aurora's lights would cover it */
body.vg-bg::before,
body.vg-bg::after {
  display: none;
}

.friend:focus-visible {
  outline: 3px solid var(--text);
  outline-offset: 2px;
}

/* ---------- Likes ---------- */

.like-button {
  margin-top: 10px;
  padding: 6px 16px;
  border-radius: 999px;
  border: 1px solid var(--surface-border);
  background: var(--surface-solid);
  color: var(--text);
  font: inherit;
  font-weight: 700;
  cursor: pointer;
  filter: grayscale(0.8);
  transition: filter 0.2s, transform 0.2s;
}

.like-button.liked {
  filter: none;
  border-color: #ef476f;
}

.like-button.pop {
  animation: like-pop 0.4s ease;
}

@keyframes like-pop {
  50% { transform: scale(1.25); }
}

.like-button:focus-visible {
  outline: 3px solid var(--text);
  outline-offset: 2px;
}

/* Parts placed among the blocks: the list's gap spaces them */
.links > .inbox,
.links > .answers,
.links > .steam-card,
.links > .wrapped-card {
  margin-top: 0;
}

/* ---------- Steam, Wrapped, updates ---------- */

.steam-card,
.wrapped-card,
.updates {
  margin-top: 12px;
  padding: 10px 12px;
  border-radius: 14px;
  background: var(--surface-solid);
  border: 1px solid var(--surface-border);
  color: var(--text);
  font-size: 0.9rem;
  overflow-wrap: anywhere;
}

.updates {
  margin-top: 0;
  text-align: left;
}

.steam-games,
.wrapped-numbers {
  margin-top: 2px;
  font-size: 0.8rem;
  color: var(--text-muted);
}

.wrapped-card {
  background: linear-gradient(135deg, color-mix(in srgb, var(--accent) 22%, var(--surface-solid)), var(--surface-solid));
}

.wrapped-title,
.updates-title {
  font-weight: 700;
}

.update {
  padding: 8px 0;
  border-top: 1px solid var(--surface-border);
  white-space: pre-line;
}

.update-date {
  display: block;
  font-size: 0.75rem;
  color: var(--text-muted);
}

.next-in {
  font-weight: 800;
  white-space: nowrap;
}

/* ---------- Polls ---------- */

.poll {
  padding: 12px;
  border-radius: 14px;
  background: var(--surface-solid);
  border: 1px solid var(--surface-border);
  text-align: left;
}

.poll-question {
  margin-bottom: 10px;
  font-weight: 700;
  color: var(--text);
  overflow-wrap: anywhere;
}

.poll-options {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.poll-option {
  position: relative;
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 42px;
  padding: 8px 12px;
  overflow: hidden;
  border-radius: 10px;
  border: 1px solid var(--accent-border);
  background: transparent;
  color: var(--text);
  font: inherit;
  font-weight: 600;
  text-align: left;
  cursor: pointer;
}

.poll-option:hover:not(:disabled) {
  background: color-mix(in srgb, var(--accent) 14%, transparent);
}

.poll-option:disabled {
  cursor: default;
}

.poll-bar {
  position: absolute;
  inset: 0 auto 0 0;
  width: 0;
  background: color-mix(in srgb, var(--accent) 28%, transparent);
  transition: width 0.6s ease;
}

.poll-option.mine {
  border-width: 2px;
}

.poll-text,
.poll-count {
  position: relative;
}

.poll-text {
  flex: 1 1 auto;
  overflow-wrap: anywhere;
}

.poll-count {
  font-variant-numeric: tabular-nums;
}

.poll-total {
  margin-top: 8px;
  font-size: 0.8rem;
  color: var(--text-muted);
}

.poll-total:empty {
  display: none;
}

.poll-option:focus-visible {
  outline: 3px solid var(--text);
  outline-offset: 2px;
}

/* ---------- Secret links ---------- */

.secret-form {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 8px;
}

/* display: flex above would otherwise beat the hidden attribute */
.secret-form[hidden] {
  display: none;
}

.secret-input {
  flex: 1 1 160px;
  min-height: 42px;
  padding: 8px 12px;
  border-radius: 12px;
  border: 1px solid var(--surface-border);
  background: var(--surface-solid);
  color: var(--text);
  font: inherit;
}

.secret-submit {
  min-height: 42px;
  padding: 8px 16px;
  border-radius: 12px;
  border: 1px solid var(--accent-border);
  background: var(--accent);
  color: var(--on-accent);
  font-weight: 700;
  cursor: pointer;
}

.secret-message {
  flex-basis: 100%;
  font-size: 0.85rem;
  color: var(--text-muted);
}

.secret-message:empty {
  display: none;
}

.shake {
  animation: shake 0.4s;
}

@keyframes shake {
  20%, 60% { transform: translateX(-6px); }
  40%, 80% { transform: translateX(6px); }
}

.secret-input:focus-visible,
.secret-submit:focus-visible {
  outline: 3px solid var(--text);
  outline-offset: 2px;
}

/* ---------- Owner's clock, birthday, easter eggs ---------- */

.local-time {
  margin-top: 4px;
  font-size: 0.85rem;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
}

.birthday-note {
  display: inline-block;
  margin-top: 8px;
  padding: 4px 12px;
  border-radius: 999px;
  background: #ffd166;
  color: #3d2a00;
  font-size: 0.9rem;
  font-weight: 700;
}

.party .container {
  animation: party-hue 1.2s linear infinite;
}

@keyframes party-hue {
  to { filter: hue-rotate(360deg); }
}

.avatar.egg-spin {
  animation: egg-spin 0.9s cubic-bezier(0.5, 0, 0.3, 1.4);
}

@keyframes egg-spin {
  to { transform: rotate(720deg) scale(1.05); }
}

/* Falls off the card and drops back in from the top */
.avatar.egg-fall {
  animation: egg-fall 3.2s ease-in forwards;
}

@keyframes egg-fall {
  0% { transform: none; }
  12% { transform: rotate(-18deg); }
  20% { transform: rotate(10deg); }
  55% { transform: translateY(120vh) rotate(240deg); opacity: 1; }
  56% { transform: translateY(-120vh); opacity: 0; }
  60% { opacity: 1; }
  100% { transform: none; }
}

/* ---------- Share button ---------- */

.share-button {
  position: fixed;
  top: 12px;
  right: 12px;
  z-index: 1100;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  border: 1px solid var(--surface-border);
  border-radius: 50%;
  background: var(--surface);
  color: var(--text);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.15);
  cursor: pointer;
  transition: transform 0.2s;
}

.share-button:hover {
  transform: scale(1.06);
}

/* ---------- Footer ---------- */

.powered-by {
  /* Above the ban overlay (2000) so the links stay clickable, below the consent banner. */
  position: relative;
  z-index: 2050;
  padding: 6px 12px;
  border-radius: 999px;
  background: var(--surface);
  color: var(--text-muted);
  font-size: 0.75rem;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

.powered-by a {
  color: var(--text);
  font-weight: 600;
  text-decoration: none;
}

.link-button {
  background: none;
  border: none;
  padding: 0;
  color: inherit;
  text-decoration: underline;
  cursor: pointer;
}

/* ---------- Dialogs (share + ban) ---------- */

.qr-popup,
.ban-popup {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  background: rgba(0, 0, 0, 0.45);
}

.qr-popup {
  z-index: 1000;
}

.ban-popup {
  z-index: 2000;
  background: rgba(0, 0, 0, 0.6);
}

.qr-popup-content,
.ban-popup-content {
  position: relative;
  width: 100%;
  max-width: 340px;
  padding: 28px 22px 22px;
  border-radius: 22px;
  background: var(--surface-solid);
  color: var(--text);
  text-align: center;
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.3);
  animation: popup-in 0.25s cubic-bezier(0.2, 0.8, 0.2, 1);
}

@keyframes popup-in {
  from {
    opacity: 0;
    transform: scale(0.96) translateY(6px);
  }
}

.qr-title {
  font-size: 1.1rem;
  font-weight: 700;
  margin-bottom: 14px;
}

.qr-frame {
  display: inline-flex;
  padding: 10px;
  border-radius: 16px;
  background: #fff;
}

#qrcode {
  display: block;
  width: 240px;
  height: 240px;
  max-width: 100%;
}

.qr-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
  margin-top: 16px;
}

/* display: inline-flex below would otherwise beat the hidden attribute (the More button is hidden where it can't work) */
.qr-action[hidden] {
  display: none;
}

.qr-action {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 10px 12px;
  border-radius: 12px;
  white-space: nowrap;
  border: 1px solid var(--accent-border);
  background: var(--accent);
  color: var(--on-accent);
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: background-color 0.2s;
}

.qr-action:hover {
  background: var(--accent-hover);
}

.qr-action svg {
  flex-shrink: 0;
}

.qr-close,
.ban-close {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 36px;
  height: 36px;
  border: none;
  border-radius: 50%;
  background: transparent;
  color: var(--text-muted);
  font-size: 1.5rem;
  line-height: 1;
  cursor: pointer;
}

.qr-close:hover,
.ban-close:hover {
  color: var(--text);
  background: rgba(127, 127, 127, 0.15);
}

.copied-bubble {
  position: absolute;
  left: 50%;
  bottom: calc(100% + 8px);
  transform: translateX(-50%);
  padding: 5px 12px;
  border-radius: 999px;
  background: var(--text);
  color: var(--surface-solid);
  font-size: 0.85rem;
  white-space: nowrap;
  pointer-events: none;
  animation: bubble-fade 1.2s forwards;
}

@keyframes bubble-fade {
  0% { opacity: 0; transform: translateX(-50%) translateY(6px); }
  15%, 85% { opacity: 1; transform: translateX(-50%) translateY(0); }
  100% { opacity: 0; transform: translateX(-50%) translateY(-6px); }
}

.ban-icon {
  display: block;
  font-size: 3rem;
  margin-bottom: 12px;
}

.ban-title {
  font-size: 1.4rem;
  font-weight: 700;
  margin-bottom: 8px;
}

.ban-message {
  color: var(--text-muted);
  margin-bottom: 18px;
  line-height: 1.5;
}

.ban-reason {
  display: block;
  margin-top: 6px;
  color: var(--text);
}

.ban-action {
  padding: 11px 22px;
  border: 1px solid var(--accent-border);
  border-radius: 12px;
  background: var(--accent);
  color: var(--on-accent);
  font-weight: 600;
  cursor: pointer;
}

.ban-action:hover {
  background: var(--accent-hover);
}

/* ---------- Looks (chosen in the bot, src/utils/style.js) ---------- */

/* Backgrounds; without color-mix() support a declaration is dropped and the default gradient stays */
body.bg-solid {
  background: var(--bg-1);
}

body.bg-animated {
  background: linear-gradient(-45deg, var(--bg-1), var(--bg-2), var(--ring), var(--bg-1)) fixed;
  background-size: 400% 400%;
  animation: bg-pan 24s ease-in-out infinite;
}

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

/* --bg-1 is the theme color, --bg-2 the avatar's: spots of both and of lighter and darker theme */
body.bg-mesh {
  background:
    radial-gradient(at 10% 10%, color-mix(in oklch, var(--bg-1) 55%, white) 0, transparent 45%),
    radial-gradient(at 90% 12%, color-mix(in srgb, var(--bg-2) 85%, transparent) 0, transparent 45%),
    radial-gradient(at 80% 88%, color-mix(in oklch, var(--bg-1) 60%, black) 0, transparent 50%),
    radial-gradient(at 15% 90%, color-mix(in srgb, var(--bg-2) 75%, transparent) 0, transparent 50%),
    radial-gradient(at 50% 50%, color-mix(in oklch, var(--bg-2) 35%, var(--bg-1)) 0, transparent 70%),
    var(--bg-1);
  background-attachment: fixed;
}

/* Lights of the avatar's and the theme's colors over a darker theme */
body.bg-aurora {
  background: color-mix(in oklch, var(--bg-1) 45%, black);
}

body.bg-aurora::before,
body.bg-aurora::after {
  content: '';
  position: fixed;
  z-index: -1;
  width: 70vmax;
  height: 55vmax;
  border-radius: 50%;
  filter: blur(80px);
  opacity: 0.8;
  pointer-events: none;
}

body.bg-aurora::before {
  top: -20vmax;
  left: -20vmax;
  background: var(--bg-2);
  animation: aurora-a 28s ease-in-out infinite alternate;
}

body.bg-aurora::after {
  right: -20vmax;
  bottom: -25vmax;
  background: color-mix(in oklch, var(--bg-1) 70%, white);
  animation: aurora-b 34s ease-in-out infinite alternate;
}

@keyframes aurora-a {
  to { transform: translate(35vw, 25vh) scale(1.25); }
}

@keyframes aurora-b {
  to { transform: translate(-30vw, -30vh) scale(0.85); }
}

/* Canvases of linktree.js: particles behind everything, snow and confetti over the page (clicks pass through) */
.fx-canvas {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

.fx-back {
  z-index: -1;
}

.fx-front {
  z-index: 5;
}

/* Link buttons; outlined styles put --text on the card's surface, the pair the palette checks */
.btn-pill .link {
  border-radius: 999px;
}

.btn-outline .link {
  background: transparent;
  border: 2px solid var(--accent);
  color: var(--text);
  box-shadow: none;
}

.btn-outline .link:hover {
  background: color-mix(in srgb, var(--accent) 16%, transparent);
}

.btn-glass .link {
  background: color-mix(in srgb, var(--surface-solid) 55%, transparent);
  border: 1px solid var(--surface-border);
  color: var(--text);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.btn-glass .link:hover {
  background: color-mix(in srgb, var(--surface-solid) 85%, transparent);
}

.btn-neon .link {
  background: transparent;
  border: 2px solid var(--accent);
  color: var(--text);
  box-shadow:
    0 0 6px var(--accent),
    0 0 18px color-mix(in srgb, var(--accent) 55%, transparent),
    inset 0 0 10px color-mix(in srgb, var(--accent) 35%, transparent);
}

.btn-neon .link:hover {
  background: transparent;
  box-shadow:
    0 0 10px var(--accent),
    0 0 32px var(--accent),
    inset 0 0 14px color-mix(in srgb, var(--accent) 50%, transparent);
}

.btn-brutal .link {
  border-radius: 6px;
  border: 3px solid var(--text);
  box-shadow: 5px 5px 0 var(--text);
}

.btn-brutal .link:hover {
  transform: translate(-2px, -2px);
  box-shadow: 7px 7px 0 var(--text);
}

.btn-brutal .link.pinned {
  box-shadow: 5px 5px 0 var(--ring);
  border-color: var(--ring);
}

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

/* Fonts: only Inter and Montserrat are ours, the rest are system families */
body.font-display .name {
  font-family: 'Montserrat', 'Inter', system-ui, sans-serif;
  letter-spacing: 0;
}

body.font-rounded {
  font-family: ui-rounded, 'SF Pro Rounded', 'Nunito', 'Varela Round', 'Quicksand', 'Inter', system-ui, sans-serif;
}

body.font-serif {
  font-family: 'Iowan Old Style', 'Palatino Linotype', Palatino, Georgia, 'Times New Roman', serif;
}

body.font-mono {
  font-family: ui-monospace, 'Cascadia Code', 'JetBrains Mono', 'SF Mono', Menlo, Consolas, monospace;
}

body.font-mono .name {
  letter-spacing: -0.03em;
}

/* ---------- Focus & motion ---------- */

.link:focus-visible,
.social:focus-visible,
.server-join:focus-visible,
.share-button:focus-visible,
.qr-action:focus-visible,
.qr-close:focus-visible,
.ban-close:focus-visible,
.ban-action:focus-visible,
.link-button:focus-visible,
.powered-by a:focus-visible {
  outline: 3px solid var(--text);
  outline-offset: 2px;
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation: none !important;
    transition: none !important;
  }
}

/* On banned profiles the footer is the only element in the flow: pin it to the bottom. */
.ban-popup ~ .powered-by {
  position: fixed;
  bottom: 12px;
  left: 50%;
  transform: translateX(-50%);
  white-space: nowrap;
}
