:root {
  --bg-top: #050810;
  --bg-mid: #0a1424;
  --bg-low: #13243b;
  --ice: #bfe3ff;
  --ice-strong: #8fd0ff;
  --text: #eef6ff;
  --muted: #9fb3c8;
  --glass: rgba(18, 30, 50, 0.42);
  --glass-edge: rgba(191, 227, 255, 0.16);
  --online: #3ba55d;
  --idle: #faa81a;
  --dnd: #ed4245;
  --offline: #747f8d;
  --blurple: #5865f2;
}

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

html, body { height: 100%; }

body {
  font-family: "Outfit", system-ui, sans-serif;
  color: var(--text);
  background:
    radial-gradient(1200px 600px at 50% 110%, #1d3557 0%, transparent 60%),
    linear-gradient(180deg, var(--bg-top) 0%, var(--bg-mid) 55%, var(--bg-low) 100%);
  background-color: var(--bg-top);
  min-height: 100vh;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

/* ---------- background layers ---------- */
.bg-photo {
  position: fixed; inset: 0;
  z-index: 0;
  background-size: cover;
  background-position: 60% 65%;
  opacity: 0;
  transform: scale(1.06);
  filter: saturate(115%) contrast(105%);
  transition: opacity 1.4s ease, transform 6s ease-out;
  pointer-events: none;
}
.bg-photo.loaded { opacity: 1; transform: scale(1); }
.bg-photo::after { /* cold night tint so the cards stay readable */
  content: "";
  position: absolute; inset: 0;
  background:
    radial-gradient(90% 80% at 50% 50%, rgba(5, 10, 22, .05), rgba(5, 10, 22, .55) 100%),
    linear-gradient(180deg, rgba(6, 12, 26, .45) 0%, rgba(10, 24, 46, .12) 45%, rgba(10, 22, 42, .55) 100%),
    rgba(40, 80, 140, .12);
}
#snow {
  position: fixed; inset: 0;
  width: 100%; height: 100%;
  pointer-events: none;
  z-index: 60;
}

.aurora {
  position: fixed; inset: -20% -10% auto -10%;
  height: 70vh;
  z-index: 1;
  background:
    radial-gradient(40% 50% at 30% 40%, rgba(120, 220, 255, 0.13), transparent 70%),
    radial-gradient(35% 45% at 70% 30%, rgba(160, 130, 255, 0.10), transparent 70%),
    radial-gradient(30% 40% at 50% 60%, rgba(90, 255, 200, 0.06), transparent 70%);
  filter: blur(30px);
  animation: aurora 18s ease-in-out infinite alternate;
  pointer-events: none;
}
@keyframes aurora {
  0%   { transform: translateX(-4%) skewX(-4deg); opacity: .8; }
  100% { transform: translateX(4%) skewX(4deg);  opacity: 1; }
}

/* snowy hills at the bottom */
.ground {
  position: fixed; left: 0; right: 0; bottom: 0;
  height: 22vh; min-height: 120px;
  z-index: 1;
  pointer-events: none;
  background:
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 1440 200' preserveAspectRatio='none'%3E%3Cpath fill='%23dbeeff' fill-opacity='.10' d='M0 90 C180 40 320 120 520 80 S880 20 1080 70 1320 60 1440 40 V200 H0Z'/%3E%3Cpath fill='%23e8f4ff' fill-opacity='.16' d='M0 130 C200 90 380 160 620 120 S1000 80 1200 120 1380 110 1440 100 V200 H0Z'/%3E%3Cpath fill='%23f4faff' fill-opacity='.26' d='M0 170 C240 140 460 190 720 160 S1160 140 1440 160 V200 H0Z'/%3E%3C/svg%3E")
    bottom / 100% 100% no-repeat;
}

/* ---------- click to enter ---------- */
#gate {
  position: fixed; inset: 0;
  z-index: 50;
  display: grid; place-items: center;
  cursor: pointer;
  background: rgba(5, 8, 16, 0.55);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  transition: opacity .7s ease, visibility .7s;
}
#gate.gone { opacity: 0; visibility: hidden; }
.gate-inner { text-align: center; user-select: none; }
.gate-flake {
  font-size: 54px;
  color: var(--ice);
  text-shadow: 0 0 24px rgba(143, 208, 255, .7);
  animation: spin 9s linear infinite;
}
.gate-inner p {
  margin-top: 14px;
  font-size: 15px;
  letter-spacing: .35em;
  text-transform: lowercase;
  color: var(--muted);
  animation: pulse 2.4s ease-in-out infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes pulse { 50% { opacity: .35; } }

/* ---------- layout ---------- */
#app {
  position: relative;
  z-index: 2;
  min-height: 100vh;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  gap: 22px;
  padding: 64px 16px 48px;
  transition: opacity .9s ease, transform .9s cubic-bezier(.2,.8,.2,1);
}
#app.hidden { opacity: 0; transform: translateY(24px) scale(.98); }

/* ---------- cards ---------- */
.card {
  position: relative;
  width: 100%;
  max-width: 440px;
  border-radius: 22px;
  background: var(--glass);
  border: 1px solid var(--glass-edge);
  backdrop-filter: blur(18px) saturate(140%);
  -webkit-backdrop-filter: blur(18px) saturate(140%);
  box-shadow:
    0 20px 60px rgba(0, 0, 0, .45),
    inset 0 1px 0 rgba(255, 255, 255, .08),
    inset 0 0 40px rgba(191, 227, 255, .04);
  transform-style: preserve-3d;
  transition: transform .25s ease-out, box-shadow .3s;
  will-change: transform;
}
.card:hover {
  box-shadow:
    0 26px 70px rgba(0, 0, 0, .5),
    0 0 40px rgba(143, 208, 255, .08),
    inset 0 1px 0 rgba(255, 255, 255, .1);
}

/* snow piled on top of each card (shape is drawn in script.js) */
.snowcap {
  position: absolute;
  left: -5px; right: -5px; top: -17px;
  height: 52px;
  z-index: 4;
  pointer-events: none;
  filter: drop-shadow(0 4px 6px rgba(120, 180, 255, .28)) drop-shadow(0 1px 1px rgba(0, 20, 50, .25));
}
.snowcap svg { display: block; width: 100%; height: 100%; overflow: visible; }
.snowcap .sparkle {
  transform-box: fill-box;
  transform-origin: center;
  animation: twinkle 3.2s ease-in-out infinite;
  opacity: 0;
}
@keyframes twinkle {
  0%, 100% { opacity: 0; transform: scale(.3) rotate(0deg); }
  45%, 55% { opacity: 1; transform: scale(1) rotate(45deg); }
}
.snowcap .drop {
  animation: drip 5s ease-in infinite;
  opacity: 0;
}
@keyframes drip {
  0%, 70%  { opacity: 0; transform: translateY(0) scale(.4); }
  76%      { opacity: .9; transform: translateY(0) scale(1); }
  86%      { opacity: .9; transform: translateY(2px) scale(1, 1.15); }
  100%     { opacity: 0; transform: translateY(46px) scale(.8, 1.2); }
}

/* ---------- profile ---------- */
.profile {
  padding: 0 26px 26px;
  text-align: center;
}
.banner {
  height: 110px;
  margin: 0 -26px;
  border-radius: 22px 22px 0 0;
  background:
    radial-gradient(120% 140% at 20% 0%, rgba(143, 208, 255, .35), transparent 60%),
    radial-gradient(120% 140% at 90% 10%, rgba(160, 130, 255, .25), transparent 60%),
    #0e1a2c;
  background-size: cover;
  background-position: center;
  -webkit-mask: linear-gradient(#000 45%, transparent);
  mask: linear-gradient(#000 45%, transparent);
}

.avatar-wrap {
  position: relative;
  width: 112px; height: 112px;
  margin: -58px auto 14px;
}
.avatar {
  width: 100%; height: 100%;
  border-radius: 50%;
  object-fit: cover;
  background: #1a2a42;
  border: 4px solid rgba(14, 24, 40, .95);
  box-shadow: 0 0 0 2px rgba(191, 227, 255, .25), 0 0 30px rgba(143, 208, 255, .25);
}
.decoration {
  position: absolute;
  inset: -12%;
  width: 124%; height: 124%;
  pointer-events: none;
}
.status-dot {
  position: absolute;
  right: 6px; bottom: 6px;
  width: 24px; height: 24px;
  border-radius: 50%;
  background: var(--offline);
  border: 4px solid #0e1828;
  transition: background .3s;
}
.status-dot.online  { background: var(--online); box-shadow: 0 0 12px rgba(59,165,93,.7); }
.status-dot.idle    { background: var(--idle); }
.status-dot.dnd     { background: var(--dnd); }

.name {
  font-size: 30px;
  font-weight: 700;
  letter-spacing: -.01em;
  background: linear-gradient(180deg, #ffffff 0%, var(--ice) 100%);
  -webkit-background-clip: text; background-clip: text;
  color: transparent;
  text-shadow: 0 0 30px rgba(143, 208, 255, .25);
}
.username {
  position: relative;
  margin-top: 2px;
  font: 500 13px "JetBrains Mono", monospace;
  color: var(--muted);
  background: none; border: 0; cursor: pointer;
  padding: 3px 8px; border-radius: 8px;
  transition: color .2s, background .2s;
}
.username:hover { color: var(--ice); background: rgba(191, 227, 255, .06); }
.copied {
  position: absolute; left: 50%; top: -26px;
  transform: translate(-50%, 4px);
  font-size: 11px;
  background: var(--ice); color: #0a1424;
  padding: 3px 8px; border-radius: 6px;
  opacity: 0; pointer-events: none;
  transition: opacity .2s, transform .2s;
}
.copied.show { opacity: 1; transform: translate(-50%, 0); }

.bio {
  margin-top: 14px;
  min-height: 24px;
  font-size: 15.5px;
  font-weight: 300;
  color: #d6e6f5;
}
.caret {
  display: inline-block;
  margin-left: 1px;
  color: var(--ice-strong);
  animation: blink 1s steps(1) infinite;
}
@keyframes blink { 50% { opacity: 0; } }

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

/* activity / spotify */
.activity {
  display: flex; gap: 14px; align-items: center;
  margin-top: 20px;
  padding: 12px;
  text-align: left;
  border-radius: 14px;
  background: rgba(8, 14, 26, .45);
  border: 1px solid rgba(191, 227, 255, .08);
}
.act-img {
  width: 62px; height: 62px;
  flex: none;
  border-radius: 10px;
  object-fit: cover;
  background: #1a2a42;
}
.act-body { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.act-label {
  font-size: 10.5px; font-weight: 600;
  text-transform: uppercase; letter-spacing: .12em;
  color: var(--ice-strong);
}
.act-label.spotify { color: #1ed760; }
.act-title, .act-sub {
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.act-title { font-weight: 600; font-size: 14.5px; margin-top: 2px; }
.act-sub { font-size: 12.5px; color: var(--muted); }
.act-bar {
  margin-top: 7px;
  height: 4px; border-radius: 4px;
  background: rgba(255, 255, 255, .1);
  overflow: hidden;
}
.act-bar i {
  display: block; height: 100%; width: 0;
  background: linear-gradient(90deg, #1ed760, #8fffc0);
  border-radius: 4px;
  transition: width 1s linear;
}
.act-times {
  display: flex; justify-content: space-between;
  margin-top: 3px;
  font: 10.5px "JetBrains Mono", monospace;
  color: var(--muted);
}

/* social links */
.links {
  display: flex; flex-wrap: wrap; justify-content: center; gap: 10px;
  margin-top: 22px;
}
.links:empty { display: none; }
.links a {
  width: 44px; height: 44px;
  display: grid; place-items: center;
  border-radius: 12px;
  background: rgba(191, 227, 255, .06);
  border: 1px solid rgba(191, 227, 255, .1);
  transition: transform .2s, background .2s, box-shadow .2s;
}
.links a:hover {
  transform: translateY(-3px);
  background: rgba(191, 227, 255, .14);
  box-shadow: 0 8px 22px rgba(143, 208, 255, .2);
}
.links a span {
  width: 20px; height: 20px;
  background: var(--text);
  -webkit-mask: var(--icon) center / contain no-repeat;
  mask: var(--icon) center / contain no-repeat;
}

/* ---------- server ---------- */
.server {
  padding: 20px;
  overflow: visible;
}
.server-bg {
  position: absolute; inset: 0;
  border-radius: 22px;
  background-size: cover; background-position: center;
  opacity: .22;
  filter: blur(2px) saturate(120%);
  -webkit-mask: linear-gradient(90deg, transparent, #000 70%);
  mask: linear-gradient(90deg, transparent, #000 70%);
  pointer-events: none;
}
.server-row {
  position: relative;
  display: flex; align-items: center; gap: 16px;
}
.server-icon {
  width: 64px; height: 64px; flex: none;
  border-radius: 18px;
  object-fit: cover;
  background: var(--blurple);
  box-shadow: 0 6px 20px rgba(0, 0, 0, .35);
}
.server-info { min-width: 0; }
.server-kicker {
  font-size: 10.5px; font-weight: 600;
  text-transform: uppercase; letter-spacing: .14em;
  color: var(--ice-strong);
}
.server-name {
  font-size: 20px; font-weight: 600;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.server-counts {
  display: flex; gap: 14px; flex-wrap: wrap;
  margin-top: 3px;
  font-size: 13px; color: var(--muted);
}
.server-counts b { color: var(--text); font-weight: 600; }
.dot {
  display: inline-block;
  width: 8px; height: 8px; margin-right: 6px;
  border-radius: 50%;
  background: var(--offline);
  vertical-align: 1px;
}
.dot.on { background: var(--online); box-shadow: 0 0 8px rgba(59,165,93,.8); }

.join {
  position: relative;
  display: flex; align-items: center; justify-content: center; gap: 9px;
  margin-top: 18px;
  height: 46px;
  border-radius: 12px;
  font-weight: 600; font-size: 15px;
  color: #fff; text-decoration: none;
  background: linear-gradient(135deg, #5865f2, #7983f5);
  box-shadow: 0 8px 24px rgba(88, 101, 242, .35), inset 0 1px 0 rgba(255,255,255,.2);
  overflow: hidden;
  transition: transform .2s, box-shadow .2s;
}
.join::before { /* shine sweep */
  content: "";
  position: absolute; top: 0; bottom: 0; left: -60%;
  width: 40%;
  background: linear-gradient(100deg, transparent, rgba(255,255,255,.35), transparent);
  transform: skewX(-20deg);
  animation: shine 4s ease-in-out infinite;
}
@keyframes shine { 0%, 60% { left: -60%; } 100% { left: 130%; } }
.join:hover { transform: translateY(-2px); box-shadow: 0 12px 30px rgba(88, 101, 242, .5); }
.discord-mark {
  width: 20px; height: 20px;
  background: #fff;
  -webkit-mask: url("https://cdn.jsdelivr.net/npm/simple-icons@13.21.0/icons/discord.svg") center / contain no-repeat;
  mask: url("https://cdn.jsdelivr.net/npm/simple-icons@13.21.0/icons/discord.svg") center / contain no-repeat;
}

.foot {
  margin-top: 6px;
  font-size: 12px;
  letter-spacing: .25em;
  color: rgba(159, 179, 200, .55);
}

[hidden] { display: none !important; }

@media (max-width: 480px) {
  .profile { padding: 0 18px 22px; }
  .banner { margin: 0 -18px; height: 96px; }
  .name { font-size: 26px; }
  .server-name { font-size: 18px; }
}

@media (prefers-reduced-motion: reduce) {
  .aurora, .gate-flake, .join::before, .snowcap .drop { animation: none; }
}
