Skip to content

Commit 9e920bf

Browse files
authored
Fixup levels progress (#251)
1 parent 151b2db commit 9e920bf

File tree

5 files changed

+251
-185
lines changed

5 files changed

+251
-185
lines changed

src/_includes/footer.njk

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -77,11 +77,11 @@
7777
</button>
7878
<button onclick="triggerMagicXP()" class="w-full flex justify-between px-2 py-1.5 bg-gradient-to-r from-purple-600/20 to-blue-600/20 text-purple-400 text-[8px] border border-purple-500/30 rounded hover:from-purple-600/40 hover:to-blue-600/40 transition-all group">
7979
<span>✨ CAST_MAGIC_XP</span>
80-
<span class="group-hover:animate-pulse">+100 XP</span>
80+
<span class="group-hover:animate-pulse">+50 XP</span>
8181
</button>
8282
<button onclick="toggleScreenshotMode()" class="w-full flex justify-between px-2 py-1 bg-white/5 text-slate-400 text-[8px] border border-white/10 rounded">
8383
<span>📸 SCREENSHOT</span>
84-
<span class="opacity-50">5S</span>
84+
<span class="opacity-50">[5 Seconds]</span>
8585
</button>
8686
</div>
8787
<div class="mt-4 pt-4 border-t border-white/10">

src/_includes/header.njk

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@
5151
<div class="flex items-center gap-2">
5252
<span id="level-name" class="text-[9px] md:text-[10px] font-black uppercase tracking-widest text-[var(--text-main)]">Newbie</span>
5353
<span class="text-[8px] font-mono font-bold text-accent bg-accent/10 px-1.5 py-0.5 rounded">
54-
XP: <span id="total-xp-display">0</span>
54+
XP: <span id="total-xp-display">0 / 45</span>
5555
</span>
5656
<span class="text-[8px] md:text-[9px] opacity-60 font-bold bg-black/5 dark:bg-white/10 px-1.5 py-0.5 rounded">
5757
LVL <span id="level-number">0</span>

src/assets/css/style.css

Lines changed: 84 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,10 @@
55
--bg-page: #f0f4f8;
66
--bg-card: #ffffff;
77
--bg-footer: #e2e8f0;
8-
--text-main: #1a202c;
8+
--text-main: #1e293b; /* Default Light */
99
--text-muted: #4a5568;
1010
--border-color: #cbd5e0;
11-
--accent: #2563eb;
11+
--accent: #94a3b8; /* Default */
1212
--accent-light: #eff6ff;
1313
--accent-rgb: 37, 99, 235;
1414
--danger: #dc2626;
@@ -17,9 +17,9 @@
1717

1818
.dark {
1919
--bg-page: #05070a;
20-
--bg-card: #0f172a;
20+
--bg-card: #1e293b;
2121
--bg-footer: #020617;
22-
--text-main: #f1f5f9;
22+
--text-main: #f8fafc;
2323
--text-muted: #94a3b8;
2424
--border-color: #1e293b;
2525
--accent: #38bdf8;
@@ -412,10 +412,6 @@ body[data-level="6"]::after {
412412
pointer-events: none;
413413
opacity: 0.2; /* Very subtle scanlines */
414414
}
415-
#total-xp-display {
416-
display: inline-block;
417-
transition: transform 0.1s ease;
418-
}
419415

420416
/* Added via JS when XP increases */
421417
.xp-pulse {
@@ -463,20 +459,86 @@ body[data-level="6"]::after {
463459
--glow-color: #ef4444; /* Sith Red */
464460
}
465461

466-
/* Force Shadow ripple for the container */
467-
.force-glow::after {
468-
content: "";
462+
/* Override the Tailwind duration-1000 for a better feel */
463+
#level-progress {
464+
transition: width 0.3s cubic-bezier(0.4, 0, 0.2, 1) !important;
465+
}
466+
467+
468+
/* Force Glow for the Badge */
469+
@keyframes force-pulse {
470+
0% { filter: drop-shadow(0 0 2px var(--accent)); transform: scale(1); }
471+
50% { filter: drop-shadow(0 0 15px var(--accent)); transform: scale(1.1); }
472+
100% { filter: drop-shadow(0 0 2px var(--accent)); transform: scale(1); }
473+
}
474+
475+
.force-glow {
476+
animation: force-pulse 1.5s infinite ease-in-out;
477+
}
478+
#level-name {
479+
font-weight: 900;
480+
text-transform: uppercase;
481+
letter-spacing: 0.02em;
482+
483+
/* Remove any existing filters that cause fuzziness */
484+
filter: none !important;
485+
transition: color 0.3s ease;
486+
}
487+
488+
/* Adjust the stroke for Dark/Random themes to keep it crisp */
489+
.dark #level-name {
490+
text-shadow: 1px 1px 0px rgba(0,0,0,0.5);
491+
}
492+
493+
#level-badge {
494+
transition: background-color 0.4s ease, transform 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275);
495+
}
496+
497+
/* Ensure the XP numbers are always legible */
498+
#total-xp-display {
499+
color: var(--text-main);
500+
filter: brightness(1.2); /* Pops slightly more in dark mode */
501+
}
502+
503+
/* Progress bar should always have a high-contrast background */
504+
.xp-bar-container {
505+
background: rgba(0, 0, 0, 0.1);
506+
}
507+
.dark .xp-bar-container {
508+
background: rgba(255, 255, 255, 0.1);
509+
}
510+
.xp-popup {
469511
position: absolute;
470-
inset: -10px;
471-
border-radius: 50%;
472-
background: var(--glow-color);
473-
opacity: 0.2;
474-
filter: blur(15px);
475-
z-index: -1;
512+
pointer-events: none;
513+
z-index: 9999;
514+
animation: floatUp 1s ease-out forwards;
515+
color: var(--accent); /* This uses our dynamic level color! */
516+
font-size: 0.75rem;
476517
}
477-
#level-progress {
478-
height: 100%;
479-
width: 0%; /* Initial state */
480-
transition: width 0.3s ease-in-out; /* This makes it "fill" instead of "jump" */
481-
box-shadow: 0 0 10px var(--accent);
518+
519+
@keyframes floatUp {
520+
0% {
521+
transform: translateY(0);
522+
opacity: 1;
523+
}
524+
100% {
525+
transform: translateY(-50px);
526+
opacity: 0;
527+
}
528+
}
529+
@keyframes xpFloat {
530+
0% {
531+
transform: translateY(0) scale(1);
532+
opacity: 1;
533+
}
534+
100% {
535+
transform: translateY(-40px) scale(1.2);
536+
opacity: 0;
537+
}
538+
}
539+
540+
.animate-xp-float {
541+
animation: xpFloat 1s ease-out forwards;
542+
/* This makes sure the text is crisp on light/dark themes */
543+
text-shadow: 0 0 4px rgba(0,0,0,0.3);
482544
}

0 commit comments

Comments
 (0)