breakout71/src/game.less
2025-04-12 20:58:24 +02:00

546 lines
8.2 KiB
Text

* {
font-family:
Courier New,
Courier,
Lucida Sans Typewriter,
Lucida Typewriter,
monospace;
box-sizing: border-box;
}
body {
margin: 0;
padding: 0;
overflow: hidden;
width: 100vw;
height: 100vh;
height: calc(var(--vh, 1vh) * 100);
color: white;
background-size: 120px 120px;
background-color: var(--background1);
--background1: #030c23;
--background2: #03112a;
}
#game {
position: fixed;
top: 0;
left: 0;
height: 100vh;
height: calc(var(--vh, 1vh) * 100);
width: 100vw;
}
canvas:not(#game) {
display: none;
}
#score,
#menu {
position: absolute;
top: 0;
z-index: 1;
padding: 10px;
appearance: none;
background: none;
border: none;
font: inherit;
color: white;
min-width: 40px;
min-height: 40px;
line-height: 20px;
max-width: calc(100vw - 80px);
overflow: hidden;
&:hover,
&:focus {
background: rgba(0, 0, 0, 0.3);
cursor: pointer;
}
text-shadow: 0 0 4px var(--level-background);
}
#score {
right: 0;
color: white;
transition: color 0.3s;
&.active .score {
color: gold;
transition: color 0.01s;
}
&.hidden {
display: none;
}
span {
color: rgba(255, 255, 255, 0.8);
&.great {
color: lightgreen;
}
&.good {
color: white;
}
&.bad {
color: white;
}
}
}
#menu {
left: 0;
}
body.has-alert-open {
height: auto;
overflow: visible;
}
body:not(.has-alert-open) #popup {
display: none;
}
#popup {
&::before {
z-index: 10;
content: "";
display: block;
position: fixed;
inset: 0;
background: rgba(0, 0, 0, 0.9);
}
display: flex;
overflow: auto;
& > div {
z-index: 11;
position: relative;
margin: auto;
padding: 20px 10px;
transform-origin: center;
display: flex;
flex-direction: column;
align-items: stretch;
width: 100%;
max-width: 500px;
& > * {
padding: 0;
margin: 0 0 20px 0;
}
& > section {
display: flex;
flex-direction: column;
align-items: stretch;
button {
font: inherit;
background: rgba(0, 0, 0, 0.8);
color: white;
padding: 10px;
cursor: pointer;
border: 1px solid white;
text-align: left;
display: flex;
gap: 10px;
margin-top: -1px;
&:not([disabled]):hover,
&:not([disabled]):focus {
border-color: #f1d33b;
position: relative;
z-index: 1;
}
&[disabled] {
opacity: 0.5;
filter: saturate(0);
//pointer-events: none;
cursor: not-allowed;
}
& > div {
flex-grow: 1;
}
& > div > em {
display: block;
opacity: 0.8;
}
&.grey-out-unless-hovered {
&:not(:hover) {
opacity: 0.6;
img {
filter: saturate(0);
}
}
&[disabled] {
opacity: 0.2;
}
}
}
}
}
&.actionsAsGrid > div {
max-width: none;
& > div,
& > p,
& > h1,
& > h2 {
width: 100%;
max-width: 550px;
margin-left: auto;
margin-right: auto;
}
section {
display: grid;
grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
}
}
button#close-modale {
color: white;
position: fixed;
top: 0;
right: 0;
width: 60px;
height: 60px;
background: transparent;
border: none;
cursor: pointer;
overflow: hidden;
z-index: 12;
&:before {
content: "+";
position: absolute;
transform: translate(-50%, -50%) rotate(45deg);
font-size: 80px;
display: inline-block;
top: 34px;
left: 26px;
}
&:hover {
font-weight: bold;
background: black;
}
}
.textAfterButtons {
color: rgba(255, 255, 255, 0.58);
}
a[href] {
color: inherit;
&:hover,
&:focus {
color: white;
}
}
@media (min-width: 1400px) {
&.settings {
&:before {
opacity: 0;
}
& > div {
margin-right: 0;
max-width: 400px;
}
}
}
}
/*Unlocks progress bar*/
.progress {
display: block;
padding: 5px 10px;
background: #1c1c2f;
color: #fff;
box-shadow: inset 3px 3px 5px rgba(0, 0, 0, 0.5);
border-radius: 5px;
text-align: center;
position: relative;
overflow: hidden;
& > .progress_bar_part {
display: block;
background: #4049ca;
box-shadow: inset 3px 3px 5px rgba(0, 0, 0, 0.5);
left: 0;
position: absolute;
right: 0;
top: 0;
bottom: 0;
transform-origin: top left;
animation: grow 1s both ease-out;
z-index: 1;
}
& > span {
display: block;
position: relative;
z-index: 2;
}
@keyframes grow {
0% {
transform: scale(0, 1);
}
}
}
#level-recording-container {
max-width: 400px;
text-align: center;
margin: 40px;
video {
max-width: 100%;
height: auto;
}
a {
display: block;
video {
border-radius: 10px;
display: block;
outline: 1px solid white;
box-shadow: 2px 2px 5px black;
margin: 20px auto;
}
}
}
.histogram {
display: flex;
gap: 10px;
align-items: stretch;
margin: 10px 0 40px 0;
& > span {
/* Hover zone */
flex-grow: 1;
width: 10px;
position: relative;
display: flex;
flex-direction: column;
justify-content: flex-end;
&.active > span {
background: #4049ca;
}
& > span {
/*Visible bar*/
background: #1c1c2f;
width: 100%;
display: block;
border-radius: 5px;
min-height: 1px;
& > span {
/*label */
position: absolute;
bottom: -20px;
pointer-events: none;
white-space: nowrap;
transform-origin: bottom left;
font-size: 13px;
text-align: center;
display: block;
left: 50%;
transform: translate(-50%, 0);
}
}
}
& > span:not(:hover):not(.active) > span > span {
opacity: 0;
}
}
h2.histogram-title {
color: #3b3f75;
font-size: 18px;
}
h2.histogram-title strong {
color: #4049ca;
}
.red-icon {
background: red;
img {
filter: saturate(0);
mix-blend-mode: luminosity;
}
}
.upgrade {
display: flex;
gap: 2px;
margin: 0 0 10px 0;
img {
width: 32px;
height: 32px;
}
p {
flex-grow: 1;
color: rgba(255, 255, 255, 0.6);
margin: 0 20px;
}
&.used p strong {
color: white;
}
& > span {
flex-grow: 0;
flex-shrink: 0;
width: 5px;
display: inline-block;
height: 32px;
align-self: center;
&.used {
background: #fff;
}
&.free {
background: #fff;
opacity: 0.25;
}
&.banned {
background: red;
}
}
&.used {
opacity: 1;
}
&.free {
opacity: 0.8;
}
&.banned {
opacity: 0.8;
}
}
#tooltip {
display: block;
position: fixed;
left: 0;
top: 0;
background: black;
color: white;
padding: 10px;
z-index: 11;
border-radius: 2px;
pointer-events: none;
user-select: none;
opacity: 1;
border: 1px solid white;
max-width: 300px;
}
#popup.history > div {
max-width: none;
table {
th:hover {
cursor: pointer;
background: black;
}
td,
th {
padding: 0 5px;
line-height: 20px;
text-align: right;
}
th:first-child,
td:first-child {
text-align: left;
}
img {
width: 20px;
height: auto;
pointer-events: none;
}
tr:nth-child(2n) {
background: rgba(0, 0, 0, 0.58);
}
}
}
.progress-inline {
position: absolute;
display: block;
background: grey;
left: 62px;
right: 2px;
height: 7px;
bottom: 2px;
border-radius: 2px;
span {
position: absolute;
inset: 1px;
transform-origin: top left;
background: white;
}
}
.toast {
position: fixed;
left: 0;
top: 40px;
display: flex;
align-items: center;
gap: 10px;
opacity: 0.8;
background: black;
border: 1px solid white;
border-radius: 2px;
padding-right: 10px;
pointer-events: none;
animation: toast forwards;
}
@keyframes toast {
0%,
100% {
opacity: 0;
transform: translate(-20px, -20px) scale(0.5);
}
10%,
90% {
opacity: 0.8;
transform: none;
}
}