:root {
  --z-overlay: 300;
  --z-list-panel: 310;
  --z-profile-panel: 320;
  --anim-duration-fast: 0.2s;
  --anim-duration-standard: 0.35s;
  --anim-duration-slow: 0.45s;
  --border-radius-sm: 10px;
  --border-radius-md: 12px;
  --border-radius-lg: 24px;
  --shadow-md: 0 10px 50px rgba(0,0,0,0.35);
  --shadow-sm: 0 6px 18px rgba(0,0,0,0.45);
  --hk-pink: #ffd1e8;
  --hk-rose: #ff9acb;
  --hk-bow: #ff5c8d;
  --hk-soft: #fff7fb;
  --hk-accent: #ffb6d9;
}

/* Place the toggle in the normal document flow so it sits under the socials nav and centers
   Use block layout with auto horizontal margins to center it under the socials container. */
#toggle-friends {
  position: relative;
  z-index: calc(var(--z-overlay) + 10);
  display: block;
  margin: 12px auto 0;
  min-width: 48px;
  height: auto;
  padding: 8px 12px;
  border-radius: 999px;
  background: linear-gradient(90deg, rgba(255,92,141,0.16), rgba(255,182,217,0.08));
  border: 1px solid rgba(255,92,141,0.22);
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-family: 'Syne', 'Angel Wish', sans-serif;
  font-weight: 800;
  font-size: 14px;
  color: #7a1f4a;
  cursor: none;
  box-shadow: 0 8px 28px rgba(255,92,141,0.08), 0 0 18px rgba(255,154,203,0.06);
  transition: transform var(--anim-duration-fast) ease, box-shadow var(--anim-duration-fast) ease, border-color var(--anim-duration-fast) ease;
}

#toggle-friends:hover {
  transform: translateY(-4px) scale(1.02);
}

#toggle-friends:focus-visible {
  outline: 2px solid rgba(255,154,203,0.6);
  outline-offset: 4px;
}

#toggle-friends.active {
  border-color: rgba(255,92,141,0.38);
  box-shadow: 0 12px 36px rgba(255,92,141,0.12), 0 0 18px rgba(255,154,203,0.12);
}

.tf-heart {
  font-size: 18px;
  filter: drop-shadow(0 4px 10px rgba(255,92,141,0.22));
}

.tf-label {
  font-size: 14px;
  letter-spacing: 1px;
  color: #ff2d7a;
  text-shadow: 0 2px 8px rgba(255,45,122,0.18);
}

.fr-verified-badge {
  width: 16px;
  height: 16px;
  display: inline-block;
  vertical-align: middle;
  margin-left: 8px;
  object-fit: contain;
}

#toggle-friends.tf-hidden {
  opacity: 0;
  transform: translateY(-6px) scale(0.98);
  pointer-events: none;
}

#toggle-friends.tf-visible {
  opacity: 1;
  transform: translateY(0) scale(1);
  pointer-events: auto;
  transition: opacity 420ms cubic-bezier(0.2,0.9,0.2,1), transform 420ms cubic-bezier(0.2,0.9,0.2,1);
}

.friend-profile-panel {
  position: fixed;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  z-index: var(--z-profile-panel);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--border-radius-lg);
  padding: 32px;
  width: 700px;
  max-width: calc(100vw - 40px);
  max-height: 85vh;
  overflow-y: auto;
  box-shadow: var(--shadow-md);
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--anim-duration-standard) ease, transform var(--anim-duration-standard) ease;
  transform-style: preserve-3d;
  will-change: transform;
  transform-origin: center center;
}

/* Hide native scrollbars for the friend profile panel but keep scrolling functionality */
.friend-profile-panel,
.friend-profile-panel .fp-content {
  -ms-overflow-style: none; /* IE 10+ */
  scrollbar-width: none; /* Firefox */
}
.friend-profile-panel::-webkit-scrollbar,
.friend-profile-panel .fp-content::-webkit-scrollbar {
  display: none; /* Chrome, Safari, Edge */
  width: 0;
  height: 0;
}

/* Ensure any custom Hello Kitty scrollbar styling doesn't show up */
.friend-profile-panel.hello-kitty-panel::-webkit-scrollbar-thumb {
  background: transparent !important;
}

.friend-profile-panel::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(200,255,0,0.03) 0%, transparent 60%);
  pointer-events: none;
}

.friend-profile-panel::after {
  content: '';
  position: absolute;
  inset: 0;
  pointer-events: none;
  border-radius: inherit;
  background: linear-gradient(135deg, rgba(255,255,255,0.05), transparent 35%, transparent 65%, rgba(255,255,255,0.02));
  opacity: 0.7;
}

.friend-profile-panel.open {
  opacity: 1;
  pointer-events: auto;
  transform: translate(-50%, -50%);
}

.friend-profile-panel.closed {
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, calc(-50% + 30px));
}

.fp-back-btn {
  position: sticky;
  top: 0;
  z-index: 10;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: var(--border-radius-sm);
  background: rgba(255,255,255,0.04);
  border: 1px solid var(--border);
  color: var(--text);
  font-size: 16px;
  cursor: none;
  transition: all var(--anim-duration-fast) ease;
  margin-bottom: 20px;
  pointer-events: auto;
}

.fp-back-btn:hover {
  border-color: var(--accent);
  transform: translateX(-3px);
  background: rgba(200,255,0,0.06);
}

.fp-back-btn:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.fp-content {
  position: relative;
  z-index: 3;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.fp-header {
  display: flex;
  align-items: flex-start;
  gap: 20px;
}

.fp-avatar {
  flex-shrink: 0;
  position: relative;
}

.fp-avatar-ring {
  position: absolute;
  inset: -6px;
  border-radius: 50%;
  background: conic-gradient(var(--accent), var(--accent2), var(--accent));
  animation: spin 4s linear infinite;
}

.fp-avatar-inner {
  position: relative;
  width: 100px;
  height: 100px;
  border-radius: 50%;
  background: var(--bg);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.fp-avatar-inner img {
  width: 94px;
  height: 94px;
  border-radius: 50%;
  object-fit: cover;
}

.fp-avatar-initials {
  font-family: 'Syne', sans-serif;
  font-weight: 800;
  font-size: 36px;
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  background-clip: text;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.fp-info {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.fp-name {
  font-family: 'Angel Wish', 'Syne', sans-serif;
  font-weight: 800;
  font-size: clamp(20px, 3.5vw, 32px);
  line-height: 1.1;
  letter-spacing: -0.6px;
  color: var(--text);
}

.fp-nickname {
  font-size: 11px;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: var(--accent);
}

.fp-section {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.fp-section-label {
  font-size: 9px;
  letter-spacing: 3px;
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 700;
}

.fp-section-content {
  font-size: 13px;
  line-height: 1.6;
  color: var(--text);
}

.fp-known-since {
  background: rgba(200,255,0,0.04);
  border-left: 3px solid var(--accent);
  padding: 12px 14px;
  border-radius: 6px;
}

.fp-about {
  background: rgba(255,255,255,0.02);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 16px;
}

.fp-about-text {
  font-size: 12px;
  line-height: 1.7;
  color: var(--muted);
}

.fp-socials {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 16px;
}

.fp-social-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 12px;
  border-radius: var(--border-radius-sm);
  background: linear-gradient(135deg, rgba(88,101,242,0.1), rgba(88,101,242,0.05));
  border: 1px solid rgba(88,101,242,0.3);
  color: var(--text);
  text-decoration: none;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.5px;
  transition: all var(--anim-duration-fast) ease;
  cursor: none;
}

.fp-social-btn:hover {
  background: linear-gradient(135deg, rgba(88,101,242,0.2), rgba(88,101,242,0.1));
  border-color: rgba(88,101,242,0.6);
  transform: translateY(-2px);
}

.fp-social-btn:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.fp-social-btn img {
  width: 14px;
  height: 14px;
  object-fit: contain;
}

.fp-list {
  margin: 8px 0 0 12px;
  padding: 0;
}

.fp-list li {
  margin-bottom: 6px;
  color: var(--text);
  font-size: 13px;
}

@keyframes hk-float-heart {
  0% {
    transform: translateX(0) translateY(0) scale(1) rotate(-6deg);
    opacity: var(--hk-max, 1);
  }
  40% {
    transform: translateX(calc(var(--hk-drift) * 0.45)) translateY(calc(var(--hk-fall) * 0.4)) scale(1.02) rotate(6deg);
    opacity: calc(var(--hk-max, 1) * 0.95);
  }
  70% {
    transform: translateX(calc(var(--hk-drift) * -0.28)) translateY(calc(var(--hk-fall) * 0.7)) scale(0.98) rotate(-4deg);
    opacity: calc(var(--hk-max, 1) * 0.85);
  }
  100% {
    transform: translateX(calc(var(--hk-drift) * 0.12)) translateY(var(--hk-fall)) scale(0.9) rotate(-2deg);
    opacity: 0;
  }
}

.hk-heart {
  position: absolute;
  top: -6%;
  pointer-events: none;
  animation-name: hk-float-heart;
  animation-timing-function: linear;
  animation-iteration-count: infinite;
  animation-fill-mode: forwards;
  z-index: 1;
  user-select: none;
  will-change: transform, opacity;
}

.hk-heart:nth-child(1) {
  left: 8%;
  font-size: 10px;
}

.hk-heart:nth-child(2) {
  left: 22%;
  font-size: 16px;
}

.hk-heart:nth-child(3) {
  left: 50%;
  font-size: 10px;
}

.hk-heart:nth-child(4) {
  left: 72%;
  font-size: 13px;
}

.hk-heart:nth-child(5) {
  left: 88%;
  font-size: 9px;
}

.friend-profile-panel.hello-kitty-panel {
  background: linear-gradient(160deg, #fff0f7 0%, #ffe4f2 60%, #ffd6ed 100%) !important;
  border-color: rgba(255, 92, 141, 0.3) !important;
  box-shadow: 0 10px 60px rgba(255, 92, 141, 0.2), 0 0 0 1px rgba(255,154,203,0.15);
}

.friend-profile-panel.hello-kitty-panel .fp-back-btn {
  background: rgba(255, 92, 141, 0.08);
  border-color: rgba(255, 92, 141, 0.25);
  color: #c0336a;
}

.friend-profile-panel.hello-kitty-panel .fp-back-btn:hover {
  background: rgba(255, 92, 141, 0.16);
  border-color: var(--hk-bow);
  transform: translateX(-3px);
}

.friend-profile-panel.hello-kitty-panel .fp-avatar-ring {
  background: conic-gradient(
    #ff5c8d 0deg,
    #ffb6d9 90deg,
    #ff5c8d 180deg,
    #ffd1e8 270deg,
    #ff5c8d 360deg
  );
  animation: spin 3s linear infinite;
  filter: drop-shadow(0 0 6px rgba(255,92,141,0.5));
}

.hk-hearts-container {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  overflow: visible;
  z-index: 1;
}

.friend-profile-panel.hello-kitty-panel .fp-section-label {
  color: #d63b7a;
  font-weight: 900;
  font-size: clamp(12px, 1.6vw, 16px);
  letter-spacing: 1px;
  text-transform: uppercase;
}

.friend-profile-panel.hello-kitty-panel .fp-section-content,
.friend-profile-panel.hello-kitty-panel .fp-about-text,
.friend-profile-panel.hello-kitty-panel .fp-list li {
  color: #4a2040;
  font-size: 13px;
  font-weight: 500;
}

.friend-profile-panel.hello-kitty-panel .fp-section {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 14px;
}

.friend-profile-panel.hello-kitty-panel .fp-section-label {
  margin: 0;
  display: block;
}

.friend-profile-panel.hello-kitty-panel .fp-section-content {
  margin: 0;
  padding: 0;
}

.friend-profile-panel.hello-kitty-panel .fp-header {
  gap: 14px;
  align-items: center;
}

.friend-profile-panel.hello-kitty-panel .fp-info {
  gap: 4px;
}

.friend-profile-panel.hello-kitty-panel .fp-nickname {
  margin-top: 4px;
  font-size: 11px;
}

.friend-profile-panel.hello-kitty-panel .fp-about {
  padding: 20px;
}

.friend-profile-panel.hello-kitty-panel .fp-name {
  background: linear-gradient(90deg, #ff5c8d 0%, #ff9acb 60%, #ffb6d9 100%);
  background-clip: text;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  text-shadow: none;
  font-size: clamp(26px, 4.5vw, 40px);
  line-height: 1.05;
  font-weight: 900;
  display: block;
}

.friend-profile-panel.hello-kitty-panel .fp-nickname {
  color: #c0336a;
  letter-spacing: 3px;
}

.friend-profile-panel.hello-kitty-panel .fp-social-btn {
  background: linear-gradient(135deg, rgba(255,92,141,0.12), rgba(255,182,217,0.06));
  border: 1px solid rgba(255,92,141,0.35);
  color: #8c2050;
  font-weight: 700;
}

.friend-profile-panel.hello-kitty-panel .fp-social-btn:hover {
  background: linear-gradient(135deg, rgba(255,92,141,0.22), rgba(255,182,217,0.14));
  border-color: #ff5c8d;
  transform: translateY(-3px) scale(1.03);
  box-shadow: 0 6px 20px rgba(255,92,141,0.25);
}

.friend-profile-panel.hello-kitty-panel .fp-about {
  background: rgba(255, 255, 255, 0.55);
  border: 1px solid rgba(255, 154, 203, 0.3);
  backdrop-filter: blur(8px);
  border-radius: 18px;
}

.friend-profile-panel.hello-kitty-panel .fp-about > * {
  position: relative;
  z-index: 3;
}

.friend-profile-panel.hello-kitty-panel .fp-about .hk-hearts-container {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  overflow: visible;
  z-index: 1;
}

.friend-profile-panel.hello-kitty-panel .fp-about.hello-kitty::before {
  width: 80px;
  height: 64px;
  top: -12px;
  right: 14px;
  filter: drop-shadow(0 4px 12px rgba(255,92,141,0.3));
}

.friend-profile-panel.hello-kitty-panel::-webkit-scrollbar-thumb {
  background: linear-gradient(180deg, #ff5c8d, #ffb6d9);
}

.friend-profile-panel.hello-kitty-panel::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(90deg, #ff5c8d, #ffd1e8, #ff9acb, #ff5c8d);
  background-size: 200% 100%;
  animation: hk-shimmer 2.5s linear infinite;
  border-radius: var(--border-radius-lg) var(--border-radius-lg) 0 0;
  z-index: 5;
  pointer-events: none;
}

@keyframes hk-shimmer {
  0% { background-position: 0% 0%; }
  100% { background-position: 200% 0%; }
}

.fp-about.hello-kitty {
  position: relative;
  padding: 20px 18px 22px 18px;
  background: linear-gradient(180deg, var(--hk-soft), rgba(255,255,255,0.6));
  border: 1px solid rgba(255,92,141,0.12);
  border-radius: 16px;
  box-shadow: 0 8px 30px rgba(255,154,203,0.06);
  color: #5a3a4f;
}

.fp-about.hello-kitty::before {
  content: '';
  position: absolute;
  top: -6px;
  right: 18px;
  width: 64px;
  height: 48px;
  pointer-events: none;
  background-image: url("../assets/hellokitty.gif");
  background-repeat: no-repeat;
  background-position: center center;
  background-size: contain;
  transform: translateY(-8%) rotate(-4deg);
  filter: drop-shadow(0 4px 10px rgba(255,92,141,0.12));
  opacity: 0.98;
}

.fp-about.hello-kitty .fp-about-text {
  color: #6b4960;
  font-size: 13px;
  line-height: 1.7;
}

.fp-name.hello-kitty,
.fp-info .fp-name.hello-kitty {
  color: var(--hk-bow);
  text-shadow: 0 1px 0 rgba(255,255,255,0.6);
}

.fp-about.hello-kitty .fp-social-btn {
  background: linear-gradient(135deg, rgba(255,154,203,0.08), rgba(255,154,203,0.03));
  border: 1px solid rgba(255,154,203,0.25);
  color: #4b3140;
}

.fp-about.hello-kitty .fp-social-btn:hover {
  background: linear-gradient(135deg, rgba(255,154,203,0.18), rgba(255,154,203,0.08));
  border-color: rgba(255,92,141,0.6);
}

@media (max-width: 520px) {
  .fp-about.hello-kitty::before {
    right: 12px;
    top: -6px;
    width: 44px;
    height: 24px;
    opacity: 0.95;
  }
}

@media (max-width: 700px) {
  .friend-profile-panel {
    width: calc(100vw - 32px);
    padding: 20px;
  }

  #toggle-friends {
    left: 50%;
    transform: translateX(-50%);
    right: auto;
  }
}

.friend-row.hello-kitty {
  background: linear-gradient(90deg, rgba(255,209,232,0.06), rgba(255,154,203,0.03));
  border-color: rgba(255,92,141,0.18);
}

.friend-row.hello-kitty:hover {
  background: linear-gradient(90deg, rgba(255,154,203,0.08), rgba(255,92,141,0.05));
  transform: translateX(4px) scale(1.01);
}

.friend-row.hello-kitty .fr-avatar-ring {
  background: conic-gradient(var(--hk-bow), var(--hk-rose), var(--hk-bow));
  animation-duration: 5s;
}

.friend-row.hello-kitty .fr-name {
  color: var(--hk-bow);
}

.friend-row.hello-kitty .fr-nickname {
  color: var(--hk-rose);
}

.friend-row.hello-kitty .fr-arrow {
  color: var(--hk-rose);
}

.fp-about.hello-kitty .fp-section-label {
  color: #9a3b6a;
}

.fp-about.hello-kitty .hk-info {
  color: #4b2b45;
}

.fp-about.hello-kitty .fp-section-content {
  color: #5a3a4f;
}

.fp-name.hello-kitty {
  color: var(--hk-bow);
}

