@import url("https://fonts.googleapis.com/css2?family=Barlow+Condensed:wght@500;600;700&family=Space+Grotesk:wght@500;600;700&display=swap");

.dice-page-wrapper {
    max-width: 1160px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    gap: 18px;
}

.dice-page {
    display: grid;
    grid-template-columns: 300px 1fr;
    background: #0f2a3b;
    border: 1px solid #1c3d52;
    border-radius: 10px;
    overflow: hidden;
    box-shadow: 0 14px 30px rgba(0, 0, 0, 0.35);
}

.dice-controls {
    background: #203f52;
    border-right: 1px solid #2f5a73;
    padding: 12px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.auto-only {
    display: none;
}

.manual-only {
    display: block;
}

.dice-controls.auto-mode .auto-only {
    display: block;
}

.dice-controls.auto-mode .manual-only {
    display: none;
}

.dice-mode-toggle {
    background: #102b3b;
    border: 1px solid #315c74;
    border-radius: 999px;
    padding: 4px;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 4px;
}

.dice-mode-toggle .mode-btn {
    min-height: 36px;
    border: none;
    border-radius: 999px;
    background: transparent;
    color: #d8ebf6;
    font: 600 14px "Space Grotesk", sans-serif;
    cursor: pointer;
}

.dice-mode-toggle .mode-btn.active {
    background: #3f6379;
    color: #f4fbff;
}

.dice-controls label {
    color: #d7e8f3;
    font: 500 14px "Space Grotesk", sans-serif;
    display: block;
    margin-bottom: 6px;
}

.dice-input-row {
    min-height: 42px;
    border: 1px solid #3f6379;
    border-radius: 8px;
    background: #143245;
    display: flex;
    align-items: center;
    overflow: hidden;
}

.dice-input-row input {
    width: 100%;
    border: none;
    outline: none;
    background: transparent;
    color: #f2fbff;
    font: 700 30px "Barlow Condensed", sans-serif;
    padding: 6px 10px;
}

.dice-input-row input::-webkit-outer-spin-button,
.dice-input-row input::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

.dice-currency {
    width: 20px;
    height: 20px;
    margin-right: 8px;
    border-radius: 999px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: #ffd400;
    color: #0f2a1e;
    font: 700 13px "Space Grotesk", sans-serif;
}

.dice-modifiers {
    display: flex;
    align-items: stretch;
    height: 100%;
    border-left: 1px solid #3f6073;
    margin-left: 0;
}

.dice-mod-btn {
    min-width: 48px;
    border: none;
    background: #3e6276;
    color: #eef9ff;
    font: 600 18px "Barlow Condensed", sans-serif;
    cursor: pointer;
    height: 100%;
}

.dice-mod-btn + .dice-mod-btn {
    border-left: 1px solid #567b92;
}

.dice-play-btn {
    min-height: 42px;
    border: none;
    border-radius: 8px;
    background: #277cd8;
    color: #edf9ff;
    font: 700 18px "Barlow Condensed", sans-serif;
    cursor: pointer;
}

.dice-play-btn.stop-state {
    background: #9f4056;
}

.dice-play-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.auto-games-row input {
    font-size: 26px;
}

.auto-infinity {
    width: 34px;
    min-width: 34px;
    height: 100%;
    color: #c7deeb;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.dice-toggle-switch {
    width: 54px;
    height: 30px;
    border: 1px solid #5a7a8f;
    border-radius: 999px;
    background: #1a3547;
    position: relative;
    cursor: pointer;
}

.dice-toggle-switch .toggle-knob {
    position: absolute;
    left: 3px;
    top: 3px;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: #ffffff;
    transition: transform 0.2s ease;
}

.dice-toggle-switch[aria-pressed="true"] {
    background: #2c7fce;
    border-color: #5ea8ef;
}

.dice-toggle-switch[aria-pressed="true"] .toggle-knob {
    transform: translateX(24px);
}

.dice-main {
    padding: 18px 20px 12px;
    background:
        radial-gradient(120% 90% at 50% 8%, #102e43 0%, #0b2536 62%, #081d2b 100%);
    display: flex;
    flex-direction: column;
    min-height: 610px;
}

.dice-result-head {
    min-height: 46px;
    display: flex;
    justify-content: stretch;
    align-items: center;
    color: #d8ebf6;
    font: 600 14px "Space Grotesk", sans-serif;
    margin-bottom: 8px;
}

.dice-result-head .recent-rolls {
    position: relative;
    width: 100%;
    min-height: 40px;
    overflow: hidden;
}

.dice-result-head .recent-rolls-track {
    position: absolute;
    right: 0;
    top: 0;
    display: flex;
    gap: 8px;
    white-space: nowrap;
}

.dice-result-head .roll-pill {
    flex: 0 0 auto;
    min-width: 62px;
    padding: 7px 10px;
    border-radius: 999px;
    text-align: center;
    font: 600 12px "Space Grotesk", sans-serif;
    background: #2f4e61;
    color: #f2f8fb;
}

.dice-result-head .roll-pill.win {
    background: #00e701;
    color: #06210c;
}

.dice-ruler {
    margin: 116px 78px 8px;
    display: flex;
    justify-content: space-between;
    color: #e7f6ff;
    font: 700 15px "Barlow Condensed", sans-serif;
}

.dice-slider-wrap {
    margin: 0 52px;
}

.dice-track-shell {
    height: 56px;
    border-radius: 999px;
    background: #2f5268;
    border: 1px solid #355c73;
    position: relative;
    cursor: pointer;
}

.dice-track-red,
.dice-track-green {
    position: absolute;
    top: 22px;
    height: 10px;
    border-radius: 999px;
}

.dice-track-red {
    left: 20px;
    background: #ff244c;
    width: 50%;
}

.dice-track-green {
    left: 50%;
    background: #10d100;
    width: calc(50% - 20px);
}

.dice-thumb {
    position: absolute;
    top: 10px;
    transform: translateX(-50%);
    width: 34px;
    height: 36px;
    border: none;
    border-radius: 4px;
    background: #3f8ce0;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.3);
    cursor: grab;
}

.dice-thumb:active {
    cursor: grabbing;
}

.dice-thumb::before {
    content: "|||";
    color: #2f6cb0;
    font: 700 14px "Barlow Condensed", sans-serif;
}

.dice-roll-marker {
    position: absolute;
    top: -52px;
    transform: translateX(-50%) translateY(6px) scale(0.9);
    width: 72px;
    height: 72px;
    clip-path: polygon(50% 0%, 95% 25%, 95% 75%, 50% 100%, 5% 75%, 5% 25%);
    background: #eef4f8;
    border: 1px solid #bfd2df;
    box-shadow: 0 10px 22px rgba(0, 0, 0, 0.28);
    opacity: 0;
    pointer-events: none;
    transition:
        transform var(--dice-roll-transition-ms, 220ms) ease,
        opacity var(--dice-roll-transition-ms, 220ms) ease;
    z-index: 3;
}

.dice-roll-marker.show {
    opacity: 1;
    transform: translateX(-50%) translateY(0) scale(1);
}

.dice-roll-value {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #ff234c;
    font: 700 30px "Barlow Condensed", sans-serif;
}

.dice-bottom-panel {
    margin-top: auto;
    padding-top: 44px;
}

.dice-bottom-grid {
    border-radius: 9px;
    background: #254658;
    border: 1px solid #305a72;
    padding: 12px;
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 10px;
}

.bottom-field label {
    color: #cbe0ed;
    font: 500 14px "Space Grotesk", sans-serif;
    margin-bottom: 6px;
    display: block;
}

.field-row {
    min-height: 40px;
    border-radius: 8px;
    background: #132e3f;
    border: 1px solid #3c6278;
    display: flex;
    align-items: center;
    overflow: hidden;
}

.field-row input {
    width: 100%;
    border: none;
    outline: none;
    background: transparent;
    color: #f2fbff;
    font: 600 32px "Barlow Condensed", sans-serif;
    padding: 4px 10px;
}

.field-row .suffix,
.field-row .icon-btn {
    width: 42px;
    min-width: 42px;
    height: 100%;
    border: none;
    background: transparent;
    color: #cbe0ed;
    font: 700 18px "Barlow Condensed", sans-serif;
}

.icon-btn {
    cursor: pointer;
}

@media (max-width: 980px) {
    .dice-page {
        grid-template-columns: 1fr;
    }

    .dice-controls {
        border-right: none;
        border-bottom: 1px solid #2f5a73;
    }

    .dice-ruler {
        margin: 24px 12px 8px;
    }

    .dice-slider-wrap {
        margin: 0 8px;
    }

    .dice-bottom-grid {
        grid-template-columns: 1fr;
    }
}
