:root {
  --background: 0 0% 3%;
  --foreground: 48 100% 94%;
  --primary: 45 100% 58%;
  --secondary: 190 100% 55%;
  --muted: 45 18% 66%;
  --destructive: 0 92% 62%;
  --border: 45 100% 28%;
  --card: 224 38% 9%;
  --shadow-sm: 0 8px 22px hsl(45 100% 50% / 0.12);
  --shadow-md: 0 18px 44px hsl(45 100% 50% / 0.18);
  --shadow-lg: 0 28px 80px hsl(45 100% 50% / 0.25), inset 0 0 36px hsl(45 100% 58% / 0.10);
  --transition-fast: 150ms ease;
  --transition-smooth: 320ms cubic-bezier(.2,.8,.2,1);
  --radius-sm: 14px;
  --radius-md: 22px;
  --radius-lg: 32px;
}

.dark {
  --background: 0 0% 2%;
  --foreground: 48 100% 95%;
  --primary: 45 100% 58%;
  --secondary: 184 100% 52%;
  --muted: 44 19% 67%;
  --destructive: 0 88% 62%;
  --border: 44 100% 30%;
  --card: 228 44% 8%;
}

* { box-sizing: border-box; }
html { min-height: 100%; background: hsl(var(--background)); }
body {
  margin: 0;
  min-height: 100%;
  background: hsl(var(--background));
  color: hsl(var(--foreground));
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  -webkit-tap-highlight-color: transparent;
}
button, a { touch-action: manipulation; }

.card-shell {
  border: 1px solid hsl(var(--primary) / 0.45);
  border-radius: var(--radius-lg);
  background: linear-gradient(145deg, hsl(var(--card) / 0.92), hsl(0 0% 0% / 0.96));
  box-shadow: var(--shadow-lg);
}

.profile-card::before {
  content: "";
  position: absolute;
  inset: -2px;
  background: conic-gradient(from 0deg, transparent, hsl(var(--primary) / 0.85), hsl(var(--secondary) / 0.35), transparent, hsl(var(--primary) / 0.7));
  animation: spinAura 5s linear infinite;
  opacity: 0.7;
}
.profile-card::after {
  content: "";
  position: absolute;
  inset: 2px;
  border-radius: calc(var(--radius-lg) - 2px);
  background: hsl(var(--background) / 0.76);
}
.profile-card > * { position: relative; z-index: 1; }
.profile-card.is-active .avatar-frame { box-shadow: 0 0 42px hsl(var(--primary) / 0.54), inset 0 -18px 32px hsl(var(--primary) / 0.12); }

.rank-badge {
  color: hsl(var(--primary));
  font-size: clamp(2.25rem, 13vw, 4.6rem);
  line-height: .86;
  font-weight: 1000;
  letter-spacing: -0.08em;
  text-shadow: 0 0 10px hsl(var(--primary) / 0.85), 0 0 28px hsl(var(--primary) / 0.52), 0 5px 0 hsl(32 100% 22%);
  transform: skew(-7deg);
}

.avatar-stage { position: relative; overflow: hidden; }
.avatar-stage::before {
  content: "";
  position: absolute;
  inset: 16px;
  border-radius: 999px;
  border: 1px dashed hsl(var(--primary) / 0.32);
  animation: pulseRing 1.9s ease-in-out infinite;
}
.avatar-stage::after {
  content: "PROFILE PICTURE";
  position: absolute;
  left: 22px;
  top: 18px;
  border-radius: 999px;
  border: 1px solid hsl(var(--primary) / 0.28);
  background: hsl(0 0% 0% / 0.52);
  padding: 6px 10px;
  color: hsl(var(--primary));
  font-size: 10px;
  font-weight: 1000;
  letter-spacing: .18em;
}
.avatar-frame { position: relative; overflow: hidden; transition: var(--transition-smooth); }
.avatar-frame::after {
  content: "";
  position: absolute;
  inset: 12px;
  border-radius: inherit;
  background: radial-gradient(circle at 50% 88%, hsl(var(--primary) / 0.24), transparent 28%);
  pointer-events: none;
}

.student-wrap {
  width: 218px;
  height: 296px;
  animation: idleBreath 2.35s ease-in-out infinite;
  transform-origin: 50% 100%;
  z-index: 1;
}
.student-svg { width: 100%; height: 100%; overflow: visible; filter: drop-shadow(0 22px 18px hsl(0 0% 0% / 0.55)); }
.walk-active { animation: walkForward 2.25s cubic-bezier(.2,.7,.1,1) both, idleBreath .9s ease-in-out infinite; }
.walk-active .left-leg { animation: legSwing .72s ease-in-out infinite alternate; transform-origin: 91px 168px; }
.walk-active .right-leg { animation: legSwing .72s ease-in-out infinite alternate-reverse; transform-origin: 125px 168px; }
.walk-active .left-arm { animation: armSwing .72s ease-in-out infinite alternate-reverse; transform-origin: 82px 100px; }
.walk-active .right-arm { animation: armSwing .72s ease-in-out infinite alternate; transform-origin: 146px 100px; }
.walk-active .backpack { animation: bagSwing .72s ease-in-out infinite alternate; transform-origin: 78px 112px; }
.walk-active .shoe { filter: drop-shadow(0 0 8px #ffd24d) drop-shadow(0 0 15px #ffb000); }
.walk-active .smile { animation: bigSmile .7s ease-in-out infinite alternate; }
.walk-active .foot-aura { animation: footAura .7s ease-in-out infinite alternate; }

.xp-track {
  height: 18px;
  overflow: hidden;
  border-radius: 999px;
  border: 1px solid hsl(var(--primary) / 0.45);
  background: hsl(0 0% 0% / 0.76);
  box-shadow: inset 0 0 14px hsl(var(--primary) / 0.12);
}
.xp-fill {
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #ff9d00, #ffe45c, #ffffff);
  box-shadow: 0 0 18px hsl(var(--primary) / 0.8);
  animation: xpShine 1.9s ease-in-out infinite;
}

.stat-tile {
  border-radius: var(--radius-md);
  border: 1px solid hsl(var(--primary) / 0.22);
  background: linear-gradient(180deg, hsl(var(--primary) / 0.12), hsl(var(--card) / 0.58));
  padding: 14px 10px;
  text-align: center;
  box-shadow: var(--shadow-sm);
}
.verified-dot {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 23px;
  height: 23px;
  flex: 0 0 auto;
  border-radius: 999px;
  background: hsl(var(--secondary));
  color: black;
  font-size: 14px;
  font-weight: 1000;
  box-shadow: 0 0 15px hsl(var(--secondary) / 0.58);
}

.particles span {
  position: absolute;
  width: 4px;
  height: 4px;
  left: calc((var(--i) * 43px) % 100%);
  top: calc((var(--i) * 67px) % 100%);
  border-radius: 999px;
  background: hsl(var(--primary));
  box-shadow: 0 0 12px hsl(var(--primary));
  opacity: 0.35;
  animation: floatParticle calc(2.6s + (var(--i) * .12s)) ease-in-out infinite alternate;
}

.grid-glow {
  background-image: linear-gradient(hsl(var(--primary) / 0.08) 1px, transparent 1px), linear-gradient(90deg, hsl(var(--primary) / 0.08) 1px, transparent 1px);
  background-size: 34px 34px;
  mask-image: radial-gradient(circle at center, black, transparent 72%);
}
.skeleton {
  background: linear-gradient(90deg, hsl(var(--card)), hsl(var(--primary) / 0.14), hsl(var(--card)));
  background-size: 220% 100%;
  animation: skeletonMove 1.2s ease-in-out infinite;
}

@keyframes spinAura { to { transform: rotate(360deg); } }
@keyframes pulseRing { 50% { transform: scale(1.04); opacity: .55; } }
@keyframes idleBreath { 0%,100% { transform: translateY(0) scaleX(1) scaleY(1); } 50% { transform: translateY(-4px) scaleX(1.012) scaleY(0.992); } }
@keyframes walkForward { 0% { transform: translateY(4px) scale(.90); } 48% { transform: translateY(-5px) scale(1.08); } 100% { transform: translateY(0) scale(1); } }
@keyframes legSwing { from { transform: rotate(10deg) translateX(-2px); } to { transform: rotate(-14deg) translateX(2px); } }
@keyframes armSwing { from { transform: rotate(8deg); } to { transform: rotate(-11deg); } }
@keyframes bagSwing { from { transform: rotate(-4deg) translateX(-2px); } to { transform: rotate(7deg) translateX(2px); } }
@keyframes bigSmile { to { d: path("M103 83 Q117 96 133 82"); } }
@keyframes footAura { to { opacity: .55; transform: scaleX(1.14); } }
@keyframes xpShine { 50% { filter: brightness(1.28); } }
@keyframes floatParticle { to { transform: translateY(-22px) translateX(12px) scale(1.6); opacity: .88; } }
@keyframes skeletonMove { to { background-position: -220% 0; } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.001ms !important; animation-iteration-count: 1 !important; scroll-behavior: auto !important; }
}
