html, body{
  margin:0;
  min-height:100%;
}

body{
  margin:0;
  font-family:'Poppins', sans-serif;
  background:linear-gradient(135deg,#0b0f2a,#2b1e5a);
  color:white;
  transition:
    background 0.35s ease,
    color 0.35s ease;
  min-height:100vh;
  overflow-x:hidden;
  overflow-y:auto;
}

.layout{
  display:flex;
  min-height:100vh;
}

/* SIDEBAR */
.sidebar{
  width:240px;
  background:#1a1140;
  min-height:100vh;
  display:flex;
  flex-direction:column;
  justify-content:space-between;
  padding:20px;
  box-sizing:border-box;
  transition:background 0.35s ease;
}

.sidebar-toggle{
  display:none;
  width:46px;
  height:46px;
  border:none;
  border-radius:14px;
  background:rgba(255,255,255,0.08);
  cursor:pointer;
  align-items:center;
  justify-content:center;
  flex-direction:column;
  gap:5px;
  padding:0;
  flex-shrink:0;
}

.sidebar-toggle span{
  width:20px;
  height:2px;
  background:#fff;
  border-radius:999px;
  display:block;
  transition:transform 0.25s ease, opacity 0.25s ease, background 0.35s ease;
}

.top-section{
  display:flex;
  flex-direction:column;
  gap:30px;
}

.logo-link{
  text-decoration:none;
  display:inline-block;
}

.logo{
  font-family:'Press Start 2P', cursive;
  font-size:14px;
  line-height:1.5;
  background:linear-gradient(90deg,#ff982e 0%,#ff7c2e 28%,#ff4d95 68%,#ff4fb8 100%);
  -webkit-background-clip:text;
  background-clip:text;
  -webkit-text-fill-color:transparent;
  margin:0;
  cursor:pointer;
  transition:transform 0.25s ease;
  filter:
    drop-shadow(0 0 6px rgba(255,138,42,0.45))
    drop-shadow(0 0 14px rgba(255,46,151,0.28));
}

.logo-link:hover .logo{
  transform:scale(1.03);
}

.menu{
  display:flex;
  flex-direction:column;
  gap:30px;
  padding-top:14px;
}

.menu a{
  color:white;
  text-decoration:none;
  opacity:0.8;
  font-size:14px;
  line-height:1.2;
  padding:2px 0;
  transition:
    0.25s ease,
    color 0.35s ease;
}

.menu a:hover,
.menu a.active-link{
  opacity:1;
  transform:translateX(5px);
}

.bottom-section{
  padding-top:20px;
  border-top:1px solid rgba(255,255,255,0.1);
}

.logout-btn{
  width:100%;
  padding:12px;
  border:none;
  border-radius:12px;
  background:#ff2e97;
  color:white;
  cursor:pointer;
  font-weight:600;
  transition:
    transform 0.2s ease,
    box-shadow 0.25s ease,
    filter 0.25s ease;
}

.logout-btn:hover{
  transform:translateY(-2px);
  box-shadow:0 10px 22px rgba(255,46,151,0.22);
  filter:brightness(1.05);
}

/* MAIN */
.main{
  flex:1;
  padding:24px;
  box-sizing:border-box;
  min-height:100vh;
  display:flex;
  flex-direction:column;
  gap:22px;
  overflow-y:auto;
}

.main::-webkit-scrollbar{
  width:8px;
}

.main::-webkit-scrollbar-thumb{
  background:rgba(255,255,255,0.18);
  border-radius:999px;
}

/* TOPBAR */
.topbar{
  display:flex;
  justify-content:space-between;
  align-items:flex-start;
  gap:20px;
  animation:fadeSlideUp 0.55s ease both;
}

.topbar-title{
  display:flex;
  align-items:flex-start;
  gap:12px;
}

.page-title{
  margin:0;
  font-size:32px;
}

.page-subtitle{
  margin:8px 0 0 0;
  opacity:0.82;
  font-size:14px;
}

.user-top{
  display:flex;
  align-items:center;
  gap:10px;
  background:rgba(255,255,255,0.06);
  padding:10px 14px;
  border-radius:14px;
  transition:
    background 0.35s ease,
    box-shadow 0.35s ease,
    transform 0.25s ease;
}

.user-top:hover{
  transform:translateY(-2px);
}

.user-top span{
  font-weight:600;
}

.user-top img{
  width:38px;
  height:38px;
  border-radius:50%;
  object-fit:cover;
}

/* OVERVIEW */
.overview-grid{
  display:grid;
  grid-template-columns:repeat(3,1fr);
  gap:20px;
}

.overview-card{
  background:#3a2575;
  padding:20px;
  border-radius:18px;
  min-height:130px;
  box-sizing:border-box;
  display:flex;
  flex-direction:column;
  justify-content:center;
  transition:
    transform 0.28s ease,
    box-shadow 0.3s ease,
    background 0.35s ease,
    color 0.35s ease;
  animation:fadeSlideUp 0.55s ease both;
}

.overview-card:nth-child(1){ animation-delay:0.05s; }
.overview-card:nth-child(2){ animation-delay:0.14s; }
.overview-card:nth-child(3){ animation-delay:0.23s; }

.overview-card:hover{
  transform:translateY(-4px);
  box-shadow:0 14px 28px rgba(0,0,0,0.16);
}

.overview-card h3{
  margin:0 0 10px 0;
  font-size:16px;
  font-weight:600;
}

.overview-card p{
  margin:0;
  font-size:28px;
  font-weight:700;
}

.progress-bar{
  height:12px;
  background:rgba(255,255,255,0.18);
  border-radius:10px;
  overflow:hidden;
  margin-top:8px;
  position:relative;
}

#progressFill{
  width:0%;
  height:100%;
  background:linear-gradient(90deg,#00e5ff,#00ffcc);
  transition:width 1s cubic-bezier(0.22, 1, 0.36, 1);
  position:relative;
}

#progressFill::after{
  content:"";
  position:absolute;
  top:0;
  right:0;
  width:38px;
  height:100%;
  background:linear-gradient(90deg,transparent,rgba(255,255,255,0.42));
  filter:blur(2px);
  opacity:0.7;
}

#progressPercent{
  margin-top:10px;
  font-size:14px;
  opacity:0.85;
}

.info-note{
  background:rgba(255,255,255,0.06);
  padding:14px 16px;
  border-radius:14px;
  animation:fadeSlideUp 0.7s ease both;
  transition:
    background 0.35s ease,
    box-shadow 0.35s ease,
    transform 0.25s ease;
}

.info-note:hover{
  transform:translateY(-2px);
}

.info-note p{
  margin:0;
  font-size:14px;
  opacity:0.9;
}

/* BADGES GRID */
.badges-grid{
  display:grid;
  grid-template-columns:repeat(auto-fit,minmax(230px,1fr));
  gap:20px;
}

/* BADGE CARD */
.badge-card{
  position:relative;
  background:#3a2575;
  border-radius:18px;
  padding:22px 18px;
  min-height:285px;
  box-sizing:border-box;
  text-align:center;
  display:flex;
  flex-direction:column;
  align-items:center;
  justify-content:flex-start;
  gap:10px;
  transition:
    transform 0.25s ease,
    box-shadow 0.28s ease,
    background 0.35s ease,
    color 0.35s ease,
    filter 0.28s ease,
    opacity 0.28s ease;
  cursor:pointer;
  border:none;
  color:inherit;
  animation:cardPopIn 0.6s ease both;
}

.badge-card:hover{
  transform:translateY(-5px) scale(1.02);
  box-shadow:0 16px 28px rgba(0,0,0,0.18);
}

.badge-card:active{
  transform:scale(0.98);
}

.badge-card.unlocked{
  box-shadow:0 0 20px rgba(0,229,255,0.14);
}

.badge-card.unlocked:hover{
  box-shadow:0 0 26px rgba(0,229,255,0.2), 0 16px 28px rgba(0,0,0,0.18);
}

.badge-card.locked{
  opacity:0.45;
  filter:blur(1px) saturate(0.85);
}

.badge-state{
  position:absolute;
  top:14px;
  right:14px;
  padding:6px 10px;
  border-radius:999px;
  font-size:12px;
  font-weight:600;
  background:#00c16a;
  box-shadow:0 0 12px rgba(0,193,106,0.22);
}

.badge-card.locked .badge-state{
  background:#666;
  box-shadow:none;
}

.badge-icon{
  font-size:50px;
  margin-bottom:2px;
  margin-top:6px;
  transition:transform 0.25s ease;
}

.badge-card:hover .badge-icon{
  transform:scale(1.08);
}

.badge-name{
  font-size:20px;
  font-weight:700;
  line-height:1.2;
}

.badge-desc{
  font-size:13px;
  line-height:1.5;
  opacity:0.84;
  min-height:44px;
}

.badge-xp{
  margin-top:4px;
  font-size:13px;
  font-weight:600;
  padding:6px 12px;
  border-radius:999px;
  background:rgba(255,255,255,0.08);
  animation:badgeGlow 2.2s ease-in-out infinite;
}

.badge-requirement{
  margin-top:2px;
  font-size:12px;
  line-height:1.4;
  opacity:0.88;
  min-height:34px;
}

.badge-progress-wrap{
  width:100%;
  margin-top:auto;
}

.badge-progress-bar{
  height:9px;
  width:100%;
  background:rgba(255,255,255,0.15);
  border-radius:999px;
  overflow:hidden;
  margin-top:8px;
  position:relative;
}

.badge-progress-fill{
  height:100%;
  width:0%;
  background:linear-gradient(90deg,#00e5ff,#00ffcc);
  transition:width 1s cubic-bezier(0.22, 1, 0.36, 1);
  position:relative;
}

.badge-progress-fill::after{
  content:"";
  position:absolute;
  top:0;
  right:0;
  width:24px;
  height:100%;
  background:linear-gradient(90deg,transparent,rgba(255,255,255,0.42));
  filter:blur(2px);
  opacity:0.7;
}

.badge-progress-text{
  display:block;
  margin-top:8px;
  font-size:12px;
  opacity:0.88;
}

/* MODAL */
.badge-modal{
  position:fixed;
  inset:0;
  background:rgba(0,0,0,0.65);
  display:flex;
  align-items:center;
  justify-content:center;
  opacity:0;
  pointer-events:none;
  transition:0.25s ease;
  z-index:2000;
}

.badge-modal.active{
  opacity:1;
  pointer-events:auto;
}

.badge-modal-content{
  position:relative;
  width:min(420px, 90vw);
  background:#3a2575;
  border-radius:22px;
  padding:34px 24px 28px;
  text-align:center;
  box-shadow:0 0 30px rgba(0,0,0,0.3);
  animation:modalPopIn 0.25s ease;
  transition:
    background 0.35s ease,
    color 0.35s ease,
    box-shadow 0.35s ease;
}

.close-btn{
  position:absolute;
  top:14px;
  right:14px;
  border:none;
  background:transparent;
  color:white;
  font-size:18px;
  cursor:pointer;
}

.modal-icon{
  font-size:78px;
  margin-bottom:8px;
  animation:floatBadge 2.4s ease-in-out infinite;
}

#modalTitle{
  margin:0 0 10px;
  font-size:28px;
}

#modalDesc{
  margin:0 0 14px;
  font-size:14px;
  line-height:1.6;
  opacity:0.9;
}

.modal-detail-box{
  background:rgba(255,255,255,0.08);
  border-radius:16px;
  padding:14px 16px;
  margin:14px 0;
  text-align:left;
  transition:background 0.35s ease;
}

.modal-detail-box p{
  margin:8px 0;
  font-size:13px;
  line-height:1.5;
}

.modal-xp{
  display:inline-block;
  margin-bottom:12px;
  padding:8px 14px;
  border-radius:999px;
  background:rgba(255,255,255,0.1);
  font-size:14px;
  font-weight:600;
}

.modal-state{
  font-size:13px;
  font-weight:700;
  color:#00ffcc;
}

.modal-state.locked{
  color:#ff9f43;
}

/* POPUP */
.popup{
  position:fixed;
  inset:0;
  background:rgba(0,0,0,0.65);
  display:flex;
  justify-content:center;
  align-items:center;
  opacity:0;
  pointer-events:none;
  transition:0.25s;
  z-index:2200;
}

.popup.active{
  opacity:1;
  pointer-events:auto;
}

.popup-box{
  width:360px;
  max-width:90%;
  background:#1a1140;
  border-radius:18px;
  padding:24px;
  box-shadow:0 0 35px rgba(255,46,151,0.45);
  text-align:center;
  transition:
    background 0.35s ease,
    color 0.35s ease,
    box-shadow 0.35s ease;
}

.popup-box h3{
  margin:0 0 12px 0;
}

.popup-box p{
  margin:0;
  line-height:1.6;
  font-size:14px;
  opacity:0.95;
}

.popup-actions{
  display:flex;
  flex-direction:column;
  gap:10px;
  margin-top:18px;
}

.popup-actions button{
  border:none;
  border-radius:12px;
  padding:12px;
  cursor:pointer;
  font-weight:600;
  background:#ff2e97;
  color:white;
}

.popup-actions .secondary-btn{
  background:transparent;
  border:2px solid #00e5ff;
  color:#00e5ff;
}

/* CONFETTI */
.confetti-container{
  pointer-events:none;
  position:fixed;
  inset:0;
  overflow:hidden;
  z-index:2100;
}

.confetti-piece{
  position:absolute;
  top:-20px;
  width:10px;
  height:18px;
  opacity:0.9;
  animation:fall linear forwards;
}

/* THEME BUTTON */
.theme-toggle{
  position:fixed;
  bottom:20px;
  right:20px;
  width:55px;
  height:55px;
  border:none;
  border-radius:50%;
  display:flex;
  align-items:center;
  justify-content:center;
  font-size:20px;
  cursor:pointer;
  background:linear-gradient(135deg,#00e5ff,#00ffcc);
  color:#000;
  box-shadow:0 0 15px #00e5ff;
  transition:
    transform 0.28s ease,
    box-shadow 0.35s ease,
    background 0.35s ease,
    color 0.35s ease;
  z-index:1000;
}

.theme-toggle:hover{
  transform:scale(1.1) rotate(10deg);
  box-shadow:0 0 24px rgba(0,229,255,0.45);
}

/* ANIMATIONS */
@keyframes fadeSlideUp{
  from{
    opacity:0;
    transform:translateY(18px);
  }
  to{
    opacity:1;
    transform:translateY(0);
  }
}

@keyframes cardPopIn{
  from{
    opacity:0;
    transform:translateY(18px) scale(0.97);
  }
  to{
    opacity:1;
    transform:translateY(0) scale(1);
  }
}

@keyframes modalPopIn{
  from{
    transform:scale(0.78);
    opacity:0;
  }
  to{
    transform:scale(1);
    opacity:1;
  }
}

@keyframes fall{
  to{
    transform:translateY(110vh) rotate(720deg);
    opacity:0.9;
  }
}

@keyframes badgeGlow{
  0%,100%{
    box-shadow:0 0 12px rgba(0,229,255,0.12);
  }
  50%{
    box-shadow:0 0 22px rgba(0,229,255,0.22);
  }
}

@keyframes floatBadge{
  0%,100%{
    transform:translateY(0);
  }
  50%{
    transform:translateY(-4px);
  }
}

/* FULLSCREEN COMPLETION SCREEN */
.completion-overlay{
  position:fixed;
  inset:0;
  background:radial-gradient(circle at center, rgba(255,46,151,0.22), rgba(10,14,35,0.96) 55%);
  display:flex;
  align-items:center;
  justify-content:center;
  opacity:0;
  pointer-events:none;
  transition:opacity 0.35s ease;
  z-index:5000;
  backdrop-filter:blur(8px);
}

.completion-overlay.active{
  opacity:1;
  pointer-events:auto;
}

.completion-content{
  position:relative;
  width:min(680px, 92vw);
  padding:44px 28px 34px;
  border-radius:28px;
  text-align:center;
  background:linear-gradient(135deg, rgba(58,37,117,0.96), rgba(25,17,64,0.96));
  border:1px solid rgba(255,255,255,0.12);
  box-shadow:
    0 0 40px rgba(255,46,151,0.22),
    0 0 90px rgba(0,229,255,0.12);
  overflow:hidden;
  animation:completionPopIn 0.55s cubic-bezier(0.22, 1, 0.36, 1);
}

.completion-glow{
  position:absolute;
  width:260px;
  height:260px;
  left:50%;
  top:50%;
  transform:translate(-50%, -50%);
  background:radial-gradient(circle, rgba(0,229,255,0.20), rgba(255,46,151,0.08), transparent 70%);
  filter:blur(10px);
  pointer-events:none;
}

.completion-icon{
  position:relative;
  font-size:92px;
  margin-bottom:10px;
  animation:completionFloat 2.3s ease-in-out infinite;
}

.completion-title{
  position:relative;
  margin:0;
  font-size:clamp(30px, 5vw, 52px);
  line-height:1.1;
  letter-spacing:1px;
  font-weight:700;
  text-shadow:0 0 18px rgba(255,255,255,0.12);
}

.completion-text{
  position:relative;
  margin:16px auto 0;
  max-width:520px;
  font-size:15px;
  line-height:1.7;
  opacity:0.92;
}

.completion-badge{
  position:relative;
  display:inline-block;
  margin-top:20px;
  padding:10px 18px;
  border-radius:999px;
  background:linear-gradient(135deg,#00e5ff,#00ffcc);
  color:#081228;
  font-size:14px;
  font-weight:700;
  box-shadow:0 0 22px rgba(0,229,255,0.20);
}

.completion-close-btn{
  position:relative;
  margin-top:24px;
  border:none;
  border-radius:14px;
  padding:14px 22px;
  background:linear-gradient(135deg,#ff2e97,#ff8c00);
  color:white;
  font-size:15px;
  font-weight:700;
  cursor:pointer;
  transition:transform 0.22s ease, box-shadow 0.28s ease, filter 0.25s ease;
}

.completion-close-btn:hover{
  transform:translateY(-2px) scale(1.02);
  box-shadow:0 14px 28px rgba(255,46,151,0.22);
  filter:brightness(1.05);
}

@keyframes completionPopIn{
  from{
    opacity:0;
    transform:scale(0.82) translateY(16px);
  }
  to{
    opacity:1;
    transform:scale(1) translateY(0);
  }
}

@keyframes completionFloat{
  0%,100%{
    transform:translateY(0);
  }
  50%{
    transform:translateY(-8px);
  }
}

/* COMPLETION SCREEN FX UPGRADE */
.completion-overlay.active{
  animation:overlayZoomPulse 4.2s ease forwards;
}

.completion-overlay.active .completion-content{
  animation:
    completionPopIn 0.55s cubic-bezier(0.22, 1, 0.36, 1),
    completionGlowPulse 2s ease-in-out infinite 0.4s,
    completionSlowZoom 4s ease-out forwards;
}

.completion-overlay.active .completion-title{
  animation:completionTitlePulse 1.8s ease-in-out infinite 0.5s;
}

.completion-overlay.shake .completion-content{
  animation:
    completionPopIn 0.55s cubic-bezier(0.22, 1, 0.36, 1),
    completionShake 0.45s ease-in-out 0s 2,
    completionGlowPulse 2s ease-in-out infinite 0.5s,
    completionSlowZoom 4s ease-out forwards;
}

@keyframes completionShake{
  0%   { transform:translateX(0) scale(1); }
  15%  { transform:translateX(-8px) scale(1.01); }
  30%  { transform:translateX(7px) scale(1.01); }
  45%  { transform:translateX(-6px) scale(1.015); }
  60%  { transform:translateX(5px) scale(1.015); }
  75%  { transform:translateX(-3px) scale(1.01); }
  100% { transform:translateX(0) scale(1); }
}

@keyframes completionGlowPulse{
  0%,100%{
    box-shadow:
      0 0 40px rgba(255,46,151,0.22),
      0 0 90px rgba(0,229,255,0.12);
  }
  50%{
    box-shadow:
      0 0 65px rgba(255,46,151,0.34),
      0 0 130px rgba(0,229,255,0.20);
  }
}

@keyframes completionSlowZoom{
  0%{
    transform:scale(1);
  }
  100%{
    transform:scale(1.035);
  }
}

@keyframes completionTitlePulse{
  0%,100%{
    transform:scale(1);
    text-shadow:0 0 18px rgba(255,255,255,0.12);
  }
  50%{
    transform:scale(1.03);
    text-shadow:
      0 0 24px rgba(255,255,255,0.18),
      0 0 40px rgba(255,46,151,0.16);
  }
}

@keyframes overlayZoomPulse{
  0%{
    backdrop-filter:blur(8px);
  }
  50%{
    backdrop-filter:blur(10px);
  }
  100%{
    backdrop-filter:blur(8px);
  }
}

/* LIGHT MODE */
body.light-mode{
  background:#f4f6fb;
  color:#222;
}

body.light-mode .sidebar{
  background:white;
}

body.light-mode .sidebar-toggle{
  background:rgba(108,76,255,0.1);
}

body.light-mode .sidebar-toggle span{
  background:#1a1140;
}

body.light-mode .menu a{
  color:#222;
}

body.light-mode .overview-card,
body.light-mode .badge-card,
body.light-mode .badge-modal-content{
  background:white;
  color:#222;
  box-shadow:0 5px 15px rgba(0,0,0,0.1);
}

body.light-mode .user-top{
  background:#ffffff;
  box-shadow:0 5px 15px rgba(0,0,0,0.08);
}

body.light-mode .progress-bar,
body.light-mode .badge-progress-bar{
  background:#ddd;
}

body.light-mode .theme-toggle{
  background:linear-gradient(135deg,#ff2e97,#ff8c00);
  color:white;
  box-shadow:0 0 15px rgba(255,46,151,0.35);
}

body.light-mode .close-btn{
  color:#222;
}

body.light-mode .info-note{
  background:#ffffff;
  box-shadow:0 5px 15px rgba(0,0,0,0.08);
}

body.light-mode .popup-box{
  background:white;
  color:#222;
  box-shadow:0 10px 30px rgba(0,0,0,0.15);
}

body.light-mode .popup-actions .secondary-btn{
  color:#0077ff;
  border-color:#0077ff;
}

body.light-mode .modal-detail-box{
  background:#f6f7fc;
}

body.light-mode .badge-card.locked{
  background:#f7f8fc;
}

body.light-mode .completion-overlay{
  background:radial-gradient(circle at center, rgba(255,46,151,0.18), rgba(244,246,251,0.95) 58%);
}

body.light-mode .completion-content{
  background:linear-gradient(135deg, rgba(255,255,255,0.98), rgba(246,247,252,0.98));
  color:#222;
  border:1px solid rgba(0,0,0,0.06);
  box-shadow:
    0 0 30px rgba(255,46,151,0.12),
    0 16px 40px rgba(0,0,0,0.10);
}

body.light-mode .completion-badge{
  background:linear-gradient(135deg,#ff2e97,#ff8c00);
  color:white;
  box-shadow:0 0 18px rgba(255,46,151,0.14);
}

body.light-mode .completion-overlay.active .completion-content{
  animation:
    completionPopIn 0.55s cubic-bezier(0.22, 1, 0.36, 1),
    completionGlowPulseLight 2s ease-in-out infinite 0.4s,
    completionSlowZoom 4s ease-out forwards;
}

body.light-mode .completion-overlay.shake .completion-content{
  animation:
    completionPopIn 0.55s cubic-bezier(0.22, 1, 0.36, 1),
    completionShake 0.45s ease-in-out 0s 2,
    completionGlowPulseLight 2s ease-in-out infinite 0.5s,
    completionSlowZoom 4s ease-out forwards;
}

@keyframes completionGlowPulseLight{
  0%,100%{
    box-shadow:
      0 0 30px rgba(255,46,151,0.12),
      0 16px 40px rgba(0,0,0,0.10);
  }
  50%{
    box-shadow:
      0 0 48px rgba(255,46,151,0.18),
      0 22px 46px rgba(0,0,0,0.12);
  }
}

/* RESPONSIVE */
@media(max-width:1100px){
  .overview-grid{
    grid-template-columns:1fr;
  }
}

@media(max-width:900px){
  .layout{
    flex-direction:column;
    position:relative;
  }

  .sidebar-toggle{
    display:inline-flex;
  }

  .sidebar{
    display:none;
    position:fixed;
    top:84px;
    left:12px;
    right:12px;
    width:auto;
    min-height:auto;
    max-height:calc(100vh - 108px);
    overflow:auto;
    border-radius:22px;
    box-shadow:0 18px 42px rgba(6,8,28,0.4);
    border:1px solid rgba(255,255,255,0.08);
    z-index:1200;
  }

  .layout.mobile-nav-open .sidebar{
    display:flex;
  }

  .layout.mobile-nav-open .sidebar-toggle span:nth-child(1){
    transform:translateY(7px) rotate(45deg);
  }

  .layout.mobile-nav-open .sidebar-toggle span:nth-child(2){
    opacity:0;
  }

  .layout.mobile-nav-open .sidebar-toggle span:nth-child(3){
    transform:translateY(-7px) rotate(-45deg);
  }

  .main{
    padding:20px;
  }

  .topbar{
    flex-direction:row;
    align-items:center;
    justify-content:space-between;
    flex-wrap:nowrap;
  }

  .user-top{
    margin-left:auto;
    align-self:auto;
    flex-shrink:0;
  }
}

@media(max-width:600px){
  .main{
    padding:16px 12px 24px;
  }

  .topbar{
    gap:10px;
  }

  .topbar-title{
    flex:1;
    min-width:0;
  }

  .page-title{
    font-size:28px;
  }

  .page-subtitle{
    display:none;
  }

  .user-top{
    padding:8px 10px;
    gap:8px;
  }

  .user-top span{
    font-size:13px;
    white-space:nowrap;
  }

  .user-top img{
    width:34px;
    height:34px;
  }

  .sidebar{
    top:72px;
    left:10px;
    right:10px;
    padding:18px;
  }

  .menu{
    gap:20px;
    padding-top:8px;
  }
}

/* =========================
   ACHIEVEMENT POPUP (STEAM STYLE)
========================= */
.achievement-popup{
  position:fixed;
  top:20px;
  right:20px;
  background:linear-gradient(135deg,#1a1140,#2b1e5a);
  color:white;
  padding:14px 18px;
  border-radius:14px;
  display:flex;
  align-items:center;
  gap:12px;
  box-shadow:0 0 20px rgba(0,255,200,0.4);
  transform:translateX(120%);
  opacity:0;
  transition:0.4s ease;
  z-index:2000;
}

.achievement-popup.show{
  transform:translateX(0);
  opacity:1;
}

.popup-icon{
  font-size:24px;
}

.popup-text strong{
  display:block;
  font-size:14px;
}

.popup-text p{
  margin:0;
  font-size:12px;
  opacity:0.8;
}

/* LIGHT MODE FIX */
body.light-mode .achievement-popup{
  background:white;
  color:#222;
  box-shadow:0 5px 20px rgba(0,0,0,0.15);
}

/* ===============================
   STACKED ACHIEVEMENT POPUP
================================ */

/* CONTAINER (fixed sa top-right) */
#achievementPopupContainer{
  position: fixed;
  top: 20px;
  right: 20px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  z-index: 9999;
}

/* POPUP CARD */
.achievement-popup{
  /* 🔥 IMPORTANT FIX */
  position: relative;
  top: auto;
  right: auto;
  left: auto;
  bottom: auto;

  background: linear-gradient(135deg, #1a1140, #2b1e5a);
  color: white;
  padding: 14px 18px;
  border-radius: 14px;

  display: flex;
  align-items: center;
  gap: 12px;

  min-width: 220px;

  transform: translateX(120%);
  opacity: 0;

  transition: 0.4s ease;

  box-shadow: 0 0 20px rgba(0,255,200,0.4);
}

/* SHOW ANIMATION */
.achievement-popup.show{
  transform: translateX(0);
  opacity: 1;
}

/* ICON */
.popup-icon{
  font-size: 22px;
}

/* TEXT */
.popup-text strong{
  display: block;
  font-size: 14px;
}

.popup-text p{
  margin: 0;
  font-size: 12px;
  opacity: 0.8;
}

/* LIGHT MODE SUPPORT */
body.light-mode .achievement-popup{
  background: white;
  color: #222;
  box-shadow: 0 5px 20px rgba(0,0,0,0.15);
}
