improved javascript structure, added load selection and made chessboard selectable

This commit is contained in:
2026-03-30 19:03:13 +02:00
parent b808b0017b
commit bc377b6e33
6 changed files with 554 additions and 196 deletions
+132 -8
View File
@@ -44,16 +44,24 @@ body {
text-align: center;
}
.board {
overflow-x: auto;
padding-bottom: 8px;
}
/* ♟️ Board */
.board-grid {
--label-size: 30px;
--cell-size: 60px;
display: grid;
grid-template-columns: 30px repeat(8, 60px);
grid-template-rows: 30px repeat(8, 60px);
grid-template-columns: var(--label-size) repeat(var(--board-size, 8), var(--cell-size));
grid-template-rows: var(--label-size) repeat(var(--board-size, 8), var(--cell-size));
margin: 20px auto;
width: max-content;
border: 6px solid #1e293b;
border-radius: 10px;
overflow: hidden;
max-width: 100%;
}
.label {
@@ -63,17 +71,18 @@ body {
font-weight: bold;
background: #aec8eb;
color: #1e293b;
width: var(--label-size);
height: var(--label-size);
font-size: 14px;
}
.cell {
width: 60px;
height: 60px;
width: var(--cell-size);
height: var(--cell-size);
display: flex;
align-items: center;
justify-content: center;
font-size: 30px;
font-size: calc(var(--cell-size) * 0.5);
cursor: pointer;
transition: 0.2s;
}
@@ -152,4 +161,119 @@ body {
.btn.active {
background: #22c55e;
}
}
.board-size-info {
margin: 0 0 10px;
color: #475569;
}
.sidebar {
position: fixed;
top: 0;
right: 0;
width: min(320px, 85vw);
height: 100vh;
padding: 24px;
background: white;
box-shadow: -10px 0 24px rgba(15, 23, 42, 0.18);
transform: translateX(100%);
transition: transform 0.25s ease;
z-index: 30;
}
.sidebar.open {
transform: translateX(0);
}
.save-points-sidebar {
width: min(380px, 92vw);
}
.sidebar-header {
display: flex;
justify-content: space-between;
align-items: center;
gap: 10px;
}
.sidebar-close {
margin: 0;
}
.sidebar-label {
display: block;
margin-top: 18px;
margin-bottom: 8px;
font-weight: bold;
}
.sidebar input[type="range"] {
width: 100%;
}
.sidebar-size-row {
margin: 12px 0 18px;
font-size: 18px;
}
.sidebar-hint {
color: #64748b;
font-size: 14px;
}
.save-points-list {
display: grid;
gap: 12px;
margin-top: 18px;
}
.save-point-card {
border: 1px solid #dbe4ee;
border-radius: 10px;
padding: 14px;
background: #f8fafc;
}
.save-point-card h4 {
margin: 0 0 8px;
color: #1e293b;
}
.save-point-meta {
margin: 4px 0;
color: #475569;
font-size: 14px;
}
.save-point-preview {
margin: 10px 0 0;
color: #334155;
font-size: 14px;
word-break: break-word;
}
.sidebar-backdrop {
position: fixed;
inset: 0;
background: rgba(15, 23, 42, 0.3);
opacity: 0;
pointer-events: none;
transition: opacity 0.25s ease;
z-index: 20;
}
.sidebar-backdrop.visible {
opacity: 1;
pointer-events: auto;
}
@media (max-width: 720px) {
.container {
padding: 12px;
}
.navbar {
padding: 15px 18px;
}
}