statki/public/assets/css/board.css
2024-03-25 13:44:30 +01:00

295 lines
5.1 KiB
CSS

:root {
font-size: 20px;
--field: rgb(36, 36, 36);
--mark-line: rgb(59, 59, 59);
--mark-spot: rgb(90, 90, 90);
--mark-ship-valid: hsl(120, 100%, 80%);
--mark-ship-invalid: hsl(0, 100%, 80%);
--mark-hit: #ffffff;
--ship-valid: hsl(120, 70%, 55%);
--ship-invalid: hsl(0, 70%, 55%);
--ship-miss: hsl(0, 0%, 18%);
--ship-ally-sunken: hsl(120, 30%, 30%);
--ship-enemy-sunken: hsl(0, 30%, 30%);
--dynamic: rgb(83, 83, 245);
--danger: rgb(243, 56, 56);
--important: rgb(203, 50, 241);
color: rgb(136, 136, 136)
}
#gameView {
display: flex;
}
body {
background-color: black;
color: white;
font-family: 'Lato', sans-serif;
transition: opacity 0.3s ease;
animation: fadeIn 1 0.3s ease;
}
@keyframes fadeIn {
from {opacity: 0;}
to {opacity: 1;}
}
h1,h2,h3,h4,h5,h6 {
font-family: 'Poppins', sans-serif;
}
.designerTag {
position: fixed;
bottom: 5px;
left: 5px;
color: rgb(0, 255, 0);
font-size: 9px;
pointer-events: none;
user-select: none;
z-index: 999;
font-family: 'Roboto Mono', monospace;
}
.board {
display: flex;
grid-template-columns: auto auto auto;
flex-direction: column;
}
.row {
margin-bottom: 0.4rem;
display: flex;
gap: 0.4rem;
}
.field {
background-color: var(--field);
width: 2rem;
aspect-ratio: 1;
border-radius: 20%;
cursor: pointer;
transition: background-color 0.1s;
}
.field .shipField {
width: 100%;
aspect-ratio: 1;
border-radius: 20%;
background-color: var(--ship-valid);
pointer-events: none;
opacity: 0;
transform: scale(0);
transition: opacity 0.25s, transform 0.25s 0.05s, background-color 0.25s;
}
#secondaryBoard .field .shipField {
background-color: var(--ship-invalid);
}
.field.active .shipField {
transform: scale(1);
opacity: 1;
}
.field svg {
opacity: 0;
width: 100%;
aspect-ratio: 1;
display: block;
border-radius: 20%;
transform: scale(0);
transition: opacity 0.25s, transform 0.25s 0.05s;
}
.field.hit svg {
transform: scale(1);
opacity: 1;
}
#board .field.sunken .shipField {
background-color: var(--ship-ally-sunken);
}
#secondaryBoard .field.sunken .shipField {
background-color: var(--ship-enemy-sunken);
}
.dynamic {
color: var(--dynamic);
}
.important {
color: var(--important);
}
.danger {
color: var(--danger);
}
.container {
display: flex;
justify-content: center;
text-align: center;
transition: 0.15s opacity;
}
.shapes h2, .shapes h3 {
margin: 0;
}
.shapes, .spaceFiller {
width: 15rem;
user-select: none;
pointer-events: none;
}
.break {
display: block;
margin-top: 3rem;
}
.panelContainer {
display: flex;
gap: 1rem;
}
.boardContainer {
width: 25rem;
display: flex;
justify-content: center;
}
#secondaryBoard, #board {
position: absolute;
transition: transform 0.3s;
background: black;
}
.ownBoardInfo {
transition: opacity 0.3s;
}
#boardSwitch {
opacity: 0.3;
transition: opacity 0.3s;
}
.secondary {
transform: translateX(75%) scale(0.3);
pointer-events: none;
z-index: 1;
}
#board:not(.secondary), #secondaryBoard:not(.secondary) {
z-index: 2;
}
.controlsOwnBoard {
transition: opacity 0.3s;
}
@keyframes changingOut {
from {transform: translateX(0);opacity:1;}
to {transform: translateX(30%);opacity:0;}
}
@keyframes changingIn {
from {transform: translateX(-30%);opacity:0;}
to {transform: translateX(0);opacity:1;}
}
#selectedShip.changing {
opacity: 0;
animation: changingOut 1 0.2s ease;
}
#selectedShip {
animation: changingIn 1 0.2s ease;
}
.cover {
position: fixed;
width: 100%;
height: 100%;
top: 0;
left: 0;
display: flex;
justify-content: center;
align-items: center;
text-align: center;
background-color: rgb(0, 0, 0, 0.6);
backdrop-filter: blur(20px);
transition: opacity 0.5s, transform 0.5s;
z-index: 999;
}
.cover .dialog {
background-color: rgba(0, 0, 0, 0.6);
text-align: center;
padding: 2rem 4rem;
display: none;
justify-content: center;
align-items: center;
flex-direction: column;
border-radius: 15px;
gap: 1rem;
border: solid 1px white;
}
.cover .dialog button {
padding: 0.5rem 2rem;
font-size: 1rem;
background-color: black;
border: solid 1px white;
color: white;
border-radius: 15px;
outline: none;
cursor: pointer;
transition: all 0.3s;
}
.cover .dialog button:hover {
background-color: white;
color: black;
}
.cover .dialog * {
margin: 0;
}
.cover.postGame .title {
display: none;
}
.cover.postGame .dialog {
display: flex;
}
#timer {
transition: color 0.3s;
}
@keyframes timerDanger {
0% { color: var(--important); transform: scale(1); }
50% { color: var(--danger); transform: scale(1.1); }
100% { color: var(--important); transform: scale(1); }
}
#timer.active {
animation: timerDanger 1s infinite ease;
}
.tippyTemplate {
display: none;
}
.mobileControls {
display: none;
}