:root {
  --bg: #050507;
  --card: rgba(0, 0, 0, 0);
  --line: rgba(255, 255, 255, 0.22);
  --txt: #f4f6fb;
  --dim: #a7adb9;
  --blue: #dfe6f2;
  --blue-hi: #ffffff;
  --gold: #f0b232;
}

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

html, body { height: 100%; }

body {
  font-family: "Space Grotesk", system-ui, sans-serif;
  background: var(--bg);
  color: var(--txt);
  overflow-x: hidden;
  min-height: 100vh;
}

/* ---------- enter overlay ---------- */
#enter {
  position: fixed; inset: 0; z-index: 50;
  display: flex; align-items: center; justify-content: center;
  background: rgba(0, 0, 0, 0.52);
  backdrop-filter: blur(5px);
  -webkit-backdrop-filter: blur(5px);
  cursor: pointer;
  transition: opacity 0.7s ease;
}
#enter.hide { opacity: 0; pointer-events: none; }
.enter-box { text-align: center; animation: enterin 1s ease both; }
@keyframes enterin {
  from { opacity: 0; transform: translateY(14px); letter-spacing: 0.2em; }
  to { opacity: 1; transform: none; }
}
.enter-kicker {
  font-size: 11px; letter-spacing: 0.55em; text-indent: 0.55em;
  color: var(--dim); margin-bottom: 10px;
}
.enter-title {
  font-family: "Unbounded", sans-serif;
  font-weight: 800;
  font-size: clamp(58px, 15vw, 116px);
  line-height: 1;
  letter-spacing: 0.04em;
  background: linear-gradient(110deg, #8a93a8 20%, #ffffff 38%, #ffffff 42%, #8a93a8 60%);
  background-size: 220% 100%;
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  filter: drop-shadow(0 6px 30px rgba(0, 0, 0, 0.8));
  animation: shine 5s ease-in-out infinite;
}
@keyframes shine {
  0%, 100% { background-position: 110% 0; }
  50% { background-position: -10% 0; }
}
.enter-title .red { color: #e04863; -webkit-text-fill-color: #e04863; filter: none; }
.enter-hint {
  margin-top: 18px;
  display: flex; align-items: center; justify-content: center; gap: 12px;
  font-size: 12px; letter-spacing: 0.32em; text-indent: 0.1em; text-transform: uppercase;
  color: #cfd5e0;
  animation: hintpulse 2.4s ease-in-out infinite;
}
.enter-hint .rule { display: inline-block; width: 44px; height: 1px; background: rgba(255, 255, 255, 0.35); }
@keyframes hintpulse { 0%, 100% { opacity: 0.55; } 50% { opacity: 1; } }

/* ---------- background ---------- */
.bg {
  position: fixed; inset: 0; z-index: 0;
  background: url("./bg.jpg") center / cover no-repeat;
  filter: brightness(0.9) saturate(1.1);
}
.bg-tint {
  position: fixed; inset: 0; z-index: 1;
  background: linear-gradient(135deg,
    var(--t1, rgba(0, 0, 0, 0.9)), var(--t2, rgba(8, 12, 24, 0.78)) 30%,
    var(--t3, rgba(60, 10, 25, 0.4)) 58%, var(--t4, rgba(0, 0, 0, 0.92)));
}
#snow { position: fixed; inset: 0; z-index: 2; pointer-events: none; }
#flash {
  position: fixed; inset: 0; z-index: 40;
  background: #cfe2ff; opacity: 0;
  pointer-events: none;
  transition: opacity 0.12s ease;
}

/* cinematic vignette */
.vignette {
  position: fixed; inset: 0; z-index: 3;
  pointer-events: none;
  background: radial-gradient(120% 90% at 50% 45%, transparent 55%, rgba(0, 0, 0, 0.55) 100%);
}

/* ---------- custom crosshair cursor (desktop only) ---------- */
@media (hover: hover) and (pointer: fine) {
  body, body a, body button, .link, #enter { cursor: none; }
}
.cursor, .cursor-ring {
  display: none;
  position: fixed; top: 0; left: 0;
  pointer-events: none;
  z-index: 100;
}
@media (hover: hover) and (pointer: fine) {
  .cursor, .cursor-ring { display: block; }
}
.cursor { width: 8px; height: 8px; border-radius: 50%; background: #ffffff; box-shadow: 0 0 10px rgba(255, 255, 255, 0.9), 0 0 26px rgba(255, 255, 255, 0.45); }
.cursor-ring {
  width: 34px; height: 34px;
  border: 1px solid rgba(255, 255, 255, 0.5);
  border-radius: 50%;
  box-shadow: 0 0 16px rgba(255, 255, 255, 0.2);
}
/* drifting fog so the rain has atmosphere */
.fog {
  position: fixed; inset: -10%; z-index: 2;
  pointer-events: none;
  background:
    radial-gradient(42% 30% at 28% 72%, rgba(130, 160, 210, 0.08), transparent 70%),
    radial-gradient(36% 26% at 72% 62%, rgba(130, 160, 210, 0.07), transparent 70%);
  animation: fogdrift 26s ease-in-out infinite alternate;
}
@keyframes fogdrift {
  from { transform: translateX(-3%); }
  to { transform: translateX(3%) translateY(-2%); }
}
/* rain sound toggle */
.snd {
  position: fixed; right: 14px; bottom: 14px; z-index: 46;
  width: 42px; height: 42px;
  border-radius: 50%;
  border: 1px solid var(--line);
  background: rgba(10, 16, 28, 0.6);
  backdrop-filter: blur(12px);
  color: #9fd0ff;
  display: flex; align-items: center; justify-content: center;
  padding: 0;
}
.snd svg { display: block; }
.snd.off { color: var(--dim); }

/* ---------- card ---------- */
.wrap {
  position: relative; z-index: 3;
  min-height: 100vh;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  padding: 48px 16px 110px;
  perspective: 1000px;
}
.card {
  position: relative;
  width: 100%; max-width: 420px;
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.4);
  border-radius: 22px;
  padding: 38px 30px 26px;
  text-align: center;
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.65), 0 0 46px rgba(255, 255, 255, 0.07), inset 0 1px 0 rgba(255, 255, 255, 0.22);
  animation: rise 0.8s ease backwards;
  transform-style: preserve-3d;
  will-change: transform;
  transition: transform 0.25s ease;
  overflow: hidden;
}
.card::before {
  content: ""; position: absolute; inset: 0;
  background: radial-gradient(320px circle at var(--mx, 50%) var(--my, 50%),
    rgba(92, 148, 255, 0.14), transparent 65%);
  pointer-events: none;
}
@keyframes rise {
  from { opacity: 0; transform: translateY(18px); }
  to { opacity: 1; transform: none; }
}

.avatar-ring {
  position: relative;
  width: 118px; height: 118px;
  margin: 0 auto 16px;
}
.avatar-ring::before {
  content: ""; position: absolute; inset: -5px;
  border-radius: 50%;
  background: conic-gradient(from 120deg, var(--ring, #e8edf5), #ffffff, #e04863, var(--ring, #e8edf5));
  filter: blur(1px);
  animation: spin 6s linear infinite;
}
.avatar-ring a { display: block; border-radius: 50%; }
@keyframes spin { to { transform: rotate(360deg); } }
#avatar {
  position: relative;
  display: block;
  width: 118px; height: 118px;
  border-radius: 50%;
  object-fit: cover;
  border: 4px solid #0a101c;
  background: #0a101c;
}
.deco {
  position: absolute;
  left: 50%; top: 50%;
  width: 148px; height: 148px;
  transform: translate(-50%, -50%);
  pointer-events: none;
  z-index: 1;
}
/* status-tinted ring */
body[data-status="online"] { --ring: #23a55a; }
body[data-status="idle"] { --ring: #f0b232; }
body[data-status="dnd"] { --ring: #da373c; }
body[data-status="offline"] { --ring: #4a5064; }
.status {
  position: absolute; right: 8px; bottom: 8px;
  width: 24px; height: 24px;
  border-radius: 50%;
  background: #23a55a;
  border: 5px solid #0a101c;
  z-index: 2;
}

.name {
  font-family: "Unbounded", sans-serif;
  font-size: 34px; font-weight: 800;
  letter-spacing: 0.02em;
  text-shadow: 0 0 30px var(--glow, rgba(47, 123, 255, 0.45));
}
.uid {
  margin-top: 6px;
  font-size: 12px; color: var(--dim);
  letter-spacing: 0.08em;
  cursor: pointer;
  user-select: all;
}
.uid:hover { color: var(--blue-hi); }
.presence {
  margin-top: 8px;
  font-size: 13px; font-weight: 500; letter-spacing: 0.04em;
  color: var(--dim);
}
.presence b { font-weight: 700; }
.presence .st-online { color: #23a55a; }
.presence .st-idle { color: #f0b232; }
.presence .st-dnd { color: #da373c; }
.presence .st-offline { color: #80848e; }
.cemoji { width: 16px; height: 16px; vertical-align: -3px; }

.typed {
  margin-top: 10px;
  min-height: 22px;
  font-size: 15px; color: var(--dim);
}
.caret { color: var(--blue-hi); animation: blink 1s steps(1) infinite; }
@keyframes blink { 50% { opacity: 0; } }

.badges {
  display: flex; gap: 8px; justify-content: center;
  margin: 16px 0 20px;
}
.badge {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: 11px; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase;
  color: #eef1f7;
  background: rgba(255, 255, 255, 0.07);
  border: 1px solid rgba(255, 255, 255, 0.32);
  padding: 5px 11px;
  border-radius: 999px;
}

/* ---------- links ---------- */
.links { display: flex; flex-direction: column; gap: 10px; }
.link {
  display: flex; align-items: center; gap: 12px;
  padding: 13px 16px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.16);
  color: var(--txt); text-decoration: none;
  font-weight: 500; font-size: 15px;
  transition: transform 0.15s ease, background 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
}
.link:hover {
  transform: translateY(-2px);
  background: rgba(255, 255, 255, 0.09);
  border-color: rgba(255, 255, 255, 0.55);
  box-shadow: 0 8px 28px rgba(255, 255, 255, 0.12);
}
.link svg { flex: none; display: block; transition: transform 0.15s ease; }
.link:hover svg { transform: scale(1.15); }
.link .go { margin-left: auto; color: var(--dim); font-size: 18px; transition: transform 0.15s ease, color 0.15s ease; }
.link:hover .go { color: #fff; transform: translateX(3px); }
.link .go { margin-left: auto; color: var(--dim); font-size: 18px; }
.link:hover .go { color: var(--blue-hi); }

/* ---------- meta ---------- */
.meta {
  display: flex; align-items: center; justify-content: center; gap: 8px;
  margin-top: 20px;
  font-size: 13px; color: var(--dim);
}
.views { display: inline-flex; align-items: center; gap: 6px; }
.views b { color: var(--txt); font-variant-numeric: tabular-nums; }
.dot { opacity: 0.5; }

/* ---------- visitor themes ---------- */
body[data-theme="blood"] {
  --blue: #e04863; --blue-hi: #ff7d95;
  --line: rgba(224, 72, 99, 0.2);
  --glow: rgba(224, 72, 99, 0.45);
  --t1: rgba(12, 2, 6, 0.93); --t2: rgba(46, 8, 18, 0.8);
  --t3: rgba(160, 30, 55, 0.45); --t4: rgba(6, 0, 3, 0.94);
}
body[data-theme="ice"] {
  --blue: #7dd3fc; --blue-hi: #d3efff;
  --line: rgba(125, 211, 252, 0.2);
  --glow: rgba(125, 211, 252, 0.45);
  --t1: rgba(2, 8, 18, 0.92); --t2: rgba(18, 48, 80, 0.78);
  --t3: rgba(125, 211, 252, 0.3); --t4: rgba(1, 4, 12, 0.94);
}
.themes {
  position: fixed; top: 14px; right: 14px; z-index: 45;
  display: flex; gap: 8px;
  background: rgba(8, 14, 24, 0.7);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 7px 10px;
  backdrop-filter: blur(8px);
}
.themes button {
  width: 16px; height: 16px;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.25);
  background: #c9d2e3;
  padding: 0;
}
.themes button[data-t="blood"] { background: #e04863; }
.themes button[data-t="ice"] { background: #7dd3fc; }
.themes button.on { outline: 2px solid #fff; outline-offset: 2px; }

/* ---------- status-reactive avatar ---------- */
body[data-status="offline"] #avatar { filter: grayscale(1) brightness(0.65); }
body[data-status="offline"] .avatar-ring::before { animation: none; opacity: 0.35; }
body[data-status="online"] .avatar-ring { animation: ringpulse 2.4s ease-out infinite; }
@keyframes ringpulse {
  0% { filter: drop-shadow(0 0 0 rgba(35, 165, 90, 0.7)); }
  70% { filter: drop-shadow(0 0 16px rgba(35, 165, 90, 0)); }
  100% { filter: drop-shadow(0 0 0 rgba(35, 165, 90, 0)); }
}

/* ---------- live activity card ---------- */
.activity {
  display: flex; gap: 14px; align-items: center;
  text-align: left;
  margin: 0 0 16px;
  padding: 12px 14px;
  background: rgba(0, 0, 0, 0.35);
  border: 1px solid var(--line);
  border-radius: 16px;
}
.activity[hidden] { display: none; }
.activity img {
  width: 62px; height: 62px;
  border-radius: 14px;
  object-fit: cover;
  flex: none;
  background: #000;
}
.act-info { flex: 1; min-width: 0; }
.act-type {
  font-size: 10px; font-weight: 700;
  letter-spacing: 0.14em; text-transform: uppercase;
  color: var(--dim);
}
.act-name {
  font-size: 16px; font-weight: 700;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.act-detail {
  font-size: 12px; color: var(--dim);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.bar {
  height: 4px; border-radius: 4px;
  background: rgba(255, 255, 255, 0.1);
  margin-top: 8px;
  overflow: hidden;
}
.bar > div {
  height: 100%; width: 0%;
  border-radius: 4px;
  background: linear-gradient(90deg, var(--blue), var(--blue-hi));
  transition: width 1s linear;
}
.act-time { font-size: 11px; color: var(--dim); margin-top: 4px; font-variant-numeric: tabular-nums; }

/* ---------- glass music player ---------- */
.player {
  position: fixed; left: 50%; bottom: 18px;
  transform: translateX(-50%);
  z-index: 46;
  display: flex; align-items: center; gap: 12px;
  width: min(360px, calc(100vw - 24px));
  padding: 10px 14px 10px 10px;
  background: rgba(10, 16, 28, 0.55);
  border: 1px solid var(--line);
  border-radius: 18px;
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.55), inset 0 1px 0 rgba(255, 255, 255, 0.08);
}
.player[hidden] { display: none; }
.player img {
  width: 48px; height: 48px;
  border-radius: 12px;
  object-fit: cover;
  flex: none;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.5);
}
.player img.spin { animation: discs 6s linear infinite; border-radius: 50%; }
@keyframes discs { to { transform: rotate(360deg); } }
.p-info { flex: 1; min-width: 0; }
.p-song { font-size: 14px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.plive {
  display: inline-block;
  font-size: 9px; font-weight: 800; letter-spacing: 0.1em;
  color: #fff; background: #e04863;
  border-radius: 5px; padding: 1px 6px; margin-left: 6px;
  vertical-align: 2px;
  animation: liveblink 1.6s ease-in-out infinite;
}
.plive[hidden] { display: none; }
@keyframes liveblink { 0%, 100% { opacity: 1; } 50% { opacity: 0.45; } }
.p-artist { font-size: 11px; color: var(--dim); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pbar { height: 3px; margin-top: 7px; }
.p-toggle {
  flex: none;
  width: 38px; height: 38px;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.4);
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
  display: flex; align-items: center; justify-content: center;
  padding: 0;
}
.p-toggle:hover { background: rgba(255, 255, 255, 0.22); }
.p-toggle svg { display: block; }

/* ---------- live viewer ticker ---------- */
.live {
  margin-top: 14px;
  margin-bottom: 86px;
  display: flex; align-items: center; justify-content: center; gap: 7px;
  font-size: 12px; letter-spacing: 0.08em; text-transform: uppercase;
  color: var(--dim);
}
.live b { color: var(--txt); font-variant-numeric: tabular-nums; }
.livedot {
  width: 7px; height: 7px; border-radius: 50%;
  background: #23a55a;
  box-shadow: 0 0 8px rgba(35, 165, 90, 0.9);
  animation: liveblink 1.6s ease-in-out infinite;
}

/* ---------- private admin analytics ---------- */
.admin {
  position: fixed; left: 50%; top: 14px;
  transform: translateX(-50%);
  z-index: 44;
  width: min(480px, calc(100vw - 24px));
  background: rgba(8, 14, 24, 0.94);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 14px 16px 12px;
  backdrop-filter: blur(10px);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.6);
}
.admin[hidden] { display: none; }
.admin h2 {
  font-size: 11px; letter-spacing: 0.14em; text-transform: uppercase;
  color: var(--dim); margin-bottom: 10px;
}
.bars {
  display: flex; align-items: flex-end; gap: 5px;
  height: 84px;
}
.abar { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 4px; height: 100%; justify-content: flex-end; }
.abar > div {
  width: 100%; min-height: 2px;
  border-radius: 3px;
  background: linear-gradient(180deg, var(--blue-hi), var(--blue));
}
.abar span { font-size: 8px; color: var(--dim); }
.admin-total { margin-top: 8px; font-size: 12px; color: var(--dim); }

/* ---------- toast ---------- */
#toast {
  position: fixed; left: 50%; bottom: 28px;
  transform: translateX(-50%) translateY(20px);
  background: rgba(10, 18, 30, 0.95);
  border: 1px solid rgba(47, 123, 255, 0.5);
  color: var(--txt);
  font-size: 14px;
  padding: 10px 20px;
  border-radius: 12px;
  opacity: 0; pointer-events: none;
  transition: opacity 0.25s ease, transform 0.25s ease;
  z-index: 60;
}
#toast.show { opacity: 1; transform: translateX(-50%); }

@media (max-width: 480px) {
  .name { font-size: 28px; }
  .card { padding: 30px 20px 22px; }
}
