@font-face {
    font-family: "Rubik";
    font-display: swap;
    src: url("../fonts/Rubik-VariableFont_wght.woff2") format("woff2"),
        url("../fonts/Rubik-VariableFont_wght.woff") format("woff");
    font-weight: 100 900;
    font-style: normal;
}

html {
    line-height: 1.5;
    -webkit-text-size-adjust: 100%;
}

body {
    margin: 0;
}

main {
    display: block;
}

h1 {
    font-size: 2em;
    margin: 0.67em 0;
}

hr {
    box-sizing: content-box;
    height: 0;
    overflow: visible;
}

pre {
    font-family: monospace, monospace;
    font-size: 1em;
}

a {
    background-color: transparent;
}

abbr[title] {
    border-bottom: none;
    text-decoration: underline;
    text-decoration: underline dotted;
}

b,
strong {
    font-weight: bolder;
}

code,
kbd,
samp {
    font-family: monospace, monospace;
    font-size: 1em;
}

small {
    font-size: 80%;
}

sub,
sup {
    font-size: 75%;
    line-height: 0;
    position: relative;
    vertical-align: baseline;
}

sub {
    bottom: -0.25em;
}

sup {
    top: -0.5em;
}

img {
    border-style: none;
    max-width: 100%;
    height: auto;
}

button,
input,
optgroup,
select,
textarea {
    font-family: inherit;
    font-size: 100%;
    line-height: 1.15;
    margin: 0;
}

button,
input {
    overflow: visible;
}

button,
select {
    text-transform: none;
}

button,
[type="button"],
[type="reset"],
[type="submit"] {
    -webkit-appearance: button;
}

button::-moz-focus-inner,
[type="button"]::-moz-focus-inner,
[type="reset"]::-moz-focus-inner,
[type="submit"]::-moz-focus-inner {
    border-style: none;
    padding: 0;
}

button:-moz-focusring,
[type="button"]:-moz-focusring,
[type="reset"]:-moz-focusring,
[type="submit"]:-moz-focusring {
    outline: 1px dotted ButtonText;
}

fieldset {
    padding: 0.35em 0.75em 0.625em;
}

legend {
    box-sizing: border-box;
    color: inherit;
    display: table;
    max-width: 100%;
    padding: 0;
    white-space: normal;
}

progress {
    vertical-align: baseline;
}

textarea {
    overflow: auto;
}

[type="checkbox"],
[type="radio"] {
    box-sizing: border-box;
    padding: 0;
}

[type="number"]::-webkit-inner-spin-button,
[type="number"]::-webkit-outer-spin-button {
    height: auto;
}

[type="search"] {
    -webkit-appearance: textfield;
    outline-offset: -2px;
}

[type="search"]::-webkit-search-decoration {
    -webkit-appearance: none;
}

::-webkit-file-upload-button {
    -webkit-appearance: button;
    font: inherit;
}

details {
    display: block;
}

summary {
    display: list-item;
}

template {
    display: none;
}

[hidden] {
    display: none;
}

*,
*::before,
*::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    outline: none;
}

a {
    text-decoration: none;
}

ul[class] {
    list-style: none;
}

html {
    font-size: 16px;
}

:root {
    --bg: #0b1220;
    --panel: #0f1724;
    --text: #e6eef8;
}
html,
body {
    width: 100%;
    height: 100%;
    margin: 0;
    font-family: "Rubik", sans-serif;
    background: linear-gradient(180deg, #071024 0%, #071022 60%, #071028 100%);
    color: var(--text);
    overflow: hidden;
}

.wrapper {
    background: url("../img/bg-field.jpg") 50% 0% no-repeat no-repeat;
    width: 100%;
    height: 100%;
    margin: 0 auto;
    overflow: hidden;
    position: relative;
    background-size: cover;
}

.popup {
    position: fixed;
    z-index: 200;
    inset: 0;
    background: rgba(17, 51, 85, 0.5);
    -webkit-backdrop-filter: blur(1px);
    backdrop-filter: blur(1px);

    display: none;
    align-items: center;
    justify-content: center;
}

.popup__container {
    padding: 20px 30px;
    background: #12456de3;
    border-radius: 15px;
    border: 3px solid #79d5ff;
    box-shadow: #fff 0 0 10px 5px;
    color: #fff;
    font-size: 18px;
    width: max-content;
    max-width: calc(100% - 50px);
    display: flex;
    text-align: center;
    flex-direction: column;
    gap: 15px;
}

.popup.show {
    display: flex;
}

.popup__text {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 20px;
    font-size: clamp(18px, 2vw, 22px);
    font-weight: 600;
    color: #facb14;
}

.popup__win {
    font-size: clamp(18px, 2vw, 22px);
    font-weight: 600;
    color: #fff;
}

.popup__sum {
    font-size: clamp(20px, 2vw, 24px);
    color: #facb14;
}

.popup__link {
    color: #fff;
    padding: 10px 25px;
    border-radius: 30px;
    background: linear-gradient(#ced956, #4a904f);
    text-decoration: none;
    display: inline-block;
    animation: pulse 1.5s infinite;
}

.popup__bonus {
    margin-top: 10px;
    font-size: clamp(20px, 1.5vw, 25px);
    font-weight: 500;
    color: #ffffff;
    max-width: 700px;
}

@keyframes pulse {
    0% {
        box-shadow: 0 0 0 0 rgba(255, 255, 255, 0.7);
    }
    70% {
        box-shadow: 0 0 15px 8px rgba(255, 255, 255, 0);
    }
    100% {
        box-shadow: 0 0 0 0 rgba(255, 255, 255, 0);
    }
}

.game {
    position: relative;
    height: 100%;
    width: 100%;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    padding: 50px;
}

/* Controls */
.game-footer {
    padding: 15px 25px;
    background: rgba(17, 51, 85, 0.8);
    border-radius: 50px;
    z-index: 10;

    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 15px;
}

.stat-balance,
.controls {
    font-size: clamp(16px, 1.5vw, 18px);
    font-weight: 500;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
    color: #bdbdd1;
}

.stat-balance,
.controls {
    text-transform: uppercase;
}

.stat-balance span {
    color: #fff;
    font-size: clamp(16px, 1.6vw, 20px);
}

.stat-win {
    color: #fbcb14;
    font-weight: 700;
    font-size: clamp(16px, 2vw, 22px);
    opacity: 0;
    transition: all 0.2s;
    transition-timing-function: ease-in-out;
}

.stat-win.show {
    opacity: 1;
}

.controls {
    position: relative;
    cursor: pointer;
    display: flex;
    flex-direction: row;
    align-items: flex-start;
    justify-content: center;
    font-size: clamp(14px, 1vw, 16px);
    padding: 10px 40px 10px 20px;
    border-radius: 50px;
    transition: all 0.2s;
}

.controls:hover {
    background: rgba(17, 51, 85, 0.8);
}

.controls__col {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 6px;
}

.bet-display {
    width: 125px;
    color: #fff;
    font-size: clamp(16px, 1.5vw, 18px);
    background: transparent;
    border: none;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s;
    user-select: none;
}

.bet-arrows {
    position: absolute;
    top: 50%;
    right: 10px;
    transform: translateY(-50%);
    display: flex;
    flex-direction: column;
    gap: 2px;
    height: 40px;
}

.arrow-btn {
    flex: 1;
    width: 25px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    font-weight: bold;
    background: transparent;
    color: #fff;
    font-size: 12px;
}

.arrow-btn:hover:not(:disabled) {
    background: rgba(255, 255, 255, 0.1);
    transform: scale(1.1);
}

.arrow-btn:disabled {
    pointer-events: none;
    opacity: 0.5;
}

.bet-dropdown {
    position: absolute;
    top: -10px;
    left: 0;
    right: 0;
    transform: translateY(-100%);
    max-height: 300px;
    background: #0f3460;
    overflow-y: auto;
    opacity: 0;
    pointer-events: none;
    transition: all 0.3s;
    z-index: 100;
}

.bet-dropdown.open {
    opacity: 1;
    pointer-events: all;
}

.bet-option {
    padding: 12px 15px;
    cursor: pointer;
    transition: background 0.2s;
    font-size: clamp(14px, 1.5vw, 16px);
}

.bet-option:last-child {
    border-bottom: none;
}

.bet-option:hover {
    background: #1a4d7a;
    color: #fff;
}

.bet-option.selected {
    background: #1a4d7a;
    color: #fff;
    font-weight: bold;
}

.bet-dropdown::-webkit-scrollbar {
    width: 4px;
}

.bet-dropdown::-webkit-scrollbar-track {
    background: #16213e;
    border-radius: 4px;
}

.bet-dropdown::-webkit-scrollbar-thumb {
    background: #ffffff46;
    border-radius: 4px;
}

/* playfield */
.field {
    position: absolute;
    z-index: 5;
    inset: 0;
    overflow: hidden;
}

.point {
    z-index: 10;
}

/* fallback colors per multiplier */

/* box images */
.m1-1 .box {
    background: linear-gradient(180deg, #9be7ff, #7fd2ff);
    background-image: url("../img/ballon1-1.png");
}
.m1-5 .box {
    background: linear-gradient(180deg, #9be7ff, #7fd2ff);
    background-image: url("../img/ballon1-5.png");
}
.m2 .box {
    background: linear-gradient(180deg, #9be7ff, #7fd2ff);
    background-image: url("../img/ballon2.png");
}
.m4 .box {
    background: linear-gradient(180deg, #c6f6d5, #9ae6b4);
    background-image: url("../img/ballon1-1.png");
}
.m8 .box {
    background: linear-gradient(180deg, #9be7ff, #7fd2ff);
    background-image: url("../img/ballon2.png");
}
.m16 .box {
    background: linear-gradient(180deg, #ffd1f0, #ff9bd8);
    background-image: url("../img/ballon16.png");
}
.m32 .box {
    background: linear-gradient(180deg, #e9d5ff, #c29bff);
    background-image: url("../img/ballon32.png");
}
.m64 .box {
    background: linear-gradient(180deg, #ffd9d9, #ffa6a6);
    background-image: url("../img/ballon64.png");
}

/* mult images */
.m1-1 .box::after {
    background-image: url("../img/x1-1.png");
}
.m1-5 .box::after {
    background-image: url("../img/x1-5.png");
}
.m2 .box::after {
    background-image: url("../img/x2.png");
}
.m4 .box::after {
    background-image: url("../img/xx4.png");
}
.m8 .box::after {
    background-image: url("../img/x88.png");
}
.m16 .box::after {
    background-image: url("../img/x16.png");
}
.m32 .box::after {
    background-image: url("../img/x32.png");
}
.m64 .box::after {
    background-image: url("../img/x64.png");
}

/* clip */
.m4 {
    clip-path: ellipse(50% 50%);
}
.m8 {
    clip-path: ellipse(50% 46%);
}
.m16 {
    clip-path: ellipse(51% 47%);
}

.m32 {
    clip-path: ellipse(50% 49%);
}

.m64 {
    clip-path: ellipse(50% 44%);
}

/* balloon base */
.balloon {
    position: absolute;
    left: 0;
    top: 0;
    will-change: transform;

    touch-action: none;
    user-select: none;
    aspect-ratio: 72 / 96;
    width: 7%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    color: #071722;
    cursor: pointer;
    transform-style: preserve-3d;
}

/* Balloon box */
.balloon .box {
    position: relative;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;

    background-position: center;
    background-repeat: no-repeat;
    background-size: contain;
}

.balloon .box::after {
    content: "";
    aspect-ratio: 40 / 20;
    width: 50%;
    background-position: center;
    background-size: contain;
    background-repeat: no-repeat;
}

.m1-5 {
    width: 8%;
}
.m2 {
    width: 10%;
}
.m4 {
    width: clamp(70px, 12%, 140px);
}
.m8 {
    width: clamp(80px, 13%, 185px);
}
.m16 {
    width: clamp(100px, 14%, 230px);
}
.m32 {
    width: clamp(115px, 16%, 260px);
}
.m64 {
    width: clamp(150px, 20%, 350px);
}

/* coin particle */
.particle {
    position: absolute;
    width: clamp(30px, 5%, 50px);
    aspect-ratio: 1 / 1;
    border-radius: 50%;
    background-image: url("../img/coin2.png");
    background-size: contain;
    background-position: center;
    background-repeat: no-repeat;
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: none;
    transform-origin: center;
}

/* result popup center */
.result {
    position: absolute;
    z-index: 20;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%) scale(0);
    text-align: center;
    opacity: 0;
    pointer-events: none;

    color: #fbcb14;
    font-size: clamp(25px, 2.5vw, 35px);
    font-weight: 900;

    min-width: 150px;
    padding: 10px 20px;
    background: rgba(17, 51, 85, 0.8);
    border-radius: 50px;
    transition: all 0.2s;
    transition-timing-function: ease-in-out;
}
.result.show {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
    pointer-events: auto;
}

@media (max-width: 1210px) {
    .game {
        padding: 20px;
    }
}

@media (max-width: 768px) {
    .game {
        padding: 0;
    }
    .game-footer {
        padding: 10px 10px;
        border-radius: 0;
    }

    .bet-display {
        width: 105px;
    }

    .popup__container {
        padding: 20px;
        max-width: calc(100% - 20px);
    }
}
