/* Smurfs crash game — page-scoped styles (loaded only by templates/games/smurfs.html) */

.smurfs-page {
    --smurfs-blue: #2f8fff;
    --smurfs-dark: #0b1830;
    --smurfs-panel: rgba(10, 22, 44, 0.92);
    --smurfs-green: #1fd68a;
    --smurfs-red: #ff4d6d;
    color: #e9f2ff;
    padding: 18px 0 40px;
}

.smurfs-page * {
    box-sizing: border-box;
}

.smurfs-slider {
    position: relative;
    overflow: hidden;
    min-height: 120px;
    margin-bottom: 16px;
    border: 1px solid rgba(47, 143, 255, 0.3);
    border-radius: 12px;
    background: var(--smurfs-panel);
}

.smurfs-slider-slide {
    display: none;
}

.smurfs-slider-slide.is-active {
    display: block;
    animation: smurfs-slider-fade 320ms ease-out;
}

.smurfs-slider a,
.smurfs-slider img {
    display: block;
    width: 100%;
}

.smurfs-slider img {
    min-height: 120px;
    object-fit: cover;
}

@keyframes smurfs-slider-fade {
    from { opacity: 0; }
    to { opacity: 1; }
}

.smurfs-head {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 4px;
    margin-bottom: 12px;
}

.smurfs-logo {
    display: block;
    width: min(240px, 48%);
    height: auto;
    pointer-events: none;
    user-select: none;
}

.smurfs-head p {
    margin: 4px 0 0;
    font-size: 13px;
    opacity: 1;
    background-color: var(--smurfs-blue);
    border-radius: 10px;
    font-weight: bold;
    text-transform: uppercase;
    padding: 10px 14px;
}

.smurfs-balance {
    background: var(--smurfs-panel);
    border: 1px solid rgba(47, 143, 255, 0.35);
    border-radius: 12px;
    padding: 8px 14px;
    font-weight: 700;
    font-size: 15px;
}

.smurfs-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 320px;
    gap: 16px;
    align-items: stretch;
}

/* Stage */
.smurfs-stage {
    position: relative;
    height: 100%;
    overflow: hidden;
    border-radius: 16px;
    border: 1px solid rgba(47, 143, 255, 0.3);
    background: linear-gradient(180deg, #0b1f42 0%, #17457a 55%, #2a76a8 100%);
    min-height: 440px;
    padding: 18px;
}

.smurfs-sky {
    position: absolute;
    inset: 0;
    background: radial-gradient(circle at 78% 18%, rgba(255, 236, 170, 0.35), transparent 42%);
    pointer-events: none;
}

.smurfs-forest {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    height: 100%;
    background-image: url("../img/smurfs/forest-bg.svg");
    background-repeat: repeat-x;
    background-position: 0 bottom;
    background-size: 900px 338px;
    z-index: 1;
    pointer-events: none;
}

.smurfs-forest.is-running {
    animation: smurfs-scroll 7s linear infinite;
}

@keyframes smurfs-scroll {
    from { background-position: 0 bottom; }
    to { background-position: -900px bottom; }
}

.smurfs-multiplier {
    position: relative;
    z-index: 3;
    text-align: center;
    font-size: 58px;
    font-weight: 900;
    line-height: 1;
    text-shadow: 0 6px 24px rgba(0, 0, 0, 0.55);
    font-variant-numeric: tabular-nums;
}

.smurfs-multiplier.is-win {
    color: var(--smurfs-green);
}

.smurfs-multiplier.is-crash {
    color: var(--smurfs-red);
}

.smurfs-status {
    position: relative;
    z-index: 3;
    text-align: center;
    margin-top: 8px;
    min-height: 22px;
    font-size: 14px;
    font-weight: 600;
    opacity: 0.9;
}

.smurfs-live-feed {
    position: absolute;
    z-index: 4;
    top: 16px;
    right: 16px;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 5px;
    width: min(220px, 42%);
    pointer-events: none;
}

.smurfs-live-win {
    width: max-content;
    max-width: 100%;
    overflow: hidden;
    color: #ffffff;
    font-size: 11px;
    font-weight: 600;
    line-height: 1.25;
    text-align: right;
    text-overflow: ellipsis;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.65);
    white-space: nowrap;
    animation: smurfs-live-win-in 420ms ease-out both;
}

@keyframes smurfs-live-win-in {
    from { opacity: 0; transform: translateX(18px); }
    to { opacity: 0.9; transform: translateX(0); }
}

.smurfs-track {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 26px;
    height: 108px;
    z-index: 2;
}

.smurfs-actor {
    position: absolute;
    bottom: 0;
    transition: left 120ms linear;
    filter: drop-shadow(0 8px 8px rgba(0, 0, 0, 0.4));
}

.smurfs-actor--hero {
    --character-scale: 1.06;
    --character-offset: 4px;
    --character-lean: -16deg;
    width: 88px;
    height: 116px;
}

.smurfs-actor--villain {
    --character-scale: 1.48;
    --character-offset: 16px;
    --character-lean: 20deg;
    width: 126px;
    height: 142px;
}

.smurfs-character {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: flex-end;
    justify-content: center;
    overflow: visible;
}

.smurfs-character img,
.smurfs-character svg {
    display: block;
    width: 100%;
    height: 100%;
    user-select: none;
    pointer-events: none;
    overflow: visible;
    object-fit: contain;
    object-position: center bottom;
    filter: drop-shadow(0 8px 10px rgba(0, 0, 0, 0.45));
}

.smurfs-character-image {
    background: transparent;
    transform: translateY(var(--character-offset)) scale(var(--character-scale)) rotate(var(--character-lean));
    transform-origin: center bottom;
}

.smurfs-actor.is-running .smurfs-character-image {
    animation: smurfs-run-bob 0.28s infinite alternate ease-in-out;
}

.smurfs-actor.is-running::after {
    content: "";
    position: absolute;
    left: 18%;
    bottom: -10px;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.26);
    filter: blur(4px);
    animation: smurfs-foot-dust 0.5s infinite ease-out;
}

.smurfs-actor.is-running::before {
    content: "";
    position: absolute;
    left: 8%;
    bottom: -2px;
    width: 26px;
    height: 26px;
    border-radius: 50%;
    background: conic-gradient(
        from 12deg,
        rgba(255, 255, 255, 0.7) 0deg 24deg,
        transparent 24deg 90deg,
        rgba(255, 255, 255, 0.55) 90deg 114deg,
        transparent 114deg 180deg,
        rgba(255, 255, 255, 0.65) 180deg 204deg,
        transparent 204deg 270deg,
        rgba(255, 255, 255, 0.5) 270deg 294deg,
        transparent 294deg 360deg
    );
    filter: blur(1px);
    opacity: 0.72;
    transform-origin: center;
    animation: smurfs-foot-propeller 0.34s infinite linear;
    pointer-events: none;
}

.smurfs-actor--villain.is-running::before {
    left: 10%;
    bottom: -1px;
    width: 32px;
    height: 32px;
    opacity: 0.65;
}

.smurfs-actor--villain.is-running::after {
    left: 14%;
    width: 22px;
    height: 22px;
    background: rgba(255, 255, 255, 0.22);
}

.smurfs-svg {
    width: 100%;
    height: 100%;
    display: block;
    overflow: visible;
}

.smurfs-actor.is-running {
    animation: smurfs-bob 0.32s infinite ease-in-out;
}

.smurfs-actor--villain.is-running {
    animation-delay: 0.16s;
}

/* Limb rig — the SVGs are inlined so these selectors reach the individual parts. */
.smurf-limb {
    transform-box: fill-box;
    transform-origin: 50% 8%;
}

.smurfs-actor.is-running .smurf-leg-front,
.smurfs-actor.is-running .gargamel-leg-front {
    animation: smurfs-stride-a 0.32s infinite ease-in-out;
}

.smurfs-actor.is-running .smurf-leg-back,
.smurfs-actor.is-running .gargamel-leg-back {
    animation: smurfs-stride-b 0.32s infinite ease-in-out;
}

.smurfs-actor.is-running .smurf-arm-front {
    animation: smurfs-stride-b 0.32s infinite ease-in-out;
}

.gargamel-arm {
    transform-origin: 6% 50%;
}

.smurfs-actor.is-running .gargamel-arm {
    animation: smurfs-grasp 0.32s infinite ease-in-out;
}

.smurfs-actor.is-running .smurf-arm-back {
    animation: smurfs-stride-a 0.32s infinite ease-in-out;
}

.smurfs-actor.is-running .gargamel-cat {
    animation: smurfs-bob 0.26s infinite ease-in-out;
    transform-box: fill-box;
    transform-origin: 50% 100%;
}

.smurfs-actor.is-caught .smurf-limb {
    animation: none !important;
}

.smurfs-actor--villain.is-caught {
    animation: smurfs-shake 0.24s 3 ease-in-out;
}

.smurfs-actor--hero.is-caught {
    filter: grayscale(0.85) drop-shadow(0 8px 8px rgba(0, 0, 0, 0.4));
    transform: rotate(-14deg) translateY(6px);
}

.smurfs-actor--hero.is-escaped {
    animation: smurfs-escape 0.7s forwards ease-in;
}

@keyframes smurfs-bob {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-4px); }
}

@keyframes smurfs-run-bob {
    0% { transform: translateY(var(--character-offset)) scale(var(--character-scale)) rotate(var(--character-lean)); }
    50% { transform: translateY(calc(var(--character-offset) - 4px)) scale(var(--character-scale)) rotate(var(--character-lean)); }
    100% { transform: translateY(var(--character-offset)) scale(var(--character-scale)) rotate(var(--character-lean)); }
}

@keyframes smurfs-foot-dust {
    0% { opacity: 0; transform: translate(-4px, 0) scale(0.6); }
    20% { opacity: 0.6; }
    100% { opacity: 0; transform: translate(12px, 8px) scale(1.3); }
}

@keyframes smurfs-foot-propeller {
    from { transform: rotate(0deg) scale(0.82); }
    to { transform: rotate(360deg) scale(1); }
}

@keyframes smurfs-stride-a {
    0%, 100% { transform: rotate(7deg); }
    50% { transform: rotate(-7deg); }
}

@keyframes smurfs-stride-b {
    0%, 100% { transform: rotate(-7deg); }
    50% { transform: rotate(7deg); }
}

@keyframes smurfs-grasp {
    0%, 100% { transform: rotate(-4deg) translateX(0); }
    50% { transform: rotate(4deg) translateX(2px); }
}

@keyframes smurfs-shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-5px); }
    75% { transform: translateX(5px); }
}

@keyframes smurfs-escape {
    to { transform: translateX(160px) translateY(-30px) rotate(12deg); opacity: 0; }
}

.smurfs-cloud {
    position: absolute;
    top: 12px;
    font-size: 30px;
    opacity: 0.35;
    z-index: 1;
    animation: smurfs-drift 22s linear infinite;
}

.smurfs-cloud:nth-of-type(2) { top: 46px; animation-duration: 31s; font-size: 22px; }

@keyframes smurfs-drift {
    from { left: -12%; }
    to { left: 108%; }
}

/* Controls */
.smurfs-panel {
    width: 100%;
    margin: 0;
    height: 100%;
    background: var(--smurfs-panel);
    border: 1px solid rgba(47, 143, 255, 0.3);
    border-radius: 16px;
    padding: 12px 14px;
}

.smurfs-panel .smurfs-balance {
    margin-bottom: 10px;
}

.smurfs-field {
    margin-bottom: 8px;
}

.smurfs-field label {
    display: block;
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.6px;
    opacity: 0.7;
    margin-bottom: 6px;
}

.smurfs-field input {
    width: 100%;
    height: 44px;
    border-radius: 10px;
    border: 1px solid rgba(255, 255, 255, 0.16);
    background: rgba(4, 12, 26, 0.85);
    color: #fff;
    padding: 0 12px;
    font-size: 16px;
    font-weight: 700;
}

.smurfs-field input:focus {
    outline: none;
    border-color: var(--smurfs-blue);
}

.smurfs-chips {
    display: flex;
    gap: 6px;
    margin-top: 8px;
}

.smurfs-chip {
    flex: 1;
    height: 32px;
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.14);
    background: rgba(255, 255, 255, 0.06);
    color: #dbe9ff;
    font-size: 12px;
    font-weight: 700;
    cursor: pointer;
}

.smurfs-chip:hover {
    border-color: var(--smurfs-blue);
}

.smurfs-action {
    width: 100%;
    height: 48px;
    border: 0;
    border-radius: 12px;
    font-size: 17px;
    font-weight: 800;
    cursor: pointer;
    color: #ffffff;
    background: linear-gradient(180deg, #ff86bd, #f05298);
    transition: filter 120ms ease;
}

.smurfs-action:hover:not(:disabled) {
    filter: brightness(1.08);
}

.smurfs-action:disabled {
    opacity: 0.55;
    cursor: not-allowed;
}

.smurfs-action--cashout {
    background: linear-gradient(180deg, #6bf3b6, #12b877);
}

.smurfs-note {
    margin-top: 7px;
    font-size: 12px;
    line-height: 1.5;
    opacity: 0.65;
}

.smurfs-alert {
    margin-top: 10px;
    padding: 9px 12px;
    border-radius: 10px;
    font-size: 13px;
    font-weight: 600;
    display: none;
}

.smurfs-alert.is-visible {
    display: block;
}

.smurfs-alert--error {
    background: rgba(255, 77, 109, 0.16);
    border: 1px solid rgba(255, 77, 109, 0.5);
    color: #ffc2ce;
}

.smurfs-history {
    margin-top: 10px;
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.smurfs-history-item {
    padding: 5px 10px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 800;
    background: rgba(255, 77, 109, 0.18);
    border: 1px solid rgba(255, 77, 109, 0.45);
    color: #ffb9c6;
}

.smurfs-history-item.is-win {
    background: rgba(31, 214, 138, 0.16);
    border-color: rgba(31, 214, 138, 0.45);
    color: #9df3cd;
}

.smurfs-fair {
    margin-top: 10px;
    font-size: 11px;
    line-height: 1.6;
    word-break: break-all;
    opacity: 0.6;
}

.smurfs-info {
    margin-top: 14px;
    padding: 18px 20px;
    border: 1px solid rgba(47, 143, 255, 0.24) !important;
    border-radius: 14px;
    background: #ffffff !important;
    color: #000000;
    font-size: 13px;
    line-height: 1.65;
}

.smurfs-info h2 {
    margin: 0 0 8px;
    color: #000000;
    font-size: 16px;
    font-weight: 800;
}

.smurfs-info p {
    margin: 0 0 8px;
}

.smurfs-info p:last-child {
    margin-bottom: 0;
}

.smurfs-info strong {
    color: #000000;
}

.smurfs-info-content {
    display: flex;
    align-items: flex-end;
    gap: 18px;
}

.smurfs-info-copy {
    flex: 1;
}

.smurfs-info-image {
    display: block;
    width: 140px;
    height: auto;
    flex: 0 0 auto;
    border-radius: 8px;
}

@media (max-width: 900px) {
    .smurfs-layout {
        grid-template-columns: minmax(0, 1fr);
    }

    .smurfs-multiplier {
        font-size: 44px;
    }

    .smurfs-stage {
        height: auto;
        min-height: 280px;
        padding: 12px;
    }

    .smurfs-live-feed {
        top: 12px;
        right: 12px;
        width: min(185px, 53%);
    }

    .smurfs-live-win {
        font-size: 10px;
    }

    .smurfs-page {
        padding-top: 8px;
        padding-bottom: 20px;
    }

    .smurfs-head {
        align-items: center;
        margin-bottom: 8px;
    }

    .smurfs-head p {
        margin-top: 0;
        font-size: 12px;
    }

    .smurfs-logo {
        width: 150px;
    }

    .smurfs-track {
        height: 88px;
        bottom: 14px;
    }

    .smurfs-actor--hero {
        width: 54px;
        height: 76px;
    }

    .smurfs-actor--villain {
        width: 74px;
        height: 84px;
    }

    .smurfs-panel {
        height: auto;
        min-height: 0;
        padding: 12px;
        border-radius: 12px;
    }

    .smurfs-panel .smurfs-balance {
        margin-bottom: 10px;
        padding: 7px 10px;
        font-size: 14px;
    }

    .smurfs-field {
        margin-bottom: 8px;
    }

    .smurfs-field input {
        height: 40px;
    }

    .smurfs-action {
        height: 48px;
    }

    .smurfs-note {
        margin-top: 7px;
        line-height: 1.35;
    }

    .smurfs-info {
        margin-top: 10px;
        padding: 14px;
        font-size: 12px;
        line-height: 1.5;
    }
}

@media (max-width: 768px) {
    .smurfs-info-content {
        flex-direction: column;
        align-items: center;
        gap: 12px;
    }

    .smurfs-info-image {
        width: 140px;
    }
}

@media (prefers-reduced-motion: reduce) {
    .smurfs-forest.is-running,
    .smurfs-actor.is-running,
    .smurfs-actor.is-running .smurf-limb,
    .smurfs-cloud {
        animation: none;
    }
}
