Last active
December 25, 2023 11:07
-
-
Save mateuszsokola/93d77a44c5f602b2b44f4c2e3bd77cee to your computer and use it in GitHub Desktop.
2048-in-react - Mobile CSS
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
.board { | |
position: relative; | |
width: calc(var(--pixel-size) * 8 * 4 + var(--pixel-size) * 5); | |
} | |
.grid { | |
display: flex; | |
flex-wrap: wrap; | |
background: var(--secondary-background); | |
border: calc(var(--pixel-size) * 0.5) solid var(--secondary-background); | |
border-radius: calc(var(--pixel-size) * 0.75); | |
} | |
.cell { | |
width: calc(var(--pixel-size) * 8); | |
height: calc(var(--pixel-size) * 8); | |
margin: calc(var(--pixel-size) * 0.5); | |
border-radius: calc(var(--pixel-size) * 0.5); | |
background: var(--cell-background); | |
} | |
.tiles { | |
position: absolute; | |
z-index: 2; | |
margin: calc(var(--pixel-size) * 0.5); | |
left: 0; | |
top: 0; | |
right: 0; | |
bottom: 0; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
:root { | |
--pixel-size: 8px; | |
/* Backgrounds */ | |
--primary-background: #faf8ef; | |
--secondary-background: #bbada0; | |
--cell-background: #cac1b5; | |
--tile-background: #eee4da; | |
/* Colors */ | |
--primary-text-color: #776e65; | |
--secondary-text-color: #f9f6f2; | |
} | |
body { | |
margin: 0; | |
font-family: | |
system-ui, | |
-apple-system, | |
BlinkMacSystemFont, | |
"Segoe UI", | |
Roboto, | |
Oxygen, | |
Ubuntu, | |
Cantarell, | |
"Open Sans", | |
"Helvetica Neue", | |
sans-serif; | |
background: var(--primary-background); | |
color: var(--primary-text-color); | |
font-size: calc(var(--pixel-size) * 2.25); | |
line-height: calc(var(--pixel-size) * 3.5); | |
} | |
h1 { | |
font-size: calc(var(--pixel-size) * 5); | |
line-height: calc(var(--pixel-size) * 5); | |
margin: calc(var(--pixel-size) * 1.5) calc(var(--pixel-size) * 0); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
.twenty48 { | |
margin: calc(var(--pixel-size) * 0) auto; | |
padding: calc(var(--pixel-size) * 1); | |
width: 100%; | |
max-width: calc(var(--pixel-size) * 37); | |
} | |
.twenty48 > header { | |
display: flex; | |
align-items: center; | |
margin: calc(var(--pixel-size) * 1) calc(var(--pixel-size) * 0); | |
} | |
.twenty48 > header > * { | |
flex: 1; | |
} | |
.twenty48 > footer { | |
margin: calc(var(--pixel-size) * 3) calc(var(--pixel-size) * 0); | |
font-weight: 600; | |
text-align: center; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
.score { | |
background: var(--secondary-background); | |
border: calc(var(--pixel-size) * 0.5) solid var(--secondary-background); | |
border-radius: calc(var(--pixel-size) * 0.75); | |
color: var(--tile-background); | |
font-size: calc(var(--pixel-size) * 1.5); | |
line-height: calc(var(--pixel-size) * 3); | |
font-weight: bold; | |
text-align: center; | |
text-transform: uppercase; | |
} | |
.score > div { | |
font-size: calc(var(--pixel-size) * 2.5); | |
color: var(--secondary-text-color); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
.tile { | |
position: absolute; | |
width: calc(var(--pixel-size) * 8); | |
height: calc(var(--pixel-size) * 8); | |
margin: calc(var(--pixel-size) * 0.5); | |
border-radius: calc(var(--pixel-size) * 0.5); | |
background: var(--tile-background); | |
color: var(--primary-text-color); | |
font-size: calc(var(--pixel-size) * 4); | |
line-height: calc(var(--pixel-size) * 8); | |
font-weight: bold; | |
text-align: center; | |
transition-property: left, top, transform; | |
transition-duration: 200ms, 200ms, 100ms; | |
} | |
/* -=-=-=- START OF TEXT COLOR -=-=-=- */ | |
.tile8, | |
.tile16, | |
.tile32, | |
.tile64, | |
.tile128, | |
.tile256, | |
.tile512, | |
.tile1024, | |
.tile2048, | |
.tile4096, | |
.tile8192 { | |
color: var(--secondary-text-color); | |
} | |
/* -=-=-=-= END OF TEXT COLOR =-=-=-=- */ | |
/* -=-=-=- START OF TEXT SIZE -=-=-=- */ | |
.tile128, | |
.tile256, | |
.tile512 { | |
font-size: calc(var(--pixel-size) * 3.25); | |
} | |
.tile1024, | |
.tile2048, | |
.tile4096, | |
.tile8192 { | |
font-size: calc(var(--pixel-size) * 2.75); | |
} | |
/* -=-=-=-= END OF TEXT SIZE =-=-=-=- */ | |
.tile2 { | |
box-shadow: | |
0 0 30px 10px rgba(243, 215, 116, 0), | |
inset 0 0 0 1px rgba(255, 255, 255, 0); | |
} | |
.tile4 { | |
background: #ede0c8; | |
box-shadow: | |
0 0 30px 10px rgba(243, 215, 116, 0), | |
inset 0 0 0 1px rgba(255, 255, 255, 0); | |
} | |
.tile8 { | |
background: #f2b179; | |
} | |
.tile16 { | |
background: #f59563; | |
} | |
.tile32 { | |
background: #f67c5f; | |
} | |
.tile64 { | |
background: #f65e3b; | |
} | |
.tile128 { | |
background: #edcf72; | |
box-shadow: | |
0 0 30px 10px rgba(243, 215, 116, 0.2381), | |
inset 0 0 0 1px rgba(255, 255, 255, 0.14286); | |
} | |
.tile256 { | |
background: #edcc61; | |
box-shadow: | |
0 0 30px 10px rgba(243, 215, 116, 0.31746), | |
inset 0 0 0 1px rgba(255, 255, 255, 0.19048); | |
} | |
.tile512 { | |
background: #edc850; | |
box-shadow: | |
0 0 30px 10px rgba(243, 215, 116, 0.39683), | |
inset 0 0 0 1px rgba(255, 255, 255, 0.2381); | |
} | |
.tile1024 { | |
background: #edc53f; | |
box-shadow: | |
0 0 30px 10px rgba(243, 215, 116, 0.47619), | |
inset 0 0 0 1px rgba(255, 255, 255, 0.28571); | |
} | |
.tile2048, | |
.tile4096, | |
.tile8192 { | |
background: #edc22e; | |
box-shadow: | |
0 0 30px 10px rgba(243, 215, 116, 0.55556), | |
inset 0 0 0 1px rgba(255, 255, 255, 0.33333); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment