:root {
  --bg: #070b14;
  --card: rgba(10, 16, 28, 0.72);
  --line: rgba(140, 180, 255, 0.14);
  --txt: #eef3ff;
  --dim: #93a3c4;
  --blue: #2f7bff;
  --blue-hi: #5c94ff;
  --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(4, 7, 13, 0.82);
  backdrop-filter: blur(14px);
  cursor: pointer;
  transition: opacity 0.6s ease;
}
#enter.hide { opacity: 0; pointer-events: none; }
.enter-box { text-align: center; }
.enter-btn {
  font-family: "Unbounded", sans-serif;
  font-size: 20px; font-weight: 600;
  padding: 16px 46px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(47, 123, 255, 0.12);
  box-shadow: 0 0 40px rgba(47, 123, 255, 0.25), inset 0 0 24px rgba(47, 123, 255, 0.08);
  animation: pulse 2.2s ease-in-out infinite;
}
@keyframes pulse {
  0%, 100% { box-shadow: 0 0 24px rgba(47, 123, 255, 0.18); }
  50% { box-shadow: 0 0 60px rgba(47, 123, 255, 0.4); }
}

/* ---------- background ---------- */
.bg {
  position: fixed; inset: 0; z-index: 0;
  background: url("./bg.png") center / cover no-repeat;
  filter: brightness(0.3) saturate(1.3) contrast(1.05);
}
.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;
}

/* ---------- 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: 22px; height: 22px; }
.cursor::before, .cursor::after {
  content: ""; position: absolute;
  background: #9fd0ff;
  box-shadow: 0 0 8px rgba(92, 148, 255, 0.9);
}
.cursor::before { left: 50%; top: 0; width: 2px; height: 100%; transform: translateX(-50%); }
.cursor::after { top: 50%; left: 0; height: 2px; width: 100%; transform: translateY(-50%); }
.cursor-ring {
  width: 36px; height: 36px;
  border: 1px solid rgba(159, 208, 255, 0.6);
  border-radius: 50%;
}

/* ---------- card ---------- */
.wrap {
  position: relative; z-index: 3;
  min-height: 100vh;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  padding: 48px 16px 24px;
  perspective: 1000px;
}
.card {
  position: relative;
  width: 100%; max-width: 420px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 22px;
  padding: 38px 30px 26px;
  text-align: center;
  backdrop-filter: blur(12px);
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.6), 0 0 60px rgba(47, 123, 255, 0.08);
  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, var(--blue)), #9fd0ff, #e04863, var(--ring, var(--blue)));
  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: #9fd0ff;
  background: rgba(47, 123, 255, 0.1);
  border: 1px solid rgba(47, 123, 255, 0.4);
  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 var(--line);
  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(47, 123, 255, 0.12);
  border-color: rgba(47, 123, 255, 0.5);
  box-shadow: 0 8px 28px rgba(47, 123, 255, 0.25);
}
.link svg { flex: none; }
.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: #2f7bff;
  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; }

/* ---------- private admin analytics ---------- */
.admin {
  position: fixed; left: 50%; bottom: 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; }
}
