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 ────────────────────────────────────────────── */ /* ─── Backgammon CSS Variables ────────────────────────────────────────────── */
:root { :root {
--bg-board-wood: #5c3d2e; --bg-board-wood: #5c3d2e;
...@@ -8,7 +13,7 @@ ...@@ -8,7 +13,7 @@
--bg-bar: #3a2418; --bg-bar: #3a2418;
--bg-checker-white: #f0ebe0; --bg-checker-white: #f0ebe0;
--bg-checker-black: #1a1a1a; --bg-checker-black: #1a1a1a;
--bg-checker-size: 32px; --bg-checker-size: 34px;
--bg-dice-bg: #f8f4ec; --bg-dice-bg: #f8f4ec;
--bg-dice-pip: #1a1a1a; --bg-dice-pip: #1a1a1a;
--bg-valid: rgba(76, 175, 80, 0.5); --bg-valid: rgba(76, 175, 80, 0.5);
...@@ -31,7 +36,7 @@ ...@@ -31,7 +36,7 @@
.bg-board-column { .bg-board-column {
display: flex; display: flex;
flex-direction: column; flex-direction: column;
gap: 8px; gap: 4px;
align-items: center; align-items: center;
flex: 1; flex: 1;
min-width: 0; min-width: 0;
...@@ -44,10 +49,12 @@ ...@@ -44,10 +49,12 @@
max-width: 640px; max-width: 640px;
aspect-ratio: 1.2 / 1; aspect-ratio: 1.2 / 1;
background: var(--bg-board-wood); background: var(--bg-board-wood);
border: 8px solid var(--bg-frame); border-width: 10px;
border-style: solid;
border-color: #4a2f1e;
border-radius: 8px; border-radius: 8px;
box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4), inset 0 2px 8px rgba(0, 0, 0, 0.3); 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 { .bg-board-inner {
...@@ -55,7 +62,9 @@ ...@@ -55,7 +62,9 @@
flex-direction: column; flex-direction: column;
width: 100%; width: 100%;
height: 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 ───────────────────────────────────────────────────────── */ /* ─── Board Halves ───────────────────────────────────────────────────────── */
...@@ -67,10 +76,12 @@ ...@@ -67,10 +76,12 @@
.bg-half--top { .bg-half--top {
align-items: flex-start; align-items: flex-start;
border-bottom: 1px solid rgba(0,0,0,0.4);
} }
.bg-half--bottom { .bg-half--bottom {
align-items: flex-end; align-items: flex-end;
border-top: 1px solid rgba(0,0,0,0.4);
} }
/* ─── Quadrants ──────────────────────────────────────────────────────────── */ /* ─── Quadrants ──────────────────────────────────────────────────────────── */
...@@ -78,7 +89,7 @@ ...@@ -78,7 +89,7 @@
display: flex; display: flex;
flex: 1; flex: 1;
height: 100%; height: 100%;
padding: 4px 2px; padding: 0;
} }
.bg-quadrant--top-left, .bg-quadrant--top-left,
...@@ -99,10 +110,14 @@ ...@@ -99,10 +110,14 @@
width: calc(100% / 6); width: calc(100% / 6);
height: 100%; height: 100%;
cursor: pointer; cursor: pointer;
transition: background 0.15s ease; transition: background 0.2s ease;
z-index: 1; z-index: 1;
} }
.bg-point:hover {
background: rgba(255,255,255,0.05);
}
.bg-half--top .bg-point { .bg-half--top .bg-point {
flex-direction: column; flex-direction: column;
justify-content: flex-start; justify-content: flex-start;
...@@ -117,21 +132,21 @@ ...@@ -117,21 +132,21 @@
.bg-point::before { .bg-point::before {
content: ''; content: '';
position: absolute; position: absolute;
left: 10%; left: 5%;
right: 10%; right: 5%;
width: 80%; width: 90%;
height: 42%; height: 85%;
z-index: 0; z-index: 0;
} }
.bg-half--top .bg-point::before { .bg-half--top .bg-point::before {
top: 0; 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 { .bg-half--bottom .bg-point::before {
bottom: 0; bottom: 0;
clip-path: polygon(50% 0%, 0% 100%, 100% 100%); clip-path: polygon(50% 0%, 5% 100%, 95% 100%);
} }
/* Alternating point colors */ /* Alternating point colors */
...@@ -189,13 +204,13 @@ ...@@ -189,13 +204,13 @@
} }
.bg-checker--white { .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); 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; border: 1px solid #b0a890;
} }
.bg-checker--black { .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); 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; border: 1px solid #333;
} }
...@@ -235,6 +250,19 @@ ...@@ -235,6 +250,19 @@
text-shadow: 0 1px 1px rgba(255, 255, 255, 0.5); 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 */ /* Checker stacking within points */
.bg-point .bg-checkers-stack { .bg-point .bg-checkers-stack {
display: flex; display: flex;
...@@ -255,19 +283,19 @@ ...@@ -255,19 +283,19 @@
/* Overlap checkers slightly when many */ /* Overlap checkers slightly when many */
.bg-checkers-stack--compact .bg-checker + .bg-checker { .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 { .bg-half--bottom .bg-checkers-stack--compact .bg-checker + .bg-checker {
margin-top: 0; margin-top: 0;
margin-bottom: -8px; margin-bottom: -10px;
} }
/* ─── Bar Area ───────────────────────────────────────────────────────────── */ /* ─── Bar Area ───────────────────────────────────────────────────────────── */
.bg-bar-area { .bg-bar-area {
width: 8%; width: 6%;
min-width: 28px; min-width: 24px;
background: var(--bg-bar); background: linear-gradient(180deg, #3a2418, #2a1810, #3a2418);
display: flex; display: flex;
flex-direction: column; flex-direction: column;
align-items: center; align-items: center;
...@@ -303,7 +331,7 @@ ...@@ -303,7 +331,7 @@
position: absolute; position: absolute;
top: 4px; top: 4px;
bottom: 4px; bottom: 4px;
right: 4px; right: -40px;
width: 32px; width: 32px;
z-index: 5; z-index: 5;
} }
...@@ -376,17 +404,17 @@ ...@@ -376,17 +404,17 @@
} }
.bg-dice { .bg-dice {
width: 48px; width: 56px;
height: 48px; height: 56px;
background: var(--bg-dice-bg); background: var(--bg-dice-bg);
border-radius: 8px; border-radius: 8px;
display: grid; display: grid;
grid-template-columns: repeat(3, 1fr); grid-template-columns: repeat(3, 1fr);
grid-template-rows: repeat(3, 1fr); grid-template-rows: repeat(3, 1fr);
padding: 6px; padding: 8px;
gap: 2px; gap: 2px;
box-shadow: 0 3px 8px rgba(0, 0, 0, 0.3), inset 0 1px 1px rgba(255, 255, 255, 0.4); box-shadow: 0 4px 10px rgba(0,0,0,0.4), inset 0 1px 2px rgba(255,255,255,0.5);
border: 2px solid #ddd; border: 3px solid #c8b88a;
transition: transform 0.3s ease; transition: transform 0.3s ease;
} }
...@@ -404,6 +432,12 @@ ...@@ -404,6 +432,12 @@
box-shadow: inset 0 1px 1px rgba(255, 255, 255, 0.1); 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 { .bg-dice--used {
opacity: 0.4; opacity: 0.4;
transform: scale(0.9); transform: scale(0.9);
...@@ -451,8 +485,11 @@ ...@@ -451,8 +485,11 @@
display: flex; display: flex;
flex-direction: column; flex-direction: column;
gap: 12px; gap: 12px;
width: 220px; width: 240px;
flex-shrink: 0; flex-shrink: 0;
background: var(--bg-2, rgba(0,0,0,0.2));
border-radius: 12px;
padding: 12px;
} }
.bg-turn-indicator { .bg-turn-indicator {
...@@ -462,7 +499,7 @@ ...@@ -462,7 +499,7 @@
padding: 10px 14px; padding: 10px 14px;
background: var(--bg-2, rgba(0, 0, 0, 0.3)); background: var(--bg-2, rgba(0, 0, 0, 0.3));
border-radius: 8px; border-radius: 8px;
border: 1px solid rgba(255, 255, 255, 0.08); border: 1px solid var(--gold, #e7a832);
} }
.bg-turn-indicator__dot { .bg-turn-indicator__dot {
...@@ -480,7 +517,7 @@ ...@@ -480,7 +517,7 @@
.bg-turn-indicator--active { .bg-turn-indicator--active {
border-color: var(--gold, #e7a832); 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 ───────────────────────────────────────────────────────────── */ /* ─── Controls ───────────────────────────────────────────────────────────── */
...@@ -499,11 +536,11 @@ ...@@ -499,11 +536,11 @@
align-items: center; align-items: center;
justify-content: center; justify-content: center;
gap: 6px; gap: 6px;
padding: 12px 20px; padding: 14px 28px;
min-height: 44px; min-height: 44px;
background: linear-gradient(135deg, #e7a832, #d4922a); background: linear-gradient(135deg, #e7a832, #d4922a);
color: #fff; color: #fff;
font-size: 15px; font-size: 16px;
font-weight: 700; font-weight: 700;
border: none; border: none;
border-radius: 8px; border-radius: 8px;
...@@ -560,7 +597,7 @@ ...@@ -560,7 +597,7 @@
border: 1px solid rgba(255, 255, 255, 0.08); border: 1px solid rgba(255, 255, 255, 0.08);
max-height: 180px; max-height: 180px;
overflow-y: auto; overflow-y: auto;
font-size: 12px; font-size: 13px;
color: var(--text-3, #888); color: var(--text-3, #888);
} }
...@@ -592,7 +629,7 @@ ...@@ -592,7 +629,7 @@
justify-content: space-between; justify-content: space-between;
align-items: center; align-items: center;
width: 100%; width: 100%;
max-width: 600px; max-width: 640px;
gap: 12px; gap: 12px;
} }
...@@ -610,8 +647,8 @@ ...@@ -610,8 +647,8 @@
} }
.bg-player-info--active { .bg-player-info--active {
border-color: var(--gold, #e7a832); border-color: var(--gold);
box-shadow: 0 0 10px rgba(231, 168, 50, 0.25); box-shadow: 0 0 12px rgba(231,168,50,0.4);
} }
.bg-player-dot { .bg-player-dot {
......
...@@ -105,10 +105,10 @@ var BackgammonUI = (function() { ...@@ -105,10 +105,10 @@ var BackgammonUI = (function() {
if (selected === idx && c === display - 1) cls += ' bg-checker--selected'; if (selected === idx && c === display - 1) cls += ' bg-checker--selected';
checkersHTML += '<div class="' + cls + '"></div>'; checkersHTML += '<div class="' + cls + '"></div>';
} }
checkersHTML += '</div>';
if (absCount > 5) { 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; el.innerHTML = checkersHTML;
...@@ -205,6 +205,12 @@ var BackgammonUI = (function() { ...@@ -205,6 +205,12 @@ var BackgammonUI = (function() {
var player = state.players[state.currentTurn]; var player = state.players[state.currentTurn];
var color = state.currentTurn === 0 ? 'white' : 'black'; var color = state.currentTurn === 0 ? 'white' : 'black';
var phaseText = state.phase === 'awaiting_roll' ? 'ارمِ النرد' : state.phase === 'moving' ? 'حرّك قطعك' : ''; 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>' + el.innerHTML = '<div class="bg-player-dot bg-player-dot--' + color + '"></div>' +
'<span class="bg-player-name">' + player.name + '</span>' + '<span class="bg-player-name">' + player.name + '</span>' +
(phaseText ? '<span class="bg-player-pip">' + phaseText + '</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