Files
tetris.js/style.css
Marcel 06a2e582fd Major rework of basic game code - pre-work for multiplayer
Includes automatic generation of required HTML elements and better responsiveness
2019-07-18 11:49:06 +02:00

464 lines
8.4 KiB
CSS

body {
overflow: hidden;
margin: 0;
padding: 0;
background: #202028;
color: #fff;
font-family: Roboto, Helvetica, Arial, sans-serif;
font-size: 2.5em;
}
.menu {
position: absolute;
-moz-transform: scale(.5);
-ms-transform: scale(.5);
-o-transform: scale(.5);
-webkit-transform: scale(.5);
transform: scale(.5);
z-index: 1;
width: 3.5rem;
height: 2.7rem;
padding: 0;
border: 0;
background: 0;
outline: 0;
-webkit-transition: 0.1s -webkit-transform linear;
transition: 0.1s -webkit-transform linear;
transition: 0.1s transform linear;
transition: 0.1s transform linear, 0.1s -webkit-transform linear;
float: left;
}
#menu {
position: fixed;
top: 0;
transform: translateX(-100%);
z-index: 100;
width: 100%;
height: 100%;
background: rgba(0, 0, 0, .75);
-moz-transition: transform .5s;
-ms-transition: transform .5s;
-o-transition: transform .5s;
-webkit-transition: transform .5s;
transition: transform .5s;
}
#menu-content {
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
overflow: auto;
width: 375px;
max-width: 100%;
max-height: 90%;
font-size: .6em;
}
#menu-content > * {
padding: 20px;
border-bottom: 1px solid #444;
}
#menu-content > *:last-child {
border: none;
}
#menu-content h3 {
margin: 0 0 15px;
}
#help-controls dl {
height: 273px;
margin: 0;
}
#help-controls dt {
width: 30%;
margin-bottom: 10px;
float: left;
}
#help-controls dt code {
padding: 5px 10px;
border-radius: 5px;
background: rgba(255, 255, 255, 1);
color: #000;
}
#help-controls dd {
width: 70%;
margin: 0 0 10px;
float: left;
}
.menu-open #menu {
transform: none;
}
#menu-opener {
position: absolute;
top: 10px;
left: 10px;
z-index: 101;
}
.lang {
display: inline;
margin-left: 10px;
padding: 4px 8px;
border-radius: 2px;
cursor: pointer;
}
.lang.active {
background-color: #3877FF;
}
#game-title {
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -25%) translateY(-200px);
opacity: 1;
transition: opacity .5s;
}
#game-play, #game-reset {
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
width: 300px;
height: 75px;
border: 0 !important;
border-radius: 0 !important;
background: #3877FF !important;
color: #ffff !important;
box-shadow: none;
opacity: 1;
font-size: 30px;
cursor: pointer;
transition: box-shadow .2s, opacity .5s;
-webkit-text-fill-color: #fff;
}
#game-reset {
transform: translate(-50%, -50%) translateY(85px);
display: none;
background-color: #FF0D72 !important;
opacity: 0;
}
#game-play {
z-index: 10;
}
#game-play:hover, #game-play:active, #game-play:focus {
box-shadow: 3px 4px 0 3px rgba(0, 0, 0, 0.2) !important;
outline: none !important;
}
#background {
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
filter: url(#f2);
}
.blurred {
filter: url(#f1);
}
#canvas-container {
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
width: 761px;
height: 936px;
}
#tetris, #tetris-background {
position: absolute;
top: 50%;
left: 50%;
-moz-transform: translate(-50%, -50%);
-ms-transform: translate(-50%, -50%);
-o-transform: translate(-50%, -50%);
-webkit-transform: translate(-50%, -50%);
transform: translate(-50%, -50%);
z-index: 1;
border: solid .2em #fff;
background: transparent;
}
#tetris-background {
z-index: 0;
border: none;
}
#tetris-hold {
position: absolute;
left: 50%;
border: solid .2em #fff;
}
#tetris-upcoming {
position: absolute;
right: 50%;
border: solid .2em #fff;
}
/*.game-stats {*/
/* position: absolute;*/
/* bottom: 3.75vh;*/
/* left: 50%;*/
/* transform: translateX(-50%);*/
/* font-size: 2.5vh;*/
/*}*/
/**/
/*#score {*/
/* top: 2.5vh;*/
/* bottom: initial;*/
/* font-size: 5vh;*/
/* font-weight: 900;*/
/*}*/
/**/
#score.update {
animation: scoreUpdate .5s;
}
@keyframes scoreUpdate {
0% {
transform: scale(1);
}
50% {
transform: scale(1.5);
}
100% {
transform: scale(1);
}
}
#time:before, #score:before {
content: attr(data-prefix);
}
#controls {
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%) translateX(30vw);
max-width: 20vw;
font-size: 20px;
}
.game-over #score {
top: 50%;
}
#footer {
position: absolute;
right: 2.5%;
bottom: 10px;
left: 2.5%;
width: 95%;
color: rgba(255, 255, 255, .5);
font-size: 12px;
}
#version-author {
display: inline-block;
}
#corner-buttons {
position: absolute;
right: 0;
display: inline-block;
}
#corner-buttons > a {
left: 10px;
display: inline-block;
color: rgba(255, 255, 255, .5);
-moz-transition: color .2s;
-ms-transition: color .2s;
-o-transition: color .2s;
-webkit-transition: color .2s;
transition: color .2s;
text-decoration: none;
}
#corner-buttons > a:hover, #corner-buttons > a:active {
color: rgba(255, 255, 255, 1);
}
.bar, .bar::before, .bar::after {
position: absolute;
top: 50%;
left: 0;
width: 100%;
height: 0.3rem;
margin: auto;
background: #fff;
content: '';
-webkit-transition: 0.2s background linear 0.1s, 0.2s top linear 0.2s, 0.2s -webkit-transform linear;
transition: 0.2s background linear 0.1s, 0.2s top linear 0.2s, 0.2s transform linear;
}
.bar {
margin-top: -0.2rem;
}
.bar::before {
top: -1.2rem;
}
.bar::after {
top: 1.2rem;
}
.bar::before, .bar::after {
-webkit-transform: rotate(0deg);
transform: rotate(0deg);
}
.active .bar {
background: 0;
}
.active .bar::before {
-webkit-transform: rotate(45deg);
transform: rotate(45deg);
}
.active .bar::after {
-webkit-transform: rotate(-45deg);
transform: rotate(-45deg);
}
.active .bar::before, .active .bar::after {
top: 0;
}
.active .bar, .active .bar::before, .active .bar::after {
-webkit-transition: 0.2s background linear 0.1s, 0.2s top linear, 0.2s -webkit-transform linear 0.2s;
transition: 0.2s background linear 0.1s, 0.2s top linear, 0.2s -webkit-transform linear 0.2s;
transition: 0.2s background linear 0.1s, 0.2s top linear, 0.2s transform linear 0.2s;
transition: 0.2s background linear 0.1s, 0.2s top linear, 0.2s transform linear 0.2s, 0.2s -webkit-transform linear 0.2s;
}
/*
Radio Buttons
*/
.radio {
margin: 0.5rem;
}
.radio input[type="radio"] {
position: absolute;
opacity: 0;
}
.radio input[type="radio"] + .radio-label:before {
position: relative;
top: -0.2em;
display: inline-block;
width: 1.4em;
height: 1.4em;
margin-right: 1em;
border: 1px solid #b4b4b4;
border-radius: 100%;
background: #f4f4f4;
content: '';
text-align: center;
cursor: pointer;
-webkit-transition: all 250ms ease;
transition: all 250ms ease;
vertical-align: top;
}
.radio input[type="radio"]:checked + .radio-label:before {
background-color: #3197EE;
-webkit-box-shadow: inset 0 0 0 4px #f4f4f4;
box-shadow: inset 0 0 0 4px #f4f4f4;
}
.radio input[type="radio"]:focus + .radio-label:before {
border-color: #3197EE;
outline: none;
}
.radio input[type="radio"]:disabled + .radio-label:before {
border-color: #b4b4b4;
background: #b4b4b4;
-webkit-box-shadow: inset 0 0 0 4px #f4f4f4;
box-shadow: inset 0 0 0 4px #f4f4f4;
}
.radio input[type="radio"] + .radio-label:empty:before {
margin-right: 0;
}
/* Game */
.game-container {
display: flex;
height: calc(100vh - 40px);
}
.game-instance {
flex-grow: 1;
}
.score {
margin: 10px 0;
font-size: 40px;
text-align: center;
}
.score.update {
animation: scoreUpdate .5s;
}
.time {
font-size: 25px;
text-align: center;
margin: 10px 0;
}
.canvas-container {
position: relative;
display: block;
width: 80%;
margin: 0 auto;
}
.tetris-hold {
position: absolute;
top: 0;
left: 0;
width: 20%;
}
.tetris-arena, .tetris-background {
position: absolute;
top: 0;
left: 20%;
width: 60%;
height: 100%;
}
.tetris-upcoming {
position: absolute;
top: 0;
right: 0;
width: 20%;
}