* {
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

html,
body {
    margin: 0;
    padding: 0;
    width: 100%;
    height: 100%;
    overflow: hidden;
    font-family: Arial, Helvetica, sans-serif;
    background: #111;
    color: white;
}


body {
    display: flex;
    justify-content: center;
    align-items: flex-start;

    width: 100%;
    height: 100%;
    overflow: hidden;
}

#app {
    width: 100%;
    max-width: 600px;
    height: 100dvh;
    overflow: hidden;
    display: flex;
    flex-direction: column;

    background:
        linear-gradient(
            rgba(0,0,0,0.65),
            rgba(0,0,0,0.85)
        ),
        #222;
}



/* TOP */

#topBar {
    height: 52px;
    width: 100%;

    padding: 0;
    text-align:center;
    display:flex;
    flex-direction:column;
    align-items:center;
    justify-content:center;

    background:#181818;

    border:0;

    overflow:hidden;
}

#diceValuesDisplay{

    height:32px;

    display:flex;

    justify-content:center;

    align-items:center;

    gap:5px;

    margin-top:2px;

}


.mini-die{

    width:26px;
    height:26px;

    background:rgba(255,255,255,0.9);

    border-radius:5px;

    display:grid;

    grid-template-columns:repeat(3, 1fr);
    grid-template-rows:repeat(3, 1fr);

    padding:3px;

}


.dot{

    width:5px;
    height:5px;

    background:#111;

    border-radius:50%;

    justify-self:center;
    align-self:center;

}

.game-title {
    font-size: 18px;
    font-weight: bold;
    letter-spacing: 2px;
}



/* CONTENT */

#content {
    flex: 1;
    overflow:hidden;
    position:relative;
    min-height:0;
    width:100%;
    max-width:100%;
}


.screen {
    display:none;
    height:100%;
    width:100%;
    overflow-y:auto;
    overflow-x:hidden;
    padding:10px;
    text-align:center;
}


.screen.active {
    display: block;
}

#gameScreen.screen.active {
    display: flex;
}

/* BUTTONS */

button {
    width: 90%;
    max-width: 320px;

    min-height: 54px;

    margin: 10px auto;
    padding: 10px 16px;

    display: flex;
    align-items: center;
    justify-content: center;

    border: none;
    border-radius: 14px;

    background: #333;
    color: white;

    font-size: 18px;
    font-weight: bold;

    box-shadow: 0 3px 8px black;
}

button:active {
    transform: scale(0.97);
}



/* HOME */

.logo {
    font-size: 90px;
    margin: 50px 0 30px;
}



/* SETUP */

.player-buttons {
    display: flex;
    justify-content: center;
    gap: 10px;
}


.player-buttons button {
    width: 60px;
}


input {
    width: 90%;
    max-width: 320px;
    padding: 14px;
    margin: 8px;

    border-radius: 10px;
    border: none;

    font-size: 18px;
}


/* GAME */

.game-status {

    display: flex;

    justify-content: space-between;

    align-items: center;

    height: 35px;

    padding: 0 15px;

    font-size: 16px;

    margin: 0;

    background: transparent;

}


.dice {

    aspect-ratio: 1;

    background: white;

    color: black;

    border-radius: 15px;

    display: flex;
    align-items: center;
    justify-content: center;

    font-size: 45px;

    box-shadow: 0 5px 12px black;

}


/* GAME LAYOUT */

#gameScreen {
    display: none;
    height: 100%;
    flex-direction: column;
    overflow:hidden;
}


.dice-area {

    flex: 1;

    display: grid;

    grid-template-columns: repeat(3,1fr);

    gap: 20px;

    align-content: center;

    margin-top: 0;

}


.action-buttons {

    margin-top: auto;

    padding-bottom: 10px;

    display: flex;

    gap: 10px;

    justify-content: center;

}


.action-buttons button {

    flex: 1;

    width: auto;

    max-width: none;

    margin: 0;

    padding: 14px 5px;

    background: #555;

}

/* SCORE */

.score-list {

    text-align: left;

}


.score-list div {

    background: #222;

    margin: 6px 0;

    padding: 14px;

    border-radius: 10px;

    font-size: 18px;

    display: flex;

    justify-content: space-between;

}


.score-list span {

    color: #aaa;

}


hr {

    border: 0;

    height: 1px;

    background: #555;

}



/* HIGHSCORE */

.highscore {

    background: #222;

    padding: 20px;

    border-radius: 12px;

    font-size: 20px;

    line-height: 2;

}



/* BOTTOM MENU */

#bottomMenu {
    height: 70px;
    flex-shrink: 0;
    display: flex;
    flex-direction: row;
    background: #181818;
    border-top: 2px solid #444;
    z-index: 10;
}


#bottomMenu button {
    flex: 1;
    height: 70px;

    margin: 0;
    padding: 0;

    display: flex;
    align-items: center;
    justify-content: center;

    background: #333;
    color: white;

    font-size: 16px;

    border: 1px solid #555;
    border-radius: 0;

    box-shadow: none;
}


#threeContainer{

    width:100%;

    height:300px;

    background:#444;

    overflow:hidden;

}

.yatzy-effect {

    color: #ffd700;
    font-size: 34px;
    font-weight: 900;

    animation:
        yatzyPop 0.4s ease-out,
        yatzyPulse 0.6s infinite alternate;

}


@keyframes yatzyPop {

    0% {
        transform: scale(0);
        opacity:0;
    }

    70% {
        transform: scale(1.3);
        opacity:1;
    }

    100% {
        transform: scale(1);
    }

}


@keyframes yatzyPulse {

    from {

        text-shadow:
        0 0 5px #fff,
        0 0 10px gold;

    }


    to {

        text-shadow:
        0 0 15px #fff,
        0 0 30px gold,
        0 0 50px orange;

    }

}

.confetti-container{

    position:fixed;
    top:0;
    left:0;

    width:100%;
    height:100%;

    pointer-events:none;

    overflow:hidden;

    z-index:999;

}


.confetti{

    position:absolute;

    top:-20px;

    width:10px;
    height:18px;

    background:gold;

    animation: fall 4s ease-out forwards;

}


@keyframes fall{

    to{

        transform:
        translateY(110vh)
        rotate(720deg);

    }

}

#yatzyPopup {

    max-height:90dvh;

    overflow-y: auto;

    -webkit-overflow-scrolling: touch;

}

#yatzyPopup button {

    min-height:40px;

    font-size:15px;

    margin:5px auto;

}

.bank-ready {

    animation: bankPulse 1s infinite alternate;

}


@keyframes bankPulse {

    from {

        box-shadow:
        0 0 5px #ffd700;

    }


    to {

        box-shadow:
        0 0 20px #ffd700,
        0 0 35px orange;

    }

}

.bonus-effect{

    position:fixed;

    top:35%;

    left:50%;

    transform:translate(-50%,-50%);

    color:#ffd700;

    font-size:30px;
    white-space:nowrap;

    font-weight:900;

    text-shadow:
        0 0 10px gold,
        0 0 25px orange;

    animation:
        bonusPop 0.5s ease-out;

    z-index:1000;

}


@keyframes bonusPop{

    0%{
        transform:
        translate(-50%,-50%)
        scale(0);
    }

    70%{
        transform:
        translate(-50%,-50%)
        scale(1.2);
    }

    100%{
        transform:
        translate(-50%,-50%)
        scale(1);
    }

}

#opponentStatus{
    position: fixed;
    left: 50%;
    top: 35%;
    transform: translate(-50%, -50%);
    z-index: 9999;

    font-size: 32px;
    font-weight: bold;

    pointer-events: none;
    opacity: 0;
}

#opponentStatus.show{
    animation: opponentStatusFly 2.8s ease-out forwards;
}

@keyframes opponentStatusFly{

    0%{
        opacity: 0;
        transform:
            translate(-50%, 80px)
            scale(0.7);
    }

    15%{
        opacity: 1;
    }

    70%{
        opacity: 1;
    }

    100%{
        opacity: 0;
        transform:
            translate(-50%, -120px)
            scale(1.15);
    }

}

/* LANDSCAPE */

@media screen and (orientation: landscape) {

    #app {

        max-width: 900px;

    }

}

