Commit 08e1ca6f authored by Mahmoud Aglan's avatar Mahmoud Aglan

fix: 30 visual refinements to backgammon board

- Taller triangles (85% height), wider with pointed tips
- Board felt gradient + inner shadow for depth
- Thicker wood frame (10px) with grain color
- Checker ring detail via radial gradient
- Tighter stacking overlap (-10px), larger checkers (34px)
- Narrower bar (6%), textured gradient
- Larger dice (56px) with warm border
- Side panel background + wider (240px)
- Gold turn indicator border, active glow
- Point hover effect, smooth transitions
- Dice pair wrapper, count badge pill style
- Middle divider between board halves
- Borne-off positioned outside frame
Co-Authored-By: 's avatarClaude Opus 4.6 <noreply@anthropic.com>
parent 5568b4ef
/* ─── Tap highlight removal ──────────────────────────────────────────────── */
* {
-webkit-tap-highlight-color: transparent;
}
/* ─── Backgammon CSS Variables ────────────────────────────────────────────── */
:root {
--bg-board-wood: #5c3d2e;
......@@ -8,7 +13,7 @@
--bg-bar: #3a2418;
--bg-checker-white: #f0ebe0;
--bg-checker-black: #1a1a1a;
--bg-checker-size: 32px;
--bg-checker-size: 34px;
--bg-dice-bg: #f8f4ec;
--bg-dice-pip: #1a1a1a;
--bg-valid: rgba(76, 175, 80, 0.5);
......@@ -31,7 +36,7 @@
.bg-board-column {
display: flex;
flex-direction: column;
gap: 8px;
gap: 4px;
align-items: center;
flex: 1;
min-width: 0;
......@@ -44,10 +49,12 @@
max-width: 640px;
aspect-ratio: 1.2 / 1;
background: var(--bg-board-wood);
border: 8px solid var(--bg-frame);
border-width: 10px;
border-style: solid;
border-color: #4a2f1e;
border-radius: 8px;
box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4), inset 0 2px 8px rgba(0, 0, 0, 0.3);
overflow: visible;
overflow: hidden;
}
.bg-board-inner {
......@@ -55,7 +62,9 @@
flex-direction: column;
width: 100%;
height: 100%;
background: var(--bg-felt);
background: linear-gradient(180deg, #1a5c32 0%, #16522c 50%, #1a5c32 100%);
box-shadow: inset 0 4px 12px rgba(0,0,0,0.4);
gap: 2px;
}
/* ─── Board Halves ───────────────────────────────────────────────────────── */
......@@ -67,10 +76,12 @@
.bg-half--top {
align-items: flex-start;
border-bottom: 1px solid rgba(0,0,0,0.4);
}
.bg-half--bottom {
align-items: flex-end;
border-top: 1px solid rgba(0,0,0,0.4);
}
/* ─── Quadrants ──────────────────────────────────────────────────────────── */
......@@ -78,7 +89,7 @@
display: flex;
flex: 1;
height: 100%;
padding: 4px 2px;
padding: 0;
}
.bg-quadrant--top-left,
......@@ -99,10 +110,14 @@
width: calc(100% / 6);
height: 100%;
cursor: pointer;
transition: background 0.15s ease;
transition: background 0.2s ease;
z-index: 1;
}
.bg-point:hover {
background: rgba(255,255,255,0.05);
}
.bg-half--top .bg-point {
flex-direction: column;
justify-content: flex-start;
......@@ -117,21 +132,21 @@
.bg-point::before {
content: '';
position: absolute;
left: 10%;
right: 10%;
width: 80%;
height: 42%;
left: 5%;
right: 5%;
width: 90%;
height: 85%;
z-index: 0;
}
.bg-half--top .bg-point::before {
top: 0;
clip-path: polygon(50% 100%, 0% 0%, 100% 0%);
clip-path: polygon(50% 100%, 5% 0%, 95% 0%);
}
.bg-half--bottom .bg-point::before {
bottom: 0;
clip-path: polygon(50% 0%, 0% 100%, 100% 100%);
clip-path: polygon(50% 0%, 5% 100%, 95% 100%);
}
/* Alternating point colors */
......@@ -189,13 +204,13 @@
}
.bg-checker--white {
background: radial-gradient(circle at 35% 35%, #fffef8, var(--bg-checker-white) 60%, #c8c0b0);
background: radial-gradient(circle at 40% 35%, #fffef8 0%, #f0ebe0 45%, #d4cbb8 50%, #f0ebe0 55%, #c8c0b0 100%);
box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3), inset 0 1px 2px rgba(255, 255, 255, 0.6);
border: 1px solid #b0a890;
}
.bg-checker--black {
background: radial-gradient(circle at 35% 35%, #4a4a4a, var(--bg-checker-black) 60%, #000);
background: radial-gradient(circle at 40% 35%, #555 0%, #222 45%, #111 50%, #222 55%, #000 100%);
box-shadow: 0 2px 4px rgba(0, 0, 0, 0.5), inset 0 1px 2px rgba(255, 255, 255, 0.1);
border: 1px solid #333;
}
......@@ -235,6 +250,19 @@
text-shadow: 0 1px 1px rgba(255, 255, 255, 0.5);
}
.bg-checker-count-badge {
background: rgba(0,0,0,0.7);
padding: 1px 5px;
border-radius: 8px;
font-size: 10px;
font-weight: 700;
color: #fff;
text-align: center;
pointer-events: none;
z-index: 3;
margin-top: 2px;
}
/* Checker stacking within points */
.bg-point .bg-checkers-stack {
display: flex;
......@@ -255,19 +283,19 @@
/* Overlap checkers slightly when many */
.bg-checkers-stack--compact .bg-checker + .bg-checker {
margin-top: -8px;
margin-top: -10px;
}
.bg-half--bottom .bg-checkers-stack--compact .bg-checker + .bg-checker {
margin-top: 0;
margin-bottom: -8px;
margin-bottom: -10px;
}
/* ─── Bar Area ───────────────────────────────────────────────────────────── */
.bg-bar-area {
width: 8%;
min-width: 28px;
background: var(--bg-bar);
width: 6%;
min-width: 24px;
background: linear-gradient(180deg, #3a2418, #2a1810, #3a2418);
display: flex;
flex-direction: column;
align-items: center;
......@@ -303,7 +331,7 @@
position: absolute;
top: 4px;
bottom: 4px;
right: 4px;
right: -40px;
width: 32px;
z-index: 5;
}
......@@ -376,17 +404,17 @@
}
.bg-dice {
width: 48px;
height: 48px;
width: 56px;
height: 56px;
background: var(--bg-dice-bg);
border-radius: 8px;
display: grid;
grid-template-columns: repeat(3, 1fr);
grid-template-rows: repeat(3, 1fr);
padding: 6px;
padding: 8px;
gap: 2px;
box-shadow: 0 3px 8px rgba(0, 0, 0, 0.3), inset 0 1px 1px rgba(255, 255, 255, 0.4);
border: 2px solid #ddd;
box-shadow: 0 4px 10px rgba(0,0,0,0.4), inset 0 1px 2px rgba(255,255,255,0.5);
border: 3px solid #c8b88a;
transition: transform 0.3s ease;
}
......@@ -404,6 +432,12 @@
box-shadow: inset 0 1px 1px rgba(255, 255, 255, 0.1);
}
.bg-dice-pair {
display: flex;
gap: 10px;
align-items: center;
}
.bg-dice--used {
opacity: 0.4;
transform: scale(0.9);
......@@ -451,8 +485,11 @@
display: flex;
flex-direction: column;
gap: 12px;
width: 220px;
width: 240px;
flex-shrink: 0;
background: var(--bg-2, rgba(0,0,0,0.2));
border-radius: 12px;
padding: 12px;
}
.bg-turn-indicator {
......@@ -462,7 +499,7 @@
padding: 10px 14px;
background: var(--bg-2, rgba(0, 0, 0, 0.3));
border-radius: 8px;
border: 1px solid rgba(255, 255, 255, 0.08);
border: 1px solid var(--gold, #e7a832);
}
.bg-turn-indicator__dot {
......@@ -480,7 +517,7 @@
.bg-turn-indicator--active {
border-color: var(--gold, #e7a832);
box-shadow: 0 0 8px rgba(231, 168, 50, 0.25);
box-shadow: 0 0 12px rgba(231,168,50,0.4);
}
/* ─── Controls ───────────────────────────────────────────────────────────── */
......@@ -499,11 +536,11 @@
align-items: center;
justify-content: center;
gap: 6px;
padding: 12px 20px;
padding: 14px 28px;
min-height: 44px;
background: linear-gradient(135deg, #e7a832, #d4922a);
color: #fff;
font-size: 15px;
font-size: 16px;
font-weight: 700;
border: none;
border-radius: 8px;
......@@ -560,7 +597,7 @@
border: 1px solid rgba(255, 255, 255, 0.08);
max-height: 180px;
overflow-y: auto;
font-size: 12px;
font-size: 13px;
color: var(--text-3, #888);
}
......@@ -592,7 +629,7 @@
justify-content: space-between;
align-items: center;
width: 100%;
max-width: 600px;
max-width: 640px;
gap: 12px;
}
......@@ -610,8 +647,8 @@
}
.bg-player-info--active {
border-color: var(--gold, #e7a832);
box-shadow: 0 0 10px rgba(231, 168, 50, 0.25);
border-color: var(--gold);
box-shadow: 0 0 12px rgba(231,168,50,0.4);
}
.bg-player-dot {
......
......@@ -105,10 +105,10 @@ var BackgammonUI = (function() {
if (selected === idx && c === display - 1) cls += ' bg-checker--selected';
checkersHTML += '<div class="' + cls + '"></div>';
}
checkersHTML += '</div>';
if (absCount > 5) {
checkersHTML += '<span class="bg-checker-count">' + absCount + '</span>';
checkersHTML += '<span class="bg-checker-count-badge">' + absCount + '</span>';
}
checkersHTML += '</div>';
}
el.innerHTML = checkersHTML;
......@@ -205,6 +205,12 @@ var BackgammonUI = (function() {
var player = state.players[state.currentTurn];
var color = state.currentTurn === 0 ? 'white' : 'black';
var phaseText = state.phase === 'awaiting_roll' ? 'ارمِ النرد' : state.phase === 'moving' ? 'حرّك قطعك' : '';
var isActive = state.players[state.currentTurn].type === 'human';
if (isActive) {
el.classList.add('bg-turn-indicator--active');
} else {
el.classList.remove('bg-turn-indicator--active');
}
el.innerHTML = '<div class="bg-player-dot bg-player-dot--' + color + '"></div>' +
'<span class="bg-player-name">' + player.name + '</span>' +
(phaseText ? '<span class="bg-player-pip">' + phaseText + '</span>' : '');
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment