/* Animated glow look */
:root{
  --bg-1: #0a0f1f;
  --bg-2: #111a33;
  --bg-3: #0d1226;
  --fg: #e9f1ff;
  --muted: #9db1ff;
  --accent-1: #7aa2ff;
  --accent-2: #b07aff;
  --accent-3: #7affd1;
  --danger: #ff6b6b;
  --card: rgba(17, 26, 51, 0.6);
  --border: rgba(122, 162, 255, 0.25);
  --shadow: 0 0 20px rgba(122,162,255,0.2), 0 0 40px rgba(176,122,255,0.15);
}

* { box-sizing: border-box; }

html, body {
  height: 100%;
  margin: 0;
  background: linear-gradient(135deg, var(--bg-1), var(--bg-2));
  color: var(--fg);
  font-family: Inter, system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
  letter-spacing: 0.2px;
  overflow-x: hidden;
}

/* Canvas sits behind content */
#bg-canvas{
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
  z-index: 0;
  pointer-events: none;
}

.glow-text { text-shadow: 0 0 10px rgba(186, 166, 255, 0.5), 0 0 30px rgba(122, 162, 255, 0.35); }

/* Animated aurora gradient overlay */
body::before{
  content: "";
  position: fixed;
  inset: -20%;
  background: radial-gradient(50% 40% at 10% 20%, rgba(122,162,255,0.2), transparent 60%),
              radial-gradient(60% 50% at 80% 80%, rgba(176,122,255,0.2), transparent 60%),
              radial-gradient(40% 40% at 50% 50%, rgba(122,255,209,0.15), transparent 60%);
  filter: blur(40px);
  animation: drift 22s ease-in-out infinite alternate;
  z-index: 0;
}
@keyframes drift{
  0%{ transform: translate3d(-4%, -2%, 0) rotate(0.5deg); }
  100%{ transform: translate3d(4%, 2%, 0) rotate(-0.5deg); }
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  position: sticky;
  top: 0;
  z-index: 3;
  background: linear-gradient(180deg, rgba(13,18,38,0.85), rgba(13,18,38,0.25) 70%, transparent);
  backdrop-filter: blur(6px);
  border-bottom: 1px solid var(--border);
}

.logo {
  margin: 0;
  font-family: Orbitron, Inter, sans-serif;
  font-weight: 800;
  letter-spacing: 1px;
  font-size: 24px;
}

.logo .by { font-weight: 600; color: var(--muted); }

.actions .btn { margin-left: 8px; }

.grid {
  display: grid;
  grid-template-columns: 1.2fr 1fr;
  grid-template-areas:
    "stats shop"
    "forge shop"
    "achievements about";
  gap: 16px;
  padding: 20px;
  max-width: 1200px;
  margin: 0 auto;
  position: relative;
  z-index: 1;
}

.panel {
  background: linear-gradient(180deg, rgba(17,26,51,0.7), rgba(17,26,51,0.35));
  border: 1px solid var(--border);
  border-radius: 16px;
  box-shadow: var(--shadow);
  padding: 16px;
  transform: translateZ(0);
}

.stats { grid-area: stats; }
.forge { grid-area: forge; }
.shop { grid-area: shop; }
.achievements { grid-area: achievements; }
.about { grid-area: about; }

.panel-title {
  margin: 0 0 10px 0;
  font-family: Orbitron, Inter, sans-serif;
  font-weight: 700;
  letter-spacing: 0.5px;
}

.stat {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  margin-bottom: 10px;
}
.stat .label { color: var(--muted); }
.stat .value { font-weight: 800; font-size: 20px; }

.bar {
  grid-column: 1 / span 2;
  height: 8px;
  background: rgba(255,255,255,0.06);
  border-radius: 999px;
  overflow: hidden;
  border: 1px solid rgba(255,255,255,0.08);
  position: relative;
}
.fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--accent-1), var(--accent-2), var(--accent-3));
  box-shadow: 0 0 14px rgba(122,162,255,0.6);
}
/* Sparkle specks on the XP bar */
.bar.sparkle::after{
  content: "";
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 30%;
  background: radial-gradient(circle at 20% 50%, rgba(255,255,255,0.5), transparent 50%),
              radial-gradient(circle at 60% 50%, rgba(255,255,255,0.35), transparent 50%);
  filter: blur(2px);
  mix-blend-mode: screen;
  animation: sweep 2.2s linear infinite;
}
@keyframes sweep{
  0%{ transform: translateX(-30%); opacity: 0.6; }
  100%{ transform: translateX(330%); opacity: 0.4; }
}

.forge .forge-wrap{
  display: grid;
  place-items: center;
  padding: 10px 0 20px;
  perspective: 800px;
}
/* Spinning rings behind the button */
.ring{
  position: absolute;
  width: 320px; height: 320px;
  border-radius: 50%;
  filter: blur(1px);
  pointer-events: none;
  z-index: 0;
}
.ring::before{
  content: "";
  position: absolute; inset: 0;
  border-radius: 50%;
  background: conic-gradient(from 0deg, rgba(122,162,255,0.0), rgba(122,162,255,0.35), rgba(176,122,255,0.0), rgba(122,255,209,0.35), rgba(122,162,255,0.0));
  mask: radial-gradient(circle, transparent 58%, #000 60%);
}
.ring-a{ animation: spin 14s linear infinite; }
.ring-b{ transform: scale(0.8) rotate(40deg); animation: spin 18s linear infinite reverse; opacity: 0.8; }
@keyframes spin{ to{ transform: rotate(360deg); } }

.forge-btn {
  width: 240px;
  height: 240px;
  border-radius: 50%;
  background: radial-gradient(circle at 50% 30%, rgba(122,162,255,0.25), rgba(176,122,255,0.22) 40%, rgba(122,255,209,0.08) 70%, rgba(0,0,0,0.4) 72%),
              conic-gradient(from 0deg, rgba(122,162,255,0.2), rgba(176,122,255,0.2), rgba(122,255,209,0.2), rgba(122,162,255,0.2));
  color: var(--fg);
  border: 2px solid rgba(186,166,255,0.5);
  box-shadow: 0 0 25px rgba(122,162,255,0.6), inset 0 0 30px rgba(122,162,255,0.35);
  cursor: pointer;
  position: relative;
  overflow: hidden;
  transform-style: preserve-3d;
  transition: transform 120ms ease;
  z-index: 1;
  animation: breathe 3.5s ease-in-out infinite;
}
@keyframes breathe{
  0%,100%{ box-shadow: 0 0 25px rgba(122,162,255,0.6), inset 0 0 30px rgba(122,162,255,0.35); }
  50%{ box-shadow: 0 0 45px rgba(176,122,255,0.7), inset 0 0 42px rgba(176,122,255,0.45); }
}
.forge-btn .big { display: block; font-family: Orbitron, Inter, sans-serif; font-size: 36px; font-weight: 800; letter-spacing: 2px; }
.forge-btn .small { display: block; color: var(--muted); font-size: 12px; }

#burst-layer { position: relative; width: 0; height: 0; }

.ripple {
  position: absolute;
  border-radius: 50%;
  pointer-events: none;
  transform: translate(-50%, -50%);
  width: 10px;
  height: 10px;
  background: radial-gradient(circle, rgba(255,255,255,0.9), rgba(122,162,255,0.35) 40%, transparent 70%);
  animation: ripple 700ms ease-out forwards;
  mix-blend-mode: screen;
}
@keyframes ripple {
  to { opacity: 0; transform: translate(-50%, -50%) scale(12); }
}

.info-row{ display: flex; gap: 10px; justify-content: center; }
.info-pill{
  border: 1px solid var(--border);
  padding: 6px 10px;
  border-radius: 999px;
  background: rgba(17,26,51,0.45);
  box-shadow: var(--shadow);
}

/* Shop hover effect */
.card{
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 12px;
  box-shadow: var(--shadow);
  transform: translateZ(0);
  transition: transform 140ms ease, box-shadow 140ms ease;
}
.card:hover{ transform: translateY(-2px) rotateX(1deg); box-shadow: 0 10px 30px rgba(122,162,255,0.25); }

.card h3{ margin: 0 0 6px 0; font-family: Orbitron, Inter, sans-serif; font-size: 16px; }
.card .desc{ color: var(--muted); min-height: 38px; }

.card .row{
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 10px;
}

.btn{
  padding: 8px 12px;
  border: 1px solid var(--border);
  background: linear-gradient(180deg, rgba(13,18,38,0.9), rgba(13,18,38,0.6));
  color: var(--fg);
  border-radius: 10px;
  cursor: pointer;
  font-weight: 700;
  letter-spacing: 0.3px;
  box-shadow: var(--shadow);
  transition: transform 0.06s ease, filter 0.2s ease;
}
.btn:active{ transform: scale(0.98); }
.btn[disabled]{ opacity: 0.5; filter: grayscale(0.2); cursor: not-allowed; }
.btn-danger{ border-color: rgba(255,107,107,0.45); }

.shop-list{
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 12px;
}

.achv-list{
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 10px;
}
.achv{
  padding: 10px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: linear-gradient(180deg, rgba(17,26,51,0.6), rgba(17,26,51,0.35));
  box-shadow: var(--shadow);
  display: flex;
  align-items: center;
  gap: 10px;
}
.badge{
  width: 28px; height: 28px; border-radius: 50%;
  background: radial-gradient(circle at 35% 25%, #fff, var(--accent-1) 40%, transparent 70%);
  box-shadow: 0 0 20px rgba(122,162,255,0.6);
  flex: 0 0 auto;
}
.achv .name{ font-weight: 700; }
.achv .meta{ color: var(--muted); font-size: 12px; }

.footer{
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 20px 40px;
  color: var(--muted);
}

@media (max-width: 900px){
  .grid {
    grid-template-columns: 1fr;
    grid-template-areas:
      "stats"
      "forge"
      "shop"
      "achievements"
      "about";
  }
}
