You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 

157 lines
3.0 KiB

:root {
--clr-white: #fff;
--clr-black: #000;
--clr-green: #3FB83E;
--ff-base: system-ui, sans-serif;
font: 16px/1.4 var(--ff-base);
}
body {
margin: 0;
display: flex;
flex-direction: column;
gap: 0;
min-height: 100vh;
min-height: 100svh;
-webkit-font-smoothing: antialiased;
touch-action: manipulation;
background-color: var(--clr-green);
}
button {
cursor: pointer;
}
ul[class] {
margin: 0;
padding: 0;
list-style: none;
}
form {
margin: 0;
}
header {
background-color: var(--clr-white);
position: fixed;
inset: 1rem 1rem auto 1rem;
padding: 0.875rem 1rem;
display: flex;
justify-content: space-between;
align-items: center;
box-shadow: 0px 2px 2px 0px #0000000A;
z-index: 100;
anchor-name: --header;
> a {
flex-grow: 1;
max-width: 12.6875rem;
}
}
#inter-ikea-systems {
position: absolute;
position-anchor: --header;
right: anchor(right);
top: calc(anchor(bottom) + 1.25rem);
}
main {
display: flex;
flex-direction: column;
min-height: 100vh;
min-height: 100svh;
align-items: center;
justify-content: center;
gap: 3rem;
}
button#dice {
display: block;
background-color: var(--clr-white);
border-radius: 1.25rem;
border: none;
appearance: none;
width: 11rem;
height: 11rem;
padding: 1.5rem;
box-sizing: border-box;
}
button#dice.is-rolling {
animation: dice-roll 0.4s ease;
}
@keyframes dice-roll {
0% { transform: rotate(0) scale(1); }
50% { transform: rotate(180deg) scale(0.85); }
100% { transform: rotate(360deg) scale(1); }
}
.dice__face {
display: grid;
grid-template-columns: repeat(3, 1fr);
grid-template-rows: repeat(3, 1fr);
gap: 1rem;
width: 100%;
height: 100%;
padding: 0;
box-sizing: border-box;
}
.pip {
align-self: center;
justify-self: center;
width: 2rem;
height: 2rem;
border-radius: 50%;
background-color: var(--clr-black);
visibility: hidden;
}
.pip--tl { grid-area: 1 / 1; }
.pip--tr { grid-area: 1 / 3; }
.pip--ml { grid-area: 2 / 1; }
.pip--c { grid-area: 2 / 2; }
.pip--mr { grid-area: 2 / 3; }
.pip--bl { grid-area: 3 / 1; }
.pip--br { grid-area: 3 / 3; }
/* Show the pips that belong to each value. */
.dice__face[data-value="1"] .pip--c,
.dice__face[data-value="2"] .pip--tl,
.dice__face[data-value="2"] .pip--br,
.dice__face[data-value="3"] .pip--tl,
.dice__face[data-value="3"] .pip--c,
.dice__face[data-value="3"] .pip--br,
.dice__face[data-value="4"] .pip--tl,
.dice__face[data-value="4"] .pip--tr,
.dice__face[data-value="4"] .pip--bl,
.dice__face[data-value="4"] .pip--br,
.dice__face[data-value="5"] .pip--tl,
.dice__face[data-value="5"] .pip--tr,
.dice__face[data-value="5"] .pip--c,
.dice__face[data-value="5"] .pip--bl,
.dice__face[data-value="5"] .pip--br,
.dice__face[data-value="6"] .pip--tl,
.dice__face[data-value="6"] .pip--tr,
.dice__face[data-value="6"] .pip--ml,
.dice__face[data-value="6"] .pip--mr,
.dice__face[data-value="6"] .pip--bl,
.dice__face[data-value="6"] .pip--br {
visibility: visible;
}