* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    scroll-behavior: smooth;
}

body {
    min-height: 100vh;
    padding: 16px;
    color: #ffffff;
    text-align: center;
    font-family: Arial, Helvetica, sans-serif;

    background:
        linear-gradient(
            rgba(0, 0, 0, 0.48),
            rgba(0, 0, 0, 0.48)
        ),
        url("images/peryahan.png");

    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    background-attachment: fixed;
}

button,
select,
input {
    font: inherit;
}

button {
    border: 0;
    border-radius: 14px;
    padding: 11px 22px;
    color: #ffffff;
    background: #3498db;
    font-weight: 700;
    cursor: pointer;
    transition:
        transform 0.18s ease,
        opacity 0.18s ease,
        background 0.18s ease;
}

button:hover:not(:disabled) {
    background: #2980b9;
    transform: scale(1.03);
}

button:active:not(:disabled) {
    transform: scale(0.97);
}

button:disabled {
    opacity: 0.55;
    cursor: not-allowed;
}

.logo {
    display: block;
    width: min(700px, 96%);
    margin: 0 auto 12px;
    user-select: none;
    -webkit-user-drag: none;
}

main {
    width: min(900px, 100%);
    margin: 0 auto;
}

.card {
    width: 100%;
    margin: 18px auto;
    padding: 22px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 22px;
    background: rgba(0, 0, 0, 0.42);
    box-shadow: 0 10px 28px rgba(0, 0, 0, 0.32);
    backdrop-filter: blur(6px);
}

.loadingCard {
    margin-top: 40px;
}

.roleText {
    margin-bottom: 8px;
    font-size: 18px;
    font-weight: 700;
}

.roomStatus {
    margin-bottom: 16px;
    color: #ffdc62;
    font-size: 19px;
    font-weight: 700;
}

.gameIdBox {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 9px;
    flex-wrap: wrap;
    margin-bottom: 18px;
}

#gameId {
    color: #ffd700;
    font-size: 22px;
    font-weight: 800;
    letter-spacing: 3px;
}

.smallButton {
    padding: 7px 12px;
    border-radius: 9px;
    background: #27ae60;
    font-size: 14px;
}

.hostSettings {
    margin-bottom: 8px;
}

.hostSettings label {
    display: block;
    margin-bottom: 8px;
    font-size: 18px;
    font-weight: 700;
}

select {
    padding: 8px 15px;
    border: 0;
    border-radius: 10px;
    background: #ffffff;
    color: #111111;
    cursor: pointer;
}

.results,
.currentResult {
    min-height: 125px;
    display: flex;
    justify-content: center;
    align-items: center;
    align-content: center;
    flex-wrap: wrap;
    gap: 8px;
    margin: 12px auto;
    max-width: 100%;
}

.dice {
    width: clamp(58px, 9vw, 92px);
    height: clamp(58px, 9vw, 92px);
    object-fit: contain;
}

.currentResultDice {
    width: 70px;
    height: 70px;
    object-fit: contain;
}

.rollButton {
    display: block;
    min-width: 240px;
    margin: 13px auto 5px;
    padding: 14px 34px;
    font-size: 22px;
}

.waitingText {
    margin-top: 12px;
    color: #dedede;
}

.shake {
    animation: shake 0.35s infinite;
}

@keyframes shake {

    0% {
        transform: translate(0, 0) rotate(0deg);
    }

    25% {
        transform: translate(-5px, 3px) rotate(-9deg);
    }

    50% {
        transform: translate(5px, -3px) rotate(9deg);
    }

    75% {
        transform: translate(-3px, 2px) rotate(-5deg);
    }

    100% {
        transform: translate(0, 0) rotate(0deg);
    }
}

.historyBox {
    width: min(430px, 100%);
    background:
        linear-gradient(
            rgba(0, 0, 0, 0.52),
            rgba(0, 0, 0, 0.52)
        ),
        url("images/previous5.png");

    background-size: cover;
    background-position: center;
}

.historyBox h2,
.currentResultPanel h2,
.joinBox h2,
.about h2 {
    margin-bottom: 14px;
}

#history {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.historyRow {
    display: flex;
    justify-content: center;
    align-items: center;
    align-content: center;
    flex-wrap: wrap;
    gap: 5px;
    min-height: 34px;
    max-width: 100%;
}

.historyDice {
    width: 26px;
    height: 26px;
    object-fit: contain;
    flex: 0 0 auto;
}

.emptyHistory {
    color: #dddddd;
}

.joinControls {
    display: flex;
    justify-content: center;
    gap: 10px;
    flex-wrap: wrap;
}

#joinRoomId {
    width: min(280px, 100%);
    padding: 11px 13px;
    border: 0;
    border-radius: 11px;
    text-align: center;
    text-transform: uppercase;
    letter-spacing: 2px;
}

.joinMessage {
    min-height: 24px;
    margin-top: 12px;
    color: #9ff1b8;
}

.errorMessage {
    color: #ff9b9b;
}

.about {
    line-height: 1.65;
}

.about p + p {
    margin-top: 10px;
}

@media (max-width: 700px) {

    body {
        padding: 10px;
    }

    .card {
        padding: 17px 12px;
        border-radius: 18px;
    }

    .dice {
        width: 58px;
        height: 58px;
    }

    .results {
        min-height: 95px;
        gap: 7px;
    }

    .rollButton {
        width: min(300px, 95%);
        min-width: 0;
        font-size: 19px;
    }

    .currentResultDice {
        width: 48px;
        height: 48px;
    }

    .joinControls button,
    #joinRoomId {
        width: min(320px, 95%);
    }

    #gameId {
        font-size: 19px;
    }
}

#currentResultPanel {
    display: none !important;
}


@media (max-width: 420px) {
    .dice {
        width: 48px;
        height: 48px;
    }

    .results,
    .currentResult {
        gap: 5px;
    }

    .historyDice {
        width: 21px;
        height: 21px;
    }

    .historyRow {
        gap: 3px;
    }
}
