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

html,
body {
    overflow: hidden;
}

body {
    width: 100vw;
    height: 100vh;
    font-family: 'Arial', sans-serif;
}

.game {
    position: relative;
    width: 100vw;
    height: 100vh;
    background: url('../images/bg-wheel.webp') center / cover no-repeat;
    overflow: hidden;
    opacity: 0;
    transition: opacity 600ms ease-out;
}

.loaded .game {
    opacity: 1;
}

.fishing-active .game {
    visibility: hidden;
    pointer-events: none;
}

.win .game {
    animation: gameShake 0.55s cubic-bezier(0.36, 0.07, 0.19, 0.97) both,
        gameJitter 0.18s linear 0.55s infinite;
}

@keyframes gameShake {
    0% {
        transform: translate(0, 0);
    }

    10% {
        transform: translate(-1.2vh, 0.4vh);
    }

    20% {
        transform: translate(1vh, -0.6vh);
    }

    30% {
        transform: translate(-0.9vh, 0.8vh);
    }

    40% {
        transform: translate(1.1vh, 0.2vh);
    }

    50% {
        transform: translate(-0.7vh, -0.8vh);
    }

    60% {
        transform: translate(0.6vh, 0.6vh);
    }

    70% {
        transform: translate(-0.5vh, -0.3vh);
    }

    80% {
        transform: translate(0.4vh, 0.5vh);
    }

    90% {
        transform: translate(-0.3vh, -0.2vh);
    }

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

@keyframes gameJitter {

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

    25% {
        transform: translate(0.2vh, -0.15vh);
    }

    50% {
        transform: translate(-0.18vh, 0.18vh);
    }

    75% {
        transform: translate(0.12vh, 0.1vh);
    }
}

.ui-layer {
    position: fixed;
    inset: 0;
    z-index: 200;
    pointer-events: none;
}

.ui-layer>* {
    pointer-events: auto;
}

.ui-layer>.spin-tutorial-overlay {
    pointer-events: none;
}

.ui-layer>.spin-tutorial-hint {
    pointer-events: none;
}

body.spin-tutorial .balance,
body.spin-tutorial .bet,
body.spin-tutorial .spin {
    z-index: 210;
}

body.spin-tutorial .spin-tutorial-overlay {
    z-index: 204;
    pointer-events: none;
}

.top-left {
    position: absolute;
    top: 2.4vh;
    left: 2.4vh;
    display: flex;
    gap: 1.5vh;
    opacity: 0;
    transform: translateY(-2vh);
    transition: opacity 450ms ease-out 150ms, transform 450ms ease-out 150ms;
}

.top-right {
    position: absolute;
    top: 2.4vh;
    right: 2.4vh;
    display: flex;
    gap: 1.5vh;
    opacity: 0;
    transform: translateY(-2vh);
    transition: opacity 450ms ease-out 150ms, transform 450ms ease-out 150ms;
}

.loaded .top-left,
.loaded .top-right {
    opacity: 1;
    transform: translateY(0);
}

.icon-btn {
    width: 4.4vh;
    height: 4.4vh;
    border: none;
    background: transparent;
    cursor: pointer;
    padding: 0;
}

.icon-btn img {
    width: 100%;
    height: 100%;
    display: block;
}

.wheel-wrap {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 57.8vh;
    height: 57.8vh;
    transform: translate(-50%, -58%) scale(0.6);
    opacity: 0;
    transition: opacity 650ms ease-out, transform 700ms cubic-bezier(0.34, 1.56, 0.64, 1);
}

.loaded .wheel-wrap {
    opacity: 1;
    transform: translate(-50%, -58%) scale(1);
}

.wheel-wrap .wheel {
    width: 100%;
    height: 100%;
    display: block;
}

.wheel-wrap .arrow {
    position: absolute;
    top: -4vh;
    left: 50%;
    width: 7vh;
    height: auto;
    z-index: 3;
    opacity: 0;
    transform: translate(-50%, -3vh);
    transition: opacity 400ms ease-out 350ms, transform 500ms cubic-bezier(0.34, 1.56, 0.64, 1) 350ms;
}

.loaded .wheel-wrap .arrow {
    opacity: 1;
    transform: translate(-50%, 0);
}

.cards {
    position: absolute;
    bottom: 16vh;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 1.5vh;
    z-index: 4;
}

.cards img {
    width: 14vh;
    height: 16.5vh;
    display: block;
    cursor: pointer;
    opacity: 0;
    transform: translateY(3vh) scale(0.85);
    transition: opacity 450ms ease-out, transform 500ms cubic-bezier(0.34, 1.56, 0.64, 1);
}

.loaded .cards img {
    opacity: 1;
    transform: translateY(0) scale(1);
}

.loaded .cards img:nth-child(1) {
    transition-delay: 250ms;
}

.loaded .cards img:nth-child(2) {
    transition-delay: 320ms;
}

.spin {
    position: absolute;
    bottom: 4vh;
    left: 50%;
    width: 10vh;
    height: 10vh;
    border: none;
    background: transparent;
    cursor: pointer;
    padding: 0;
    opacity: 0;
    transform: translateX(-50%) scale(0.4) rotate(-90deg);
    transition: opacity 500ms ease-out 1200ms, transform 600ms cubic-bezier(0.34, 1.56, 0.64, 1) 1200ms;
}

.fishing-active .spin {
    opacity: 1;
    transform: translateX(-50%) scale(1) rotate(0deg);
}

.spin img {
    width: 100%;
    height: 100%;
    display: block;
}

.balance,
.bet {
    position: absolute;
    bottom: 4.2vh;
    width: 22.2vh;
    height: 6.2vh;
    background: #0f1a24;
    border: .2vh solid #465B63;
    border-radius: 3.1vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: #fff;
    opacity: 0;
    transition: opacity 500ms ease-out 250ms, transform 550ms cubic-bezier(0.34, 1.56, 0.64, 1) 250ms;
}

.balance {
    left: 3.3vh;
    transform: translateX(-6vh);
    z-index: 5;
}

.bet {
    right: 3.3vh;
    transform: translateX(6vh);
    z-index: 5;
}

.spin {
    z-index: 5;
}

.loaded .balance,
.loaded .bet {
    opacity: 1;
    transform: translateX(0);
}

.balance .label,
.bet .label {
    font-size: 1.2vh;
    letter-spacing: 0.17vh;
    color: #c8c8c8;
    margin-bottom: 0.2vh;
}

.balance .value,
.bet .value {
    font-size: 2.4vh;
    font-weight: 700;
    color: #fff;
}

.bet-row {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.8vh;
    width: 100%;
}

.bet-step-btn {
    width: 2.8vh;
    height: 2.8vh;
    padding: 0;
    border: none;
    border-radius: 50%;
    background: #2a4a5c;
    color: #fff;
    font-family: inherit;
    font-size: 2vh;
    font-weight: 700;
    line-height: 1;
    cursor: pointer;
    flex-shrink: 0;
}

.bet-step-btn:disabled {
    opacity: 0.35;
    cursor: default;
}

.bet .value {
    min-width: 5.5ch;
    font-variant-numeric: tabular-nums;
    text-align: center;
}

.line-break-fail .fishing-scene,
.line-break-fail .fish-fishing {
    animation: catch-miss-shake 0.52s ease;
}

body.line-break-fail .fish-fishing > img {
    transform: translateY(100%) !important;
    transition: transform 0.6s cubic-bezier(0.45, 0, 0.75, 0.35) !important;
}

.line-break-fail .fish-multiplier {
    opacity: 0;
    transition: opacity 0.35s ease;
}

body.line-break-fail .spin-tutorial-hint {
    opacity: 0 !important;
    animation: none;
}

@keyframes catch-miss-shake {

    0%,
    100% {
        transform: translateX(0);
    }

    25% {
        transform: translateX(-1.4vh);
    }

    75% {
        transform: translateX(1.4vh);
    }
}

.overlay {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.65);
    opacity: 0;
    pointer-events: none;
    z-index: 6;
    transition: opacity 500ms ease-out;
}

.tutorial .overlay {
    opacity: 1;
}

.tutorial .cards {
    z-index: 10;
}

.tutorial .cards img:not(.highlight) {
    opacity: 0.25;
    filter: brightness(0.4) saturate(0.4);
    transition: opacity 400ms ease-out, filter 400ms ease-out;
}

.tutorial .cards img.highlight {
    position: relative;
    z-index: 1;
    animation: highlightPulse 1.4s ease-in-out infinite;
    filter: brightness(1.08) drop-shadow(0 0 1.5vh rgba(255, 70, 70, 0.9)) drop-shadow(0 0 3vh rgba(255, 120, 50, 0.6));
}

@keyframes highlightPulse {

    0%,
    100% {
        transform: translateY(0) scale(1);
    }

    50% {
        transform: translateY(-1vh) scale(1.08);
    }
}

.hint {
    position: absolute;
    left: 50%;
    bottom: 38vh;
    transform: translateX(-50%);
    color: #fff;
    font-size: 2.2vh;
    font-weight: 700;
    letter-spacing: 0.2vh;
    text-transform: uppercase;
    text-shadow: 0 0 1.2vh rgba(0, 0, 0, 0.8);
    opacity: 0;
    z-index: 11;
    pointer-events: none;
    transition: opacity 400ms ease-out;
    white-space: nowrap;
}

.tutorial .hint {
    opacity: 1;
    animation: hintFloat 1.6s ease-in-out infinite;
}

@keyframes hintFloat {

    0%,
    100% {
        transform: translate(-50%, 0);
    }

    50% {
        transform: translate(-50%, -0.8vh);
    }
}

.hint::after {
    content: '';
    position: absolute;
    left: 50%;
    bottom: -2.2vh;
    transform: translateX(-50%);
    width: 0;
    height: 0;
    border-left: 1.2vh solid transparent;
    border-right: 1.2vh solid transparent;
    border-top: 1.6vh solid #fff;
    filter: drop-shadow(0 0 0.8vh rgba(0, 0, 0, 0.6));
}

.spin-tutorial-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.65);
    opacity: 0;
    pointer-events: none;
    transition: opacity 450ms ease-out;
}

body.spin-tutorial .spin-tutorial-overlay {
    opacity: 1;
    pointer-events: auto;
}

.spin-tutorial-hint {
    position: fixed;
    left: 50%;
    bottom: 17vh;
    transform: translateX(-50%);
    color: #fff;
    font-size: 2.2vh;
    font-weight: 700;
    letter-spacing: 0.2vh;
    text-transform: uppercase;
    text-shadow: 0 0 1.2vh rgba(0, 0, 0, 0.8);
    opacity: 0;
    pointer-events: none;
    transition: opacity 400ms ease-out;
    white-space: nowrap;
}

body.spin-tutorial .spin-tutorial-hint {
    opacity: 1;
    animation: hintFloat 1.6s ease-in-out infinite;
}

.spin-tutorial-hint::after {
    content: '';
    position: absolute;
    left: 50%;
    bottom: -2.2vh;
    transform: translateX(-50%);
    width: 0;
    height: 0;
    border-left: 1.2vh solid transparent;
    border-right: 1.2vh solid transparent;
    border-top: 1.6vh solid #fff;
    filter: drop-shadow(0 0 0.8vh rgba(0, 0, 0, 0.6));
}

.halo {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 92%;
    height: 92%;
    border-radius: 50%;
    transform: translate(-50%, -50%);
    z-index: 1;
    opacity: 0;
    pointer-events: none;
    transition: opacity 400ms ease-out;
}

.win .halo {
    opacity: 1;
    animation: haloPulse 1.4s ease-in-out infinite;
}

@keyframes haloPulse {

    0%,
    100% {
        box-shadow:
            0 0 4vh 0.6vh rgba(255, 70, 70, 0.55),
            0 0 10vh 2vh rgba(255, 140, 60, 0.45),
            0 0 20vh 4vh rgba(255, 180, 80, 0.25);
    }

    50% {
        box-shadow:
            0 0 7vh 1.5vh rgba(255, 70, 70, 0.85),
            0 0 16vh 4vh rgba(255, 140, 60, 0.7),
            0 0 30vh 7vh rgba(255, 180, 80, 0.4);
    }
}

.fish-rain {
    position: absolute;
    inset: 0;
    z-index: 50;
    pointer-events: none;
    overflow: hidden;
    opacity: 0;
    transition: opacity 300ms ease-out;
}

.win .fish-rain {
    opacity: 1;
}

.fish-drop {
    position: absolute;
    top: -22vh;
    width: 9vh;
    height: auto;
    animation-name: fishFall;
    animation-timing-function: cubic-bezier(0.4, 0.05, 0.7, 0.5);
    animation-fill-mode: forwards;
    animation-iteration-count: infinite;
    will-change: transform;
}

@keyframes fishFall {
    0% {
        transform: translateY(0) rotate(var(--start-rot, 0deg));
        opacity: 0;
    }

    8% {
        opacity: 1;
    }

    90% {
        opacity: 1;
    }

    100% {
        transform: translateY(130vh) rotate(var(--end-rot, 540deg));
        opacity: 0;
    }
}

.flash {
    position: absolute;
    inset: 0;
    pointer-events: none;
    z-index: 40;
    opacity: 0;
    background:
        radial-gradient(ellipse at center,
            transparent 25%,
            rgba(146, 20, 14, 0.55) 70%,
            rgba(146, 20, 14, 0.95) 100%);
}

.win .flash {
    animation: flashStrobe 2.8s ease-out forwards;
}

@keyframes flashStrobe {
    0% {
        opacity: 0;
    }

    3% {
        opacity: 1;
    }

    8% {
        opacity: 0.15;
    }

    13% {
        opacity: 0.95;
    }

    18% {
        opacity: 0.1;
    }

    23% {
        opacity: 0.85;
    }

    28% {
        opacity: 0.2;
    }

    35% {
        opacity: 0.7;
    }

    45% {
        opacity: 0.35;
    }

    55% {
        opacity: 0.55;
    }

    70% {
        opacity: 0.4;
    }

    85% {
        opacity: 0.3;
    }

    100% {
        opacity: 0.25;
    }
}






.fishing-screen {
    position: fixed;
    inset: 0;
    background: url('../images/bg-fishing.webp') center / cover no-repeat;
    z-index: 115;
    overflow: hidden;
    pointer-events: none;
    transform: translateY(-100vh);
    transition: transform 1100ms cubic-bezier(0.65, 0, 0.35, 1);
}

.fishing-active .fishing-screen {
    transform: translateY(0);
    pointer-events: auto;
}

body.fishing-active .fishing-screen {
    transition: none;
    transform: translateY(0);
}

.fishing-scene {
    position: absolute;
    inset: 0;
    transform-origin: 50% 65%;
    transition: transform 1900ms cubic-bezier(0.4, 0, 0.5, 1);
}

.helicopter-lifting .fishing-scene {
    transform: scale(0.9);
}

.fish-fishing {
    position: absolute;
    bottom: 29vh;
    overflow: hidden;
    left: 47%;
    width: 30vh;
    pointer-events: none;
    z-index: 1;
}

.fish-fishing>img {
    width: 100%;
    height: auto;
    display: block;
    transform: translateY(93%);
    transition: transform 3500ms cubic-bezier(0.25, 0.85, 0.4, 1);
}

.fishing-running .fish-fishing>img {
    transform: translateY(62%);
}

.helicopter-active .fish-fishing>img {
    transform: translateY(74%);
    transition: transform 1500ms cubic-bezier(0.4, 0, 0.5, 1);
}

.helicopter-lifting .fish-fishing>img {
    transform: translateY(38%);
    transition: transform 1900ms cubic-bezier(0.4, 0, 0.5, 1);
}

.fish-multiplier {
    position: absolute;
    bottom: 17vh;
    left: 59%;
    transform: translateX(-50%) scale(1);
    transform-origin: center bottom;
    background: linear-gradient(180deg, #d6ecf3 0%, #5fa1bd 100%);
    border: 0.45vh solid #ffd61f;
    box-shadow: 0 0 0 0.4vh #f49f25;
    border-radius: 1.5vh;
    padding: 0.6vh 1.6vh;
    color: #ffe700;
    font-family: 'Arial Black', 'Arial', sans-serif;
    font-weight: 900;
    font-size: 3.6vh;
    line-height: 1;
    letter-spacing: 0.1vh;
    -webkit-text-stroke: 0.2vh #c97800;
    text-shadow: 0 0.25vh 0 rgba(120, 60, 0, 0.4);
    pointer-events: none;
    z-index: 4;
    transition: transform 400ms ease-out;
    white-space: nowrap;
}

/* Тривалість як FISH_FIRST_RISE_MS у script.js */
body.fishing-running:not(.helicopter-active) .fish-multiplier {
    transform: translateX(-50%) scale(1.15);
    transition: transform 3500ms cubic-bezier(0.25, 0.85, 0.4, 1);
}

/* Після приїзду геліка риба опускається (62%→74%): без зміни масштабу бейджа */
body.fishing-running.helicopter-active:not(.helicopter-lifting) .fish-multiplier {
    transform: translateX(-50%) scale(1.15);
    transition: none;
}

/* Збігається з .helicopter-lifting .fish-fishing > img (1900ms) */
.helicopter-lifting .fish-multiplier {
    transform: translateX(-50%) scale(1.32);
    transition: transform 1900ms cubic-bezier(0.4, 0, 0.5, 1);
}

/* Під час handoff + підльоту вертольота 2 масштаб не змінюється */
.helicopter-handoff .fish-multiplier {
    transform: translateX(-50%) scale(1.32);
    transition: none;
}

/* Збігається з helicopter2Lift (2800ms) */
.helicopter-2-lifting .fish-multiplier {
    transform: translateX(-50%) scale(1.55);
    transition: transform 2800ms cubic-bezier(0.45, 0.05, 0.6, 1);
}

.helicopter {
    position: absolute;
    top: 0;
    left: 0;
    width: 55vh;
    height: auto;
    pointer-events: none;
    z-index: 0;
    transform: translate(150vw, -60vh);
    will-change: transform;
}

.helicopter-active .helicopter {
    animation: helicopterFlight 5500ms forwards cubic-bezier(0.45, 0.05, 0.55, 0.95);
}

@keyframes helicopterFlight {
    0% {
        transform: translate(150vw, -60vh);
    }

    20% {
        transform: translate(calc(47vw - 9.5vh), 3vh);
    }

    30% {
        transform: translate(calc(47vw - 9.5vh), 3vh);
    }

    55% {
        transform: translate(calc(47vw - 9.5vh), 21vh);
    }

    65% {
        transform: translate(calc(47vw - 9.5vh), 21vh);
    }

    100% {
        transform: translate(calc(47vw - 9.5vh), 11vh);
    }
}

.helicopter-2 {
    position: absolute;
    top: 0;
    left: 0;
    width: 55vh;
    height: auto;
    pointer-events: none;
    z-index: 0;
    transform: translate(150vw, -30vh);
    will-change: transform;
}

.helicopter-handoff .helicopter {
    animation: helicopter1Depart 2400ms forwards cubic-bezier(0.45, 0.05, 0.55, 0.95);
}

@keyframes helicopter1Depart {
    0% {
        transform: translate(calc(47vw - 9.5vh), 11vh) scale(1);
        opacity: 1;
    }

    100% {
        transform: translate(-60vw, -80vh) scale(0.35);
        opacity: 0;
    }
}

.helicopter-handoff .helicopter-2 {
    animation: helicopter2Arrive 2400ms forwards cubic-bezier(0.45, 0.05, 0.55, 0.95);
}

@keyframes helicopter2Arrive {
    0% {
        transform: translate(150vw, -30vh);
    }

    55% {
        transform: translate(calc(47vw - 12.5vh), -15vh);
    }

    70% {
        transform: translate(calc(47vw - 12.5vh), -15vh);
    }

    100% {
        transform: translate(calc(47vw - 12.5vh), 7vh);
    }
}

.helicopter-2-lifting .helicopter-2 {
    animation: helicopter2Lift 2800ms forwards cubic-bezier(0.45, 0.05, 0.6, 1);
}

@keyframes helicopter2Lift {
    0% {
        transform: translate(calc(47vw - 12.5vh), 7vh);
    }

    100% {
        transform: translate(calc(47vw - 12.5vh), -9vh);
    }
}

.helicopter-2-lifting .fish-fishing>img {
    transform: translateY(7%);
    transition: transform 2600ms cubic-bezier(0.45, 0.05, 0.6, 1) 200ms;
}

.ice {
    position: absolute;
    bottom: 7vh;
    left: 50%;
    width: 36vh;
    height: auto;
    transform: translateX(-20%);
    pointer-events: none;
    z-index: 2;
}

.girl {
    position: absolute;
    bottom: 25vh;
    left: calc(47% + 5vh);
    height: 58vh;
    transform: translateX(-50%);
    width: auto;
    pointer-events: none;
    z-index: 0;
}

.fish-school {
    position: absolute;
    inset: 0;
    pointer-events: none;
}

.fish-swim {
    position: absolute;
    left: 0;
    will-change: transform;
    animation-timing-function: linear;
    animation-iteration-count: infinite;
}

.fish-swim.right {
    animation-name: swimRight;
}

.fish-swim.left {
    animation-name: swimLeft;
}

@keyframes swimRight {
    from {
        transform: translateX(-30vw);
    }

    to {
        transform: translateX(110vw);
    }
}

@keyframes swimLeft {
    from {
        transform: translateX(110vw);
    }

    to {
        transform: translateX(-30vw);
    }
}

.fish-bob {
    position: relative;
    animation-name: bob;
    animation-timing-function: ease-in-out;
    animation-iteration-count: infinite;
    animation-direction: alternate;
}

@keyframes bob {
    from {
        transform: translateY(-0.6vh);
    }

    to {
        transform: translateY(0.6vh);
    }
}

.fish-img {
    width: 100%;
    height: auto;
    display: block;
}

.fish-img.flipped {
    transform: scaleX(-1);
}

.fish-x {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: #ffffff;
    font-family: 'Arial', sans-serif;
    font-weight: 500;
    letter-spacing: 0.05vh;
    text-shadow:
        0 0 0.4vh rgba(0, 0, 0, 0.7),
        0 0.2vh 0.5vh rgba(0, 0, 0, 0.5);
    pointer-events: none;
    white-space: nowrap;
}

.win-screen {
    position: fixed;
    inset: 0;
    z-index: 500;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2vh;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity 0.55s ease-out, visibility 0.55s ease-out;
}

body.win-screen-visible .win-screen {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
}

body.final-screen-visible .win-screen {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity 0.45s ease-out, visibility 0.45s ease-out;
}

.win-screen__backdrop {
    position: absolute;
    inset: 0;
    background: rgba(6, 12, 20, 0.52);
    -webkit-backdrop-filter: blur(14px);
    backdrop-filter: blur(14px);
}

.win-screen__panel {
    position: relative;
    z-index: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: min(92vw, 54vh);
    pointer-events: none;
    transform: scale(0.88);
    opacity: 0;
    transition:
        transform 0.65s cubic-bezier(0.22, 1.24, 0.36, 1),
        opacity 0.45s ease-out;
}

body.win-screen-visible .win-screen__panel {
    transform: scale(1);
    opacity: 1;
}

.win-screen__shine {
    position: absolute;
    left: 50%;
    top: 38%;
    width: min(130vw, 130vh);
    height: auto;
    transform: translate(-50%, -50%);
    z-index: 0;
    pointer-events: none;
    animation: winShineSpin 32s linear infinite;
}

@keyframes winShineSpin {
    from {
        transform: translate(-50%, -50%) rotate(0deg);
    }

    to {
        transform: translate(-50%, -50%) rotate(360deg);
    }
}

.win-screen__table-wrap {
    position: relative;
    z-index: 1;
    width: 100%;
    max-width: min(88vw, 50vh);
    pointer-events: none;
}

.win-screen__table {
    width: 100%;
    height: auto;
    display: block;
    pointer-events: none;
}

.win-screen__copy {
    position: absolute;
    left: 50%;
    bottom: 18%;
    transform: translateX(-50%);
    width: 88%;
    text-align: center;
    pointer-events: none;
}

.win-screen__title {
    margin: 0 0 0.6vh;
    font-family: 'Arial Black', 'Arial', sans-serif;
    font-size: clamp(1.75rem, 3.8vh, 2.85rem);
    font-weight: 900;
    letter-spacing: 0.28vh;
    text-transform: uppercase;
    color: #fff6c2;
    text-shadow:
        0 0.12vh 0 #b87418,
        0 0.22vh 0 #8a5610,
        0 0 1.2vh rgba(255, 220, 120, 0.65),
        0 0.4vh 0.75vh rgba(0, 0, 0, 0.5);
}

.win-screen__amount {
    margin: 0;
    font-family: 'Arial Black', 'Arial', sans-serif;
    font-size: clamp(2.25rem, 5.8vh, 4rem);
    font-weight: 900;
    letter-spacing: 0.1vh;
    color: #fff0a0;
    text-shadow:
        0 0.15vh 0 #985908,
        0 0.25vh 0 #6d3f06,
        0 0 1vh rgba(255, 236, 140, 0.55),
        0 0.55vh 1vh rgba(0, 0, 0, 0.55);
}

.fail-screen {
    position: fixed;
    inset: 0;
    z-index: 480;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2vh;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity 0.45s ease-out, visibility 0.45s ease-out;
}

body.fail-screen-visible .fail-screen {
    opacity: 1;
    visibility: visible;
    pointer-events: none;
}

.fail-screen__backdrop {
    position: absolute;
    inset: 0;
    background: rgba(6, 12, 20, 0.58);
    -webkit-backdrop-filter: blur(12px);
    backdrop-filter: blur(12px);
}

.fail-screen__panel {
    position: relative;
    z-index: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: min(88vw, 48vh);
    transform: scale(0.9);
    opacity: 0;
    transition:
        transform 0.55s cubic-bezier(0.22, 1.24, 0.36, 1),
        opacity 0.4s ease-out;
}

body.fail-screen-visible .fail-screen__panel {
    transform: scale(1);
    opacity: 1;
}

.fail-screen__table-wrap {
    position: relative;
    width: 100%;
    max-width: min(84vw, 46vh);
    pointer-events: none;
}

.fail-screen__table {
    width: 100%;
    height: auto;
    display: block;
    pointer-events: none;
}

.fail-screen__copy {
    position: absolute;
    left: 50%;
    bottom: 18%;
    transform: translateX(-50%);
    width: 88%;
    text-align: center;
    pointer-events: none;
}

.fail-screen__title {
    margin: 0 0 0.5vh;
    font-family: 'Arial Black', 'Arial', sans-serif;
    font-size: clamp(1.35rem, 3vh, 2.35rem);
    font-weight: 900;
    letter-spacing: 0.22vh;
    text-transform: uppercase;
    color: #d8f4ff;
    text-shadow:
        0 0.12vh 0 #2a6a8a,
        0 0.22vh 0 #1a4a62,
        0 0 1vh rgba(120, 210, 255, 0.55),
        0 0.4vh 0.75vh rgba(0, 0, 0, 0.5);
}

.fail-screen__amount {
    margin: 0;
    font-family: 'Arial Black', 'Arial', sans-serif;
    font-size: clamp(1.5rem, 4.2vh, 2.85rem);
    font-weight: 900;
    letter-spacing: 0.08vh;
    color: #ffe8e8;
    text-shadow:
        0 0.12vh 0 #8a3030,
        0 0.22vh 0 #5c2020,
        0 0 0.9vh rgba(255, 160, 160, 0.45),
        0 0.45vh 0.85vh rgba(0, 0, 0, 0.5);
}

/* Фінальний екран (CTA) — поверх win-screen та конфеті */
.final-screen {
    position: fixed;
    inset: 0;
    z-index: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: calc(1.5vh + env(safe-area-inset-top, 0px)) 3vw calc(1.5vh + env(safe-area-inset-bottom, 0px));
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity 0.55s ease-out, visibility 0.55s ease-out;
}

body.final-screen-visible .final-screen {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
}

.final-screen__bg {
    position: absolute;
    inset: 0;
    z-index: 0;
    background: url('../images/bg-wheel.webp') center / cover no-repeat;
}

.final-screen__content {
    position: relative;
    z-index: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: 100%;
    max-height: 100%;
    pointer-events: none;
    gap: 5vh;
}

.final-screen__logo {
    width: 25vh;
    height: auto;
    display: block;
    pointer-events: none;
    filter: drop-shadow(0 0.45vh 1.4vh rgba(0, 0, 0, 0.4));
    margin-bottom: min(-0.5vh, -1vw);
}

.final-screen__offer-wrap {
    width: 40vh;
    position: relative;
    pointer-events: none;
}

.final-screen__table {
    width: 100%;
    height: auto;
    display: block;
}

.final-screen__plaque {
    position: absolute;
    left: 7%;
    right: 7%;
    top: 10%;
    bottom: 12%;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    pointer-events: none;
    gap: 3vh;
}

.final-screen__headline {
    margin: 0 0 1.4vh;
    font-family: 'Arial Black', 'Arial Rounded MT Bold', 'Arial', sans-serif;
    font-weight: 900;
    font-size: 3vh;
    line-height: 1.15;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: #ffffff;
    text-shadow:
        0 0.1vh 0 #1e2530,
        0 0.2vh 0 #12161d,
        0 0.32vh 0.45vh rgba(0, 0, 0, 0.45);
}

.final-screen__reward {
    width: 88%;
    max-width: 42vh;
    margin: 0 auto;
    padding: 1.5vh 1.8vh 1.7vh;
    box-sizing: border-box;

}

.final-screen__reward-line {
    margin: 0;
    font-family: 'Arial Black', 'Arial Rounded MT Bold', 'Arial', sans-serif;
    font-weight: 900;
    font-size: 4vh;
    line-height: 1.2;
    letter-spacing: 0.02em;
    text-transform: uppercase;
    color: #ffffff;
    text-shadow:
        0 0.08vh 0 #0d3a66,
        0 0.16vh 0 #082642,
        0 0.12vh 0.35vh rgba(0, 0, 0, 0.35);
}

.final-screen__reward-line+.final-screen__reward-line {
    margin-top: 0.35vh;
}

.final-screen__reward-line--fs {
    font-size: 5.4vh;
}

.final-screen__cta {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 31vh;
    border: none;
    padding: 0;
    background: transparent;
    cursor: pointer;
    border-radius: 2vh;
    z-index: 2;
    pointer-events: auto;
    -webkit-tap-highlight-color: transparent;
    margin-top: -2.5vh;
}

.final-screen__cta-bg {
    width: 100%;
    height: auto;
    display: block;
}

.final-screen__cta-text {
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -72%);
    margin: 0;
    font-family: 'Arial Black', 'Arial Rounded MT Bold', 'Arial', sans-serif;
    font-weight: 900;
    font-size: 3.2vh;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: #ffffff;
    line-height: 1;
    white-space: nowrap;
    pointer-events: none;
    text-shadow:
        0 0.08vh 0 #0d4a7a,
        0 0.16vh 0 #09365a,
        0 0.25vh 0.4vh rgba(0, 0, 0, 0.35);
    filter: drop-shadow(0 0.06vh 0 rgba(255, 255, 255, 0.25));
}

[data-install].final-screen__cta:focus-visible {
    outline: 0.3vh solid #fff;
    outline-offset: 0.4vh;
}

@keyframes finalCtaPulse {

    0%,
    100% {
        transform: scale(1);
        filter: drop-shadow(0 0 0 transparent);
    }

    50% {
        transform: scale(1.07);
        filter: drop-shadow(0 0 1.2vh rgba(255, 255, 255, 0.65));
    }
}

body.final-screen-visible .final-screen__cta {
    animation: finalCtaPulse 1.5s ease-in-out infinite;
    transform-origin: center center;
}

/* Текст CTA не масштабуємо подвійно — компенсуємо зворотним scale */
body.final-screen-visible .final-screen__cta-text {
    animation: finalCtaTextCompensate 1.5s ease-in-out infinite;
}

@keyframes finalCtaTextCompensate {

    0%,
    100% {
        transform: translate(-50%, -72%) scale(1);
    }

    50% {
        transform: translate(-50%, -72%) scale(0.9346);
    }
}

/* 1/1.07 ≈ 0.9346 — компенсація scale на тексті CTA */

@media (prefers-reduced-motion: reduce) {

    body.final-screen-visible .final-screen__cta,
    body.final-screen-visible .final-screen__cta-text {
        animation: none;
    }
}

/* Портрет 9∶16 (і вужчі за висотою): обмежуємо елементи по ширині, щоб не виходили за 100vw */
@media (max-aspect-ratio: 9 / 16) {
    .top-left {
        top: max(2vh, env(safe-area-inset-top, 0px));
        left: max(1.8vw, env(safe-area-inset-left, 0px));
        gap: min(1.5vh, 3.5vw);
    }

    .top-right {
        top: max(2vh, env(safe-area-inset-top, 0px));
        right: max(1.8vw, env(safe-area-inset-right, 0px));
        gap: min(1.5vh, 3.5vw);
    }

    .icon-btn {
        width: min(4.4vh, 11.5vw);
        height: min(4.4vh, 11.5vw);
    }

    .wheel-wrap {
        width: min(91vw, 57.8vh);
        height: min(91vw, 57.8vh);
    }

    .loaded .wheel-wrap {
        transform: translate(-50%, -52%) scale(1);
    }

    .wheel-wrap .arrow {
        width: min(7vh, 12.5vw);
        top: min(-4vh, -6vw);
    }

    .cards {
        bottom: min(16vh, 14vh + 6vw);
        gap: min(1.5vh, 3vw);
        max-width: 96vw;
        padding: 0 2vw;
        box-sizing: border-box;
    }

    .cards img {
        width: min(14vh, 29vw);
        height: min(16.5vh, 34vw);
    }

    .tutorial .cards img.highlight {
        filter: brightness(1.08) drop-shadow(0 0 min(1.5vh, 3.5vw) rgba(255, 70, 70, 0.9)) drop-shadow(0 0 min(3vh, 6vw) rgba(255, 120, 50, 0.6));
    }

    .hint {
        bottom: min(38vh, 28vh + 18vw);
        font-size: min(2.2vh, 4.8vw);
        letter-spacing: min(0.2vh, 0.45vw);
        max-width: 90vw;
        white-space: normal;
        text-align: center;
        line-height: 1.25;
    }

    .hint::after {
        bottom: min(-2.2vh, -4.5vw);
        border-left-width: min(1.2vh, 2.6vw);
        border-right-width: min(1.2vh, 2.6vw);
        border-top-width: min(1.6vh, 3.2vw);
    }

    .spin {
        bottom: calc(4vh + env(safe-area-inset-bottom, 0px));
        width: min(10vh, 18vw);
        height: min(10vh, 18vw);
    }

    .spin-tutorial-hint {
        bottom: min(17vh, 12vh + 10vw);
        font-size: min(2.2vh, 4.8vw);
        letter-spacing: min(0.2vh, 0.45vw);
        max-width: 90vw;
        white-space: normal;
        text-align: center;
        line-height: 1.25;
    }

    .spin-tutorial-hint::after {
        bottom: min(-2.2vh, -4.5vw);
        border-left-width: min(1.2vh, 2.6vw);
        border-right-width: min(1.2vh, 2.6vw);
        border-top-width: min(1.6vh, 3.2vw);
    }

    .balance,
    .bet {
        bottom: calc(4.2vh + env(safe-area-inset-bottom, 0px));
        width: min(22.2vh, 37vw);
        height: min(6.2vh, 11vw);
        border-radius: min(3.1vh, 5.5vw);
    }

    .balance {
        left: max(2vw, env(safe-area-inset-left, 0px));
    }

    .bet {
        right: max(2vw, env(safe-area-inset-right, 0px));
    }

    .balance .label,
    .bet .label {
        font-size: min(1.2vh, 2.8vw);
        letter-spacing: min(0.17vh, 0.35vw);
    }

    .balance .value,
    .bet .value {
        font-size: min(2.4vh, 5vw);
    }

    /* Риболовля: композиція лівіше на вузькому екрані */
    .fishing-scene {
        transform: translateX(-11vw);
    }

    .helicopter-lifting .fishing-scene {
        transform: translateX(-11vw) scale(0.9);
    }

    .ice {
        transform: translateX(calc(-20% + min(2.4vw, 2vh)));
    }

    .fish-drop {
        top: min(-22vh, -25vw);
        width: min(9vh, 16vw);
    }

    .fish-x {
        letter-spacing: min(0.05vh, 0.12vw);
        text-shadow:
            0 0 min(0.4vh, 0.85vw) rgba(0, 0, 0, 0.7),
            0 min(0.2vh, 0.45vw) min(0.5vh, 1vw) rgba(0, 0, 0, 0.5);
    }

    .win-screen {
        padding: max(1.5vh, env(safe-area-inset-top, 0px)) max(2vw, env(safe-area-inset-right, 0px)) max(2vh, env(safe-area-inset-bottom, 0px)) max(2vw, env(safe-area-inset-left, 0px));
    }

    .win-screen__panel {
        width: min(94vw, 58vh);
    }

    .win-screen__shine {
        top: 40%;
        width: min(130vw, 115vh);
    }

    .win-screen__table-wrap {
        max-width: min(92vw, 54vh);
    }

    .win-screen__copy {
        bottom: min(18%, 14% + 2vw);
        width: 90%;
    }

    .win-screen__title {
        margin-bottom: min(0.6vh, 1.2vw);
        font-size: clamp(1.35rem, min(3.8vh, 8vw), 2.4rem);
        letter-spacing: min(0.28vh, 0.6vw);
        text-shadow:
            0 min(0.12vh, 0.25vw) 0 #b87418,
            0 min(0.22vh, 0.45vw) 0 #8a5610,
            0 0 min(1.2vh, 2.5vw) rgba(255, 220, 120, 0.65),
            0 min(0.4vh, 0.85vw) min(0.75vh, 1.5vw) rgba(0, 0, 0, 0.5);
    }

    .win-screen__amount {
        font-size: clamp(1.65rem, min(5.8vh, 11.5vw), 3.4rem);
        letter-spacing: min(0.1vh, 0.25vw);
        text-shadow:
            0 min(0.15vh, 0.35vw) 0 #985908,
            0 min(0.25vh, 0.5vw) 0 #6d3f06,
            0 0 min(1vh, 2.2vw) rgba(255, 236, 140, 0.55),
            0 min(0.55vh, 1.1vw) min(1vh, 2vw) rgba(0, 0, 0, 0.55);
    }

    .fail-screen__panel {
        width: min(90vw, 50vh);
    }

    .fail-screen__table-wrap {
        max-width: min(88vw, 48vh);
    }

    .fail-screen__copy {
        bottom: min(18%, 14% + 2vw);
        width: 90%;
    }

    .fail-screen__title {
        font-size: clamp(1.1rem, min(3vh, 7vw), 2rem);
        letter-spacing: min(0.22vh, 0.5vw);
    }

    .fail-screen__amount {
        font-size: clamp(1.2rem, min(4.2vh, 8.5vw), 2.5rem);
        letter-spacing: min(0.08vh, 0.2vw);
    }

    .final-screen__logo {
        width: min(92vw, 36vh);
    }

    .final-screen__offer-wrap {
        width: min(96vw, 48vh);
    }

    .final-screen__cta {
        width: min(80vw, 42vh);
        margin-top: min(-5vh, -10vw);
    }

    .final-screen__headline {
        font-size: clamp(0.75rem, min(2.1vh, 4.5vw), 1.2rem);
        margin-bottom: min(1.4vh, 3vw);
    }

    .final-screen__reward {
        width: 90%;
        padding: min(1.5vh, 3vw) min(1.8vh, 4vw) min(1.7vh, 3.5vw);
        border-radius: min(1.4vh, 3vw);
    }

    .final-screen__reward-line {
        font-size: clamp(0.9rem, min(2.85vh, 6vw), 1.65rem);
    }

    .final-screen__reward-line--fs {
        font-size: clamp(0.82rem, min(2.5vh, 5.2vw), 1.4rem);
    }

    .final-screen__cta-text {
        font-size: clamp(0.82rem, min(2.4vh, 5vw), 1.35rem);
    }
}

/* Loading screen */
body.is-loading {
    overflow: hidden;
}

.loading-screen {
    position: fixed;
    inset: 0;
    z-index: 10001;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: 100vw;
    height: 100svh;
    min-height: 100dvh;
    background: center / cover no-repeat url('../images/bg-wheel.webp');
    transition: opacity 0.5s ease, visibility 0.5s ease;
}

.loading-screen.is-done {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

.loading-screen__logo {
    width: min(38vh, 70vw);
    height: auto;
    object-fit: contain;
    margin: auto 0;
}

.loading-screen__bottom {
    width: min(80vw, 40vh);
    padding-bottom: 6vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1.2vh;
}

.loading-screen__text {
    margin: 0;
    color: #fff;
    font-family: 'Arial Black', 'Arial', sans-serif;
    font-size: 2vh;
    letter-spacing: 0.25em;
    text-indent: 0.25em;
}

.loading-screen__bar {
    width: 100%;
    height: 0.8vh;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 1vh;
    overflow: hidden;
}

.loading-screen__bar-fill {
    height: 100%;
    width: 0%;
    background: #40c35a;
    border-radius: 1vh;
    transition: width 0.2s linear;
}