Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

styles #9

Merged
merged 1 commit into from
Nov 15, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 15 additions & 9 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -8,18 +8,24 @@
<link rel="stylesheet" href="styles.css">
</head>
<body>
<h1>♔ Chessical ♔</h1>

<div class="game-container">
<div id="captured-white" class="captured-pieces">White Captured Pieces</div>
<div id="board"></div>
<div id="captured-black" class="captured-pieces">Black Captured Pieces</div>
<div id="evaluation-bar">
<div id="evaluation-score"></div>
<div class="main-container">
<div id="text">
<h1>♔ Chessical ♔</h1>
<p>The JavaScript powered Chess Engine🎯</p>
</div>

<div class="game-container">
<div id="captured-white" class="captured-pieces">White Captured Pieces</div>
<div id="board"></div>
<div id="captured-black" class="captured-pieces">Black Captured Pieces</div>
</div>

<button id="suggest-best-move">Suggest Best Move</button>
</div>

<button id="suggest-best-move">Suggest Best Move</button>
<div id="evaluation-bar">
<div id="evaluation-score"></div>
</div>

<script src="scripts/board.js"></script>
<script src="scripts/evaluation.js"></script>
Expand Down
Binary file added pieces/day-mode (1).png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added pieces/github.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added pieces/night-mode (1).png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
100 changes: 59 additions & 41 deletions styles.css
Original file line number Diff line number Diff line change
Expand Up @@ -9,42 +9,58 @@ body {
display: flex;
flex-direction: column;
align-items: center;
overflow-x: scroll ;
overflow-x: hidden;
padding: 4em;
text-align: center;
}

.main-container {
display: flex;
flex-direction: column;
align-items: center;
}

h1 {
text-align: center;
margin: 1.2em;
color: #b58863;
font-size: 2.3em;
}

p {
color: #fff;
margin-bottom: 0.5em;
}

.game-container {
position: relative;
display: flex;
flex-direction: column;
align-items: center;
gap: 0.5em;
margin: 0 2em;
width: 90%;
}

#captured-white {
margin-bottom: 0;
}

#board {
display: grid;
grid-template-columns: repeat(8, 80px);
width: 640px;
height: 640px;
grid-template-columns: repeat(8, 1fr);
width: 100%;
aspect-ratio: 1;
border: 2px solid #333;
}

.square {
width: 80px;
height: 80px;
position: relative;
display: flex;
justify-content: center;
align-items: center;
aspect-ratio: 1;
background-color: transparent;
}

.square-label {
Expand All @@ -62,9 +78,12 @@ h1 {

/* Chess Pieces */
.piece {
width: 100%;
height: 100%;
width: 80%;
height: 80%;
cursor: grab;
background-size: contain;
background-repeat: no-repeat;
background-position: center;
}

.piece.dragging {
Expand All @@ -78,20 +97,24 @@ h1 {
}

.captured-pieces {
width: 640px;
width: 100%;
display: flex;
flex-wrap: wrap;
min-height: 40px;
padding: 5px;
border: 1px solid #ccc;
margin: 5px 0;
margin: 0;
background-color: rgba(255, 255, 255, 0.8);

}

.captured-pieces .piece {
width: 40px;
height: 40px;
cursor: default;
background-size: contain;
background-repeat: no-repeat;
background-position: center;
}

#suggest-best-move {
Expand All @@ -116,7 +139,7 @@ h1 {

#evaluation-score {
width: 100%;
height: 50%; /* Start at neutral position */
height: 50%;
background-color: #000;
position: absolute;
bottom: 0;
Expand Down Expand Up @@ -174,76 +197,71 @@ h1 {
/* Responsive design adjustments */
@media (max-width: 768px) {
.game-container {

margin: 4em; /* Reduced margins for better spacing */

margin: 4em;
}

#board, .captured-pieces {
/* Reduced width for board and captured pieces */
margin: 0 auto; /* Center the board */
transform: scale(0.8);
transform-origin: top;
width: 100%;
height: auto;
}

#evaluation-bar {
width: 15px; /* Narrower evaluation bar */
height: 250px; /* Adjust height for fit */
width: 15px;
height: 250px;
right: 0;
position: fixed; /* Position at the right side */
position: fixed;
}

h1 {
font-size: 1.8em; /* Slightly smaller font size */
margin: 1em 0; /* Adjusted margin */
font-size: 1.8em;
margin: 1em 0;
}

#suggest-best-move {
padding: 0.7em; /* Slightly smaller padding */
font-size: 0.75em; /* Reduced font size */
padding: 0.7em;
font-size: 0.75em;
}

.promotion-option {
width: 50px; /* Smaller promotion option */
height: 50px; /* Smaller promotion option */
width: 50px;
height: 50px;
}
}

/* Adjustments for screens less than 450px wide */
@media (max-width: 450px) {
.game-container {
margin: 0 2em; /* Reduced margin for better spacing */
padding: 1.5em; /* Reduced padding */
margin: 0 2em;
padding: 1.5em;
}

#board, .captured-pieces {
transform: scale(0.8); /* Slightly smaller scale for better fit */
transform-origin: right;
width: 100%;
height: auto;
}

#evaluation-bar {
width: 6px; /* Even narrower evaluation bar */
height: 150px; /* Reduced height */
right: 0; /* Position at the right side */
width: 6px;
height: 150px;
right: 0;
}

h1 {
font-size: 1.3em; /* Smaller font size */
margin: 0.5em 0; /* Reduced margin */
font-size: 1.3em;
margin: 0.5em 0;
}

#suggest-best-move {
padding: 0.5em; /* Smaller padding */
font-size: 0.6em; /* Smaller font size */
padding: 0.5em;
font-size: 0.6em;
}

.promotion-option {
width: 40px; /* Smaller promotion option */
height: 40px; /* Smaller promotion option */
width: 40px;
height: 40px;
}
}


/* Add touch support */
@media (hover: none) {
.square {
Expand Down