Some checks failed
This commit addresses three critical bugs reported after initial PR: 1. **Promotion dialog not closing after piece selection** - Changed from `style.display` to HTML5 `.showModal()` and `.close()` - Fixed selector from `.promotion-piece .symbol` to `.promotion-piece .piece-icon` - Fixed data attribute from `dataset.type` to `dataset.piece` - Dialog now properly closes after user selects promotion piece 2. **Pawn showing as queen before user selection** - Removed automatic promotion to queen in GameController.js:112-115 - Now emits 'promotion' event WITHOUT pre-promoting - User sees pawn until they select the promotion piece - Promotion happens only after user makes their choice 3. **Column resizing not fully fixed** - Added explicit `max-width: 250px` to `.game-sidebar` and `.captured-pieces` - Added explicit `max-width: 250px` to `.move-history-section` - Added `overflow: hidden` to `.captured-list` and `overflow-x: hidden` to `.move-history` - Added `min-width: 600px` to `.board-section` - Added `width: 100%` to all sidebar components for proper constraint application - Columns now maintain stable widths even with content changes **Files Changed:** - `js/main.js` - Fixed promotion dialog handling - `js/controllers/GameController.js` - Removed auto-promotion - `css/main.css` - Added width constraints and overflow handling **Root Causes:** - Dialog: Mixing HTML5 dialog API with legacy display styles - Promotion: Auto-promoting before showing user dialog - Resizing: Missing explicit max-widths allowed flex items to grow with content 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
277 lines
4.8 KiB
CSS
277 lines
4.8 KiB
CSS
/* Global Styles and Layout */
|
|
:root {
|
|
--primary-color: #2c3e50;
|
|
--secondary-color: #3498db;
|
|
--success-color: #27ae60;
|
|
--danger-color: #e74c3c;
|
|
--light-bg: #ecf0f1;
|
|
--dark-bg: #34495e;
|
|
--text-primary: #2c3e50;
|
|
--text-secondary: #7f8c8d;
|
|
--border-color: #bdc3c7;
|
|
}
|
|
|
|
* {
|
|
margin: 0;
|
|
padding: 0;
|
|
box-sizing: border-box;
|
|
}
|
|
|
|
body {
|
|
font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
|
|
background-color: var(--light-bg);
|
|
color: var(--text-primary);
|
|
line-height: 1.6;
|
|
}
|
|
|
|
.chess-app {
|
|
min-height: 100vh;
|
|
display: flex;
|
|
flex-direction: column;
|
|
}
|
|
|
|
.app-header {
|
|
background-color: var(--primary-color);
|
|
color: white;
|
|
padding: 1.5rem 2rem;
|
|
box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
|
|
}
|
|
|
|
.app-header h1 {
|
|
font-size: 2rem;
|
|
margin-bottom: 0.5rem;
|
|
}
|
|
|
|
.game-status {
|
|
display: flex;
|
|
gap: 2rem;
|
|
font-size: 1rem;
|
|
flex-wrap: wrap;
|
|
align-items: center;
|
|
}
|
|
|
|
.game-status span {
|
|
padding: 0.25rem 0.75rem;
|
|
background-color: rgba(255, 255, 255, 0.1);
|
|
border-radius: 4px;
|
|
}
|
|
|
|
.status-message {
|
|
display: none;
|
|
padding: 0.75rem 1rem;
|
|
border-radius: 4px;
|
|
font-weight: 500;
|
|
text-align: center;
|
|
animation: fadeIn 0.3s ease-in;
|
|
flex: 1 0 100%;
|
|
}
|
|
|
|
.status-message.info {
|
|
background-color: #d1ecf1;
|
|
color: #0c5460;
|
|
border: 1px solid #bee5eb;
|
|
}
|
|
|
|
.status-message.success {
|
|
background-color: #d4edda;
|
|
color: #155724;
|
|
border: 1px solid #c3e6cb;
|
|
}
|
|
|
|
.status-message.error {
|
|
background-color: #f8d7da;
|
|
color: #721c24;
|
|
border: 1px solid #f5c6cb;
|
|
}
|
|
|
|
@keyframes fadeIn {
|
|
from { opacity: 0; transform: translateY(-10px); }
|
|
to { opacity: 1; transform: translateY(0); }
|
|
}
|
|
|
|
.game-container {
|
|
flex: 1;
|
|
display: grid;
|
|
grid-template-columns: minmax(200px, 250px) minmax(600px, 3fr) minmax(200px, 250px);
|
|
gap: 2rem;
|
|
padding: 2rem;
|
|
max-width: 1600px;
|
|
margin: 0 auto;
|
|
}
|
|
|
|
.board-section {
|
|
display: flex;
|
|
align-items: center;
|
|
justify-content: center;
|
|
min-width: 600px;
|
|
width: 100%;
|
|
}
|
|
|
|
.game-sidebar {
|
|
display: flex;
|
|
flex-direction: column;
|
|
gap: 1.5rem;
|
|
width: 100%;
|
|
max-width: 250px;
|
|
}
|
|
|
|
.captured-pieces {
|
|
background: white;
|
|
padding: 1rem;
|
|
border-radius: 8px;
|
|
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
|
|
width: 100%;
|
|
max-width: 250px;
|
|
}
|
|
|
|
.captured-pieces h3 {
|
|
margin-bottom: 1rem;
|
|
color: var(--text-secondary);
|
|
font-size: 0.9rem;
|
|
text-transform: uppercase;
|
|
}
|
|
|
|
.captured-list {
|
|
display: flex;
|
|
flex-wrap: wrap;
|
|
gap: 0.5rem;
|
|
min-height: 60px;
|
|
max-width: 100%;
|
|
overflow: hidden;
|
|
}
|
|
|
|
.move-history-section {
|
|
background: white;
|
|
padding: 1rem;
|
|
border-radius: 8px;
|
|
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
|
|
flex: 1;
|
|
width: 100%;
|
|
max-width: 250px;
|
|
}
|
|
|
|
.move-history {
|
|
max-height: 400px;
|
|
overflow-y: auto;
|
|
overflow-x: hidden;
|
|
font-family: 'Courier New', monospace;
|
|
font-size: 0.9rem;
|
|
width: 100%;
|
|
}
|
|
|
|
.game-controls {
|
|
display: flex;
|
|
flex-direction: column;
|
|
gap: 0.75rem;
|
|
}
|
|
|
|
.btn {
|
|
padding: 0.75rem 1.5rem;
|
|
border: none;
|
|
border-radius: 4px;
|
|
font-size: 1rem;
|
|
cursor: pointer;
|
|
transition: all 0.3s ease;
|
|
font-weight: 600;
|
|
}
|
|
|
|
.btn:hover {
|
|
transform: translateY(-2px);
|
|
box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
|
|
}
|
|
|
|
.btn:active {
|
|
transform: translateY(0);
|
|
}
|
|
|
|
.btn-primary {
|
|
background-color: var(--secondary-color);
|
|
color: white;
|
|
}
|
|
|
|
.btn-secondary {
|
|
background-color: var(--border-color);
|
|
color: var(--text-primary);
|
|
}
|
|
|
|
.btn-danger {
|
|
background-color: var(--danger-color);
|
|
color: white;
|
|
}
|
|
|
|
.btn:disabled {
|
|
opacity: 0.5;
|
|
cursor: not-allowed;
|
|
}
|
|
|
|
/* Dialogs */
|
|
dialog {
|
|
border: none;
|
|
border-radius: 8px;
|
|
box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
|
|
padding: 2rem;
|
|
}
|
|
|
|
dialog::backdrop {
|
|
background-color: rgba(0, 0, 0, 0.5);
|
|
}
|
|
|
|
.promotion-dialog h2,
|
|
.game-over-dialog h2 {
|
|
margin-bottom: 1.5rem;
|
|
color: var(--primary-color);
|
|
}
|
|
|
|
.promotion-choices {
|
|
display: grid;
|
|
grid-template-columns: repeat(2, 1fr);
|
|
gap: 1rem;
|
|
}
|
|
|
|
.promotion-piece {
|
|
display: flex;
|
|
flex-direction: column;
|
|
align-items: center;
|
|
padding: 1rem;
|
|
border: 2px solid var(--border-color);
|
|
background: white;
|
|
border-radius: 8px;
|
|
cursor: pointer;
|
|
transition: all 0.3s ease;
|
|
}
|
|
|
|
.promotion-piece:hover {
|
|
border-color: var(--secondary-color);
|
|
background-color: var(--light-bg);
|
|
}
|
|
|
|
.promotion-piece .piece-icon {
|
|
font-size: 3rem;
|
|
margin-bottom: 0.5rem;
|
|
}
|
|
|
|
.dialog-actions {
|
|
display: flex;
|
|
gap: 1rem;
|
|
margin-top: 1.5rem;
|
|
}
|
|
|
|
/* Responsive Design */
|
|
@media (max-width: 1200px) {
|
|
.game-container {
|
|
grid-template-columns: 1fr;
|
|
}
|
|
|
|
.captured-white {
|
|
order: 1;
|
|
}
|
|
|
|
.board-section {
|
|
order: 2;
|
|
}
|
|
|
|
.game-sidebar {
|
|
order: 3;
|
|
}
|
|
}
|