feat(ui): eval bar as two opposing bars (black on top, white on bottom)

The dark container now visually represents the black share; the
bottom-anchored white fill grows/shrinks with the eval. cp range ±800
maps to full bar. Mate is pinned at 100%/0% with #M text. The score
label flips to the top when black is ahead so it stays inside the
darker half.
This commit is contained in:
ai-chess
2026-05-14 23:55:33 +03:00
parent 6f4525d59f
commit 3a9ba2ea49
2 changed files with 35 additions and 14 deletions
+25 -9
View File
@@ -61,22 +61,38 @@ body {
.bubble-body { font-size: 12.5px; }
.bubble-empty { font-style: italic; opacity: 0.55; }
/* ----- eval bar ----- */
/* ----- eval bar (lichess-style two-bar) ----- */
#eval-col {
position: relative;
background: #18181c;
background: #2a2a30; /* the BLACK half — sits at the top */
border-radius: 4px;
overflow: hidden;
box-shadow: inset 0 0 0 1px #3a3a40;
}
#eval-fill {
position: absolute; left: 0; right: 0; bottom: 50%;
background: linear-gradient(180deg, #fafafa 0%, #ddd 100%);
transition: bottom 0.4s ease;
/* center reference line (50/50) */
#eval-col::after {
content: "";
position: absolute;
left: 0; right: 0; top: 50%;
height: 1px; background: rgba(255,255,255,0.12);
pointer-events: none; z-index: 2;
}
#eval-fill { /* the WHITE half — anchored at bottom */
position: absolute;
left: 0; right: 0; bottom: 0;
height: 50%;
background: linear-gradient(180deg, #fafafa 0%, #e0ddd5 100%);
transition: height 0.4s ease;
z-index: 1;
}
#eval-text {
position: absolute; left: 0; right: 0; top: 50%; transform: translateY(-50%);
text-align: center; font-size: 10px; color: #888;
background: rgba(20,20,24,0.6); padding: 2px 0;
position: absolute; left: 0; right: 0; bottom: 4px;
text-align: center; font-size: 10px;
color: #18181c; mix-blend-mode: difference; z-index: 3;
font-weight: 700; letter-spacing: 0.04em;
}
#eval-col.advantage-black #eval-text {
bottom: auto; top: 4px; /* flip text to top when black is ahead */
}
/* ----- board ----- */