Implement 7-bag randomization system and improve mobile layout with vertical menu

This commit is contained in:
cmclark00 2025-03-25 16:58:54 -04:00
parent 40700d1636
commit 9e04ffc20a
3 changed files with 198 additions and 146 deletions

227
style.css
View file

@ -496,18 +496,18 @@ input[type=range]::-moz-range-thumb {
}
.mobile-mode .game-container {
flex-direction: column;
align-items: center;
gap: 15px;
flex-direction: row;
align-items: flex-start;
gap: 5px;
padding: 10px;
max-width: 100vw;
box-sizing: border-box;
margin-top: 50px; /* Reduced top margin */
margin-top: 40px; /* Reduced top margin */
}
.mobile-mode .game-title {
font-size: 24px;
top: 10px;
font-size: 22px;
top: 5px;
text-shadow: 0 0 8px rgba(255, 0, 255, 0.7);
}
@ -515,50 +515,142 @@ input[type=range]::-moz-range-thumb {
display: flex;
flex-direction: column;
align-items: center;
margin: 0 auto;
position: relative;
margin-bottom: 20px; /* Add bottom margin to make room for next piece */
}
.mobile-mode #next-piece-preview {
position: absolute;
top: auto;
bottom: -70px; /* Position below the game board */
left: 50%;
transform: translateX(-50%);
margin: 0;
background: rgba(0, 0, 0, 0.7);
z-index: 10;
border-color: rgba(0, 255, 255, 0.5);
order: 2; /* Move game board to the right */
flex-grow: 1;
}
.mobile-mode .score-container {
width: 100%;
width: auto;
min-width: 100px;
max-width: 120px;
display: flex;
flex-direction: row;
flex-wrap: wrap;
justify-content: center;
flex-direction: column;
align-items: center;
gap: 8px;
gap: 5px;
padding: 8px;
background: rgba(0, 0, 0, 0.7);
order: 1; /* Move score container to the left */
margin-right: 5px;
border-radius: 8px;
height: auto;
align-self: stretch;
}
.mobile-mode .score-container p {
margin: 5px;
font-size: 12px;
margin: 3px 0;
font-size: 10px;
}
.mobile-mode .game-btn {
margin: 3px;
padding: 8px 12px;
font-size: 10px;
padding: 6px 8px;
font-size: 9px;
width: 95%;
}
.mobile-mode .controls-info {
display: none;
}
.mobile-mode #next-piece-preview {
position: relative;
top: auto;
bottom: auto;
left: auto;
right: auto;
transform: none;
margin: 0 0 10px 0;
background: rgba(0, 0, 0, 0.7);
z-index: 10;
border-color: rgba(0, 255, 255, 0.5);
width: 90%; /* Make it fit inside the score container */
box-sizing: border-box;
}
.mobile-mode #next-piece-preview h3 {
font-size: 12px;
margin-bottom: 5px;
}
.mobile-mode canvas#tetris {
max-width: 100%;
height: auto;
border-radius: 8px;
}
/* Portrait vs landscape adjustments */
@media (orientation: portrait) {
.mobile-mode .game-container {
padding-top: 35px;
height: calc(100vh - 40px);
}
.mobile-mode .score-container {
height: calc(100vh - 80px);
justify-content: flex-start;
}
.mobile-mode canvas#tetris {
height: calc(100vh - 80px);
width: auto;
object-fit: contain;
}
}
@media (orientation: landscape) {
.mobile-mode .game-container {
margin-top: 35px;
padding: 5px;
height: calc(100vh - 40px);
}
.mobile-mode .score-container {
height: calc(100vh - 50px);
max-width: 100px;
}
.mobile-mode canvas#tetris {
height: calc(100vh - 50px);
width: auto;
object-fit: contain;
}
}
/* Smaller devices */
@media (max-width: 400px) {
.mobile-mode .game-title {
font-size: 18px;
}
.mobile-mode .score-container p {
font-size: 9px;
}
.mobile-mode .score-container {
min-width: 85px;
max-width: 90px;
}
.mobile-mode .game-btn {
font-size: 8px;
padding: 5px 6px;
}
}
/* Tablet optimization */
@media (min-width: 768px) and (max-width: 1024px) {
.mobile-mode .game-container {
flex-direction: row;
flex-wrap: wrap;
gap: 20px;
}
.mobile-mode .game-title {
font-size: 28px;
}
}
/* Touch instructions */
.touch-instructions {
display: none;
@ -588,81 +680,4 @@ input[type=range]::-moz-range-thumb {
.touch-instructions.fade-out {
opacity: 0;
}
/* Portrait vs landscape adjustments */
@media (orientation: portrait) {
.mobile-mode .game-container {
padding-top: 40px;
padding-bottom: 80px; /* Add bottom padding for next piece */
}
.mobile-mode canvas#tetris {
width: 90vw;
max-height: 75vh; /* Ensure game board doesn't take too much height */
height: auto;
object-fit: contain;
}
}
@media (orientation: landscape) {
.mobile-mode .game-container {
flex-direction: row;
flex-wrap: wrap;
justify-content: center;
margin-top: 40px;
padding: 5px;
}
.mobile-mode .score-container {
width: auto;
min-width: 150px;
max-width: 30%;
height: 80vh;
overflow-y: auto;
}
.mobile-mode .game-wrapper {
margin: 0;
height: 80vh;
}
.mobile-mode #next-piece-preview {
position: absolute;
top: 0;
bottom: auto;
left: 100%;
transform: none;
margin-left: 10px;
}
.mobile-mode canvas#tetris {
height: 75vh; /* Slightly reduced to ensure full visibility */
width: auto;
object-fit: contain;
}
}
/* Smaller devices */
@media (max-width: 400px) {
.mobile-mode .game-title {
font-size: 20px;
}
.mobile-mode .score-container p {
font-size: 10px;
}
}
/* Tablet optimization */
@media (min-width: 768px) and (max-width: 1024px) {
.mobile-mode .game-container {
flex-direction: row;
flex-wrap: wrap;
gap: 20px;
}
.mobile-mode .game-title {
font-size: 28px;
}
}