/* =========================================================
   DICE
   ========================================================= */

.dice-page {
    min-height: calc(100vh - 75px);
    padding: 40px 7% 70px;

    background:
        radial-gradient(
            circle at 75% 20%,
            rgba(100, 75, 190, 0.10),
            transparent 35%
        );
}


/* =========================
   HEADER
   ========================= */

.dice-header {
    max-width: 1200px;
    margin: 0 auto 30px;

    display: flex;
    align-items: flex-start;
    gap: 25px;
}

.dice-back {
    margin-top: 4px;

    text-decoration: none;
    color: #858995;

    border: 1px solid #292d38;
    background: #101219;

    padding: 10px 14px;
    border-radius: 8px;

    font-size: 13px;

    transition: 0.2s;
}

.dice-back:hover {
    color: white;
    border-color: #4a4f5c;
}

.dice-header h1 {
    font-size: 38px;
    margin-top: 4px;
}

.dice-description {
    color: #717682;
    margin-top: 7px;
}


/* =========================
   LAYOUT
   ========================= */

.dice-layout {
    max-width: 1200px;
    margin: auto;

    display: grid;
    grid-template-columns: 300px 1fr;

    gap: 25px;
}


/* =========================
   PANEL
   ========================= */

.dice-panel {
    background:
        linear-gradient(
            180deg,
            #11141c,
            #0d0f15
        );

    border: 1px solid #242833;
    border-radius: 14px;

    padding: 22px;

    height: fit-content;

    position: sticky;
    top: 95px;
}

.dice-panel h2 {
    font-size: 21px;
}

.panel-subtitle {
    color: #686d79;
    font-size: 12px;
    margin-top: 5px;
}


/* =========================
   BET
   ========================= */

.dice-panel label {
    display: block;

    color: #858996;
    font-size: 12px;

    margin-top: 24px;
    margin-bottom: 8px;
}

.bet-input {
    height: 44px;

    display: flex;

    background: #171a22;

    border: 1px solid #292d38;

    border-radius: 8px;

    overflow: hidden;
}

.bet-input input {
    width: 100%;

    border: none;
    outline: none;

    background: transparent;

    color: white;

    padding: 12px;

    font-size: 14px;
}

.bet-input span {
    display: flex;
    align-items: center;

    padding: 0 11px;

    color: #666b77;

    font-size: 10px;
}


/* =========================
   CONDITION
   ========================= */

.dice-mode-title {
    color: #858995;

    font-size: 12px;

    margin-top: 22px;
    margin-bottom: 8px;
}


/* =========================
   MODE BUTTONS
   ========================= */

.mode-select {
    display: grid;

    grid-template-columns: 1fr 1fr;

    gap: 6px;

    background: #101219;

    border: 1px solid #292d38;

    border-radius: 9px;

    padding: 4px;
}

.mode-button {
    height: 36px;

    border: none;

    border-radius: 6px;

    background: transparent;

    color: #686d79;

    font-size: 11px;

    font-weight: 700;

    cursor: pointer;

    transition:
        background 0.2s,
        color 0.2s,
        transform 0.15s;
}

.mode-button:hover {
    color: white;
}

.mode-button.active {
    background: #242833;

    color: white;

    box-shadow:
        inset 0 1px rgba(255,255,255,0.04);
}

.mode-button:active {
    transform: scale(0.97);
}


.condition-box {
    background: #151821;

    border: 1px solid #292d38;

    border-radius: 9px;

    padding: 12px;
}

.condition-label {
    display: flex;
    justify-content: space-between;
    align-items: center;

    margin-bottom: 9px;
}

.condition-label span {
    color: #737783;
    font-size: 11px;
}

.condition-label strong {
    color: white;
    font-size: 18px;
}

.number-input {
    height: 40px;

    display: flex;

    background: #0f1118;

    border: 1px solid #252934;

    border-radius: 7px;

    overflow: hidden;
}

.number-input input {
    width: 100%;

    background: transparent;

    border: none;
    outline: none;

    color: white;

    padding: 10px;

    font-size: 14px;
}

.number-input span {
    display: flex;
    align-items: center;

    padding: 0 9px;

    color: #626773;

    font-size: 10px;
}


/* =========================
   CHANCE
   ========================= */

.chance-box {
    margin-top: 14px;

    background: #151821;

    border: 1px solid #222631;

    border-radius: 9px;

    padding: 13px 15px;
}

.chance-box > div {
    display: flex;

    justify-content: space-between;
    align-items: center;
}

.chance-box > div + div {
    margin-top: 9px;

    padding-top: 9px;

    border-top: 1px solid #222631;
}

.chance-box span {
    color: #6d727e;
    font-size: 11px;
}

.chance-box strong {
    font-size: 14px;
}


/* =========================
   ROLL BUTTON
   ========================= */

.roll-button {
    width: 100%;

    margin-top: 15px;

    padding: 14px;

    border: none;
    border-radius: 8px;

    background: white;
    color: #08090d;

    font-size: 14px;
    font-weight: 800;

    cursor: pointer;

    transition:
        transform 0.2s,
        background 0.2s;
}

.roll-button:hover {
    background: #e8e8e8;

    transform: translateY(-2px);
}

.roll-button:active {
    transform: scale(0.98);
}

.roll-button:disabled {
    opacity: 0.45;

    cursor: not-allowed;

    transform: none;
}


/* =========================
   LAST RESULT
   ========================= */

.last-result {
    margin-top: 13px;

    padding: 12px 14px;

    border-radius: 8px;

    background: #151821;

    display: flex;

    justify-content: space-between;
    align-items: center;
}

.last-result span {
    color: #666b76;

    font-size: 10px;
}

.last-result strong {
    font-size: 17px;
}


/* =========================
   GAME AREA
   ========================= */

.dice-game-area {
    min-width: 0;

    background:
        radial-gradient(
            circle at 50% 20%,
            rgba(100, 80, 180, 0.08),
            transparent 40%
        ),
        #0b0d12;

    border: 1px solid #20242d;

    border-radius: 16px;

    padding: 35px 40px;

    min-height: 650px;
}


/* =========================
   RESULT
   ========================= */

.result-area {
    height: 190px;

    display: flex;
    flex-direction: column;

    align-items: center;
    justify-content: center;
}

.result-cube {
    width: 95px;
    height: 95px;

    border-radius: 18px;

    display: flex;
    align-items: center;
    justify-content: center;

    background:
        linear-gradient(
            145deg,
            #252a35,
            #151821
        );

    border: 1px solid #3b404d;

    box-shadow:
        0 20px 45px rgba(0, 0, 0, 0.4),
        inset 0 1px rgba(255,255,255,0.05);

    font-size: 30px;
    font-weight: 900;

    transition:
        transform 0.25s,
        border-color 0.25s,
        background 0.25s;
}

.result-cube.rolling {
    animation: diceRoll 0.5s ease;
}

.result-cube.win {
    border-color: #3e7252;

    background:
        linear-gradient(
            145deg,
            #203528,
            #142019
        );

    color: #9be1ae;
}

.result-cube.lose {
    border-color: #713b40;

    background:
        linear-gradient(
            145deg,
            #3a2024,
            #1d1316
        );

    color: #ff969d;
}

.result-label {
    margin-top: 13px;

    color: #666b77;

    font-size: 12px;

    min-height: 16px;
}

.result-label.win {
    color: #8bc99d;
}

.result-label.lose {
    color: #e47b83;
}


/* =========================
   SCALE
   ========================= */

.dice-scale-wrapper {
    margin-top: 20px;

    width: 100%;
}

.scale-number-top {
    position: relative;

    display: flex;

    justify-content: space-between;

    align-items: center;

    color: #575c68;

    font-size: 10px;

    height: 35px;
}

.floating-result {
    position: absolute;

    left: 50%;

    bottom: 5px;

    transform: translateX(-50%);

    min-width: 43px;
    height: 30px;

    padding: 0 8px;

    display: flex;
    align-items: center;
    justify-content: center;

    background: #171a22;

    border: 1px solid #3a3f4b;

    border-radius: 7px;

    color: white;

    font-size: 11px;
    font-weight: 800;

    opacity: 0;

    transition:
        left 0.25s,
        opacity 0.25s;
}

.floating-result.visible {
    opacity: 1;
}

.floating-result::after {
    content: "";

    position: absolute;

    bottom: -5px;

    left: 50%;

    width: 8px;
    height: 8px;

    transform:
        translateX(-50%)
        rotate(45deg);

    background: #171a22;

    border-right: 1px solid #3a3f4b;
    border-bottom: 1px solid #3a3f4b;
}


/* =========================
   SCALE BAR
   ========================= */

.dice-scale {
    height: 18px;

    width: 100%;

    position: relative;

    display: flex;

    overflow: visible;

    border-radius: 9px;

    background: #262a33;

    border: 1px solid #353a46;

    cursor: pointer;

    user-select: none;
}

.scale-win {
    height: 100%;

    position: absolute;

    top: 0;

    background:
        linear-gradient(
            90deg,
            #315d43,
            #4d8b64
        );

    transition:
        width 0.2s,
        left 0.2s,
        right 0.2s;

    pointer-events: none;
}

.scale-lose {
    flex: 1;

    height: 100%;

    border-radius:
        0 9px 9px 0;

    background:
        linear-gradient(
            90deg,
            #4a292d,
            #382024
        );

    pointer-events: none;
}


/* =========================
   TARGET MARKER
   ========================= */

.scale-marker {
    position: absolute;

    top: -5px;

    left: 50%;

    width: 4px;
    height: 28px;

    transform: translateX(-50%);

    background: white;

    border-radius: 3px;

    box-shadow:
        0 0 12px rgba(255,255,255,0.35);

    transition:
        left 0.25s;

    pointer-events: none;

    z-index: 5;
}


/* =========================
   DRAG HANDLE
   ========================= */

.scale-handle {
    position: absolute;

    top: 50%;

    left: 50%;

    width: 24px;
    height: 24px;

    transform:
        translate(-50%, -50%);

    border-radius: 50%;

    background: #ffffff;

    border: 3px solid #171a22;

    box-shadow:
        0 2px 8px rgba(0,0,0,0.45),
        0 0 0 1px rgba(255,255,255,0.15);

    cursor: grab;

    z-index: 10;

    transition:
        left 0.15s,
        transform 0.15s;
}

.scale-handle:hover {
    transform:
        translate(-50%, -50%)
        scale(1.1);
}

.scale-handle:active {
    cursor: grabbing;

    transform:
        translate(-50%, -50%)
        scale(1.15);
}


.scale-labels {
    display: flex;

    justify-content: space-between;

    margin-top: 9px;

    color: #555a66;

    font-size: 10px;
}

.scale-labels span:nth-child(2) {
    color: #777c88;
    font-weight: 700;
}


/* =========================
   HISTORY
   ========================= */

.history-section {
    margin-top: 45px;

    border-top: 1px solid #20242d;

    padding-top: 25px;
}

.history-header {
    display: flex;

    align-items: center;

    justify-content: space-between;
}

.history-header p {
    color: #656a76;

    font-size: 10px;

    letter-spacing: 2px;
}

.history-header h2 {
    margin-top: 5px;

    font-size: 18px;
}

.history-header button {
    background: transparent;

    border: 1px solid #292d38;

    color: #707581;

    padding: 8px 11px;

    border-radius: 7px;

    font-size: 11px;

    cursor: pointer;
}

.history-header button:hover {
    color: white;

    border-color: #4a4f5c;
}


/* =========================
   HISTORY ITEMS
   ========================= */

.history-list {
    margin-top: 15px;

    display: flex;

    flex-direction: column;

    gap: 7px;
}

.empty-history {
    padding: 25px;

    text-align: center;

    color: #4f545f;

    background: #0f1118;

    border: 1px solid #20242d;

    border-radius: 8px;

    font-size: 12px;
}

.history-item {
    min-height: 52px;

    display: grid;

    grid-template-columns:
        70px
        1fr
        100px
        90px;

    align-items: center;

    gap: 15px;

    padding: 8px 13px;

    background: #101219;

    border: 1px solid #20242d;

    border-radius: 8px;
}

.history-number {
    font-size: 18px;

    font-weight: 900;
}

.history-condition {
    color: #696e7a;

    font-size: 11px;
}

.history-result {
    font-size: 11px;

    font-weight: 800;
}

.history-win {
    color: #8bd09f;
}

.history-lose {
    color: #e17b83;
}

.history-bet {
    text-align: right;

    color: #858a95;

    font-size: 11px;
}


/* =========================
   TOAST
   ========================= */

.dice-toast {
    position: fixed;

    right: 25px;
    bottom: 25px;

    min-width: 280px;

    display: flex;

    align-items: center;

    gap: 12px;

    padding: 14px 16px;

    background:
        linear-gradient(
            180deg,
            #171a22,
            #101219
        );

    border: 1px solid #383d49;

    border-radius: 11px;

    box-shadow:
        0 15px 40px rgba(0,0,0,0.45);

    opacity: 0;

    transform:
        translateY(20px)
        scale(0.96);

    pointer-events: none;

    transition:
        opacity 0.25s,
        transform 0.25s;

    z-index: 9999;
}

.dice-toast.show {
    opacity: 1;

    transform:
        translateY(0)
        scale(1);
}

.toast-icon {
    width: 30px;
    height: 30px;

    display: flex;

    align-items: center;
    justify-content: center;

    flex-shrink: 0;

    border-radius: 8px;

    background: #3a2529;

    border: 1px solid #643b41;

    color: #ff9da4;

    font-weight: 900;
}

.dice-toast strong {
    display: block;

    color: white;

    font-size: 12px;

    margin-bottom: 3px;
}

.dice-toast span {
    display: block;

    color: #777c87;

    font-size: 11px;
}


/* =========================
   ANIMATION
   ========================= */

@keyframes diceRoll {

    0% {
        transform:
            rotateX(0)
            rotateY(0)
            scale(1);
    }

    25% {
        transform:
            rotateX(25deg)
            rotateY(30deg)
            scale(0.9);
    }

    50% {
        transform:
            rotateX(-30deg)
            rotateY(-25deg)
            scale(1.08);
    }

    75% {
        transform:
            rotateX(20deg)
            rotateY(20deg)
            scale(0.95);
    }

    100% {
        transform:
            rotateX(0)
            rotateY(0)
            scale(1);
    }

}

.toast-icon.success-icon {
    color: #22c55e;
    background: rgba(34, 197, 94, 0.15);
}

.toast-icon.error-icon {
    color: #ef4444;
    background: rgba(239, 68, 68, 0.15);
}

/* =========================
   RESPONSIVE
   ========================= */

@media (max-width: 950px) {

    .dice-layout {
        grid-template-columns: 1fr;
    }

    .dice-panel {
        position: static;
    }

}

@media (max-width: 650px) {

    .dice-page {
        padding: 25px 15px 50px;
    }

    .dice-header {
        flex-direction: column;
        gap: 15px;
    }

    .dice-game-area {
        padding: 25px 15px;
    }

    .history-item {
        grid-template-columns:
            55px
            1fr
            70px;
    }

    .history-bet {
        display: none;
    }

    .dice-toast {
        left: 15px;
        right: 15px;
        bottom: 15px;

        min-width: 0;
    }

}
.quick-bets button {
    background: #111;
    color: #fff;
    border: 1px solid #333;
}

.quick-bets button:hover {
    background: #222;
}

.quick-bets button.active {
    background: #292929;
    border-color: #777;
}