:root {
    --tg-safe-top: 0px;
    --tg-safe-bottom: 0px;
    --bg-deep: #150d08;
    --bg-reel-mask: #150d08;
    --bg-card: rgba(96, 96, 96, 0.05);
    --orange: #ff9831;
    --orange-glow: rgba(255, 152, 49, 0.18);
    --white-40: rgba(255, 255, 255, 0.4);
    --white-50: rgba(255, 255, 255, 0.5);
    --white-07: rgba(255, 255, 255, 0.07);
    --ticket-dark: #3a2001;
    --ticket-gold: linear-gradient(180deg, #f5e6a8 0%, #e8c96b 45%, #d4a84a 100%);
    --bar-bg: #17100c;
    --font: -apple-system, BlinkMacSystemFont, "SF Pro Display", "SF Pro Text", "Segoe UI", Roboto, sans-serif;
    --tabbar-total: calc(96px + env(safe-area-inset-bottom, 0px));
}

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

html {
    height: 100%;
}

body {
    height: 100%;
    min-height: 100%;
    min-height: 100svh;
    background: var(--bg-deep);
    color: #fff;
    font-family: var(--font);
    margin: 0;
    padding: 0;
    position: relative;
    overflow: hidden;
}

body::before {
    content: "";
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 0;
    background-color: var(--bg-deep);
    background-image:
        url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='512' height='512'%3E%3Cg fill='%23ffffff'%3E%3Ccircle cx='47' cy='23' r='0.7' opacity='0.25'/%3E%3Ccircle cx='189' cy='67' r='0.9' opacity='0.3'/%3E%3Ccircle cx='341' cy='19' r='0.5' opacity='0.18'/%3E%3Ccircle cx='453' cy='91' r='0.65' opacity='0.22'/%3E%3Ccircle cx='78' cy='178' r='0.8' opacity='0.28'/%3E%3Ccircle cx='267' cy='143' r='0.55' opacity='0.2'/%3E%3Ccircle cx='412' cy='213' r='0.7' opacity='0.24'/%3E%3Ccircle cx='31' cy='309' r='0.6' opacity='0.22'/%3E%3Ccircle cx='198' cy='287' r='0.85' opacity='0.26'/%3E%3Ccircle cx='367' cy='341' r='0.5' opacity='0.18'/%3E%3Ccircle cx='481' cy='378' r='0.75' opacity='0.23'/%3E%3Ccircle cx='112' cy='421' r='0.6' opacity='0.2'/%3E%3Ccircle cx='293' cy='467' r='0.7' opacity='0.25'/%3E%3Ccircle cx='439' cy='489' r='0.55' opacity='0.19'/%3E%3Ccircle cx='503' cy='42' r='0.6' opacity='0.21'/%3E%3Ccircle cx='137' cy='102' r='0.75' opacity='0.27'/%3E%3Ccircle cx='322' cy='118' r='0.5' opacity='0.19'/%3E%3Ccircle cx='18' cy='247' r='0.7' opacity='0.24'/%3E%3Ccircle cx='469' cy='271' r='0.6' opacity='0.22'/%3E%3Ccircle cx='152' cy='339' r='0.8' opacity='0.26'/%3E%3Ccircle cx='387' cy='409' r='0.55' opacity='0.2'/%3E%3Ccircle cx='58' cy='473' r='0.65' opacity='0.23'/%3E%3Ccircle cx='231' cy='397' r='0.5' opacity='0.18'/%3E%3Ccircle cx='497' cy='501' r='0.7' opacity='0.24'/%3E%3C/g%3E%3C/svg%3E"),
        linear-gradient(
            180deg,
            rgba(255, 140, 50, 0.18) 0%,
            rgba(255, 120, 40, 0.07) 20%,
            transparent 45%
        ),
        linear-gradient(
            180deg,
            #2e1e0e 0%,
            #1f1409 18%,
            #150d08 40%,
            #150d08 100%
        );
    background-repeat: repeat, no-repeat, no-repeat;
    background-size: 512px 512px, 100% 100%, 100% 100%;
}

.app {
    position: relative;
    z-index: 1;
    display: flex;
    flex-direction: column;
    max-width: 430px;
    margin: 0 auto;
    width: 100%;
    height: 100%;
    max-height: 100svh;
    padding: 0;
    padding-top: var(--tg-safe-top);
    box-sizing: border-box;
}

.app-scroll {
    flex: 1;
    min-height: 0;
    overflow-x: clip;
    overflow-y: auto;
    padding-left: 16px;
    padding-right: 16px;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
    padding-top: max(4px, env(safe-area-inset-top, 0px));
    padding-bottom: var(--tabbar-total);
    scrollbar-width: none;
    -ms-overflow-style: none;
}

.app-scroll::-webkit-scrollbar {
    width: 0;
    height: 0;
    display: none;
}

.topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 8px;
}

.brand-pill {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    min-height: 56px;
    padding: 10px 14px;
    border-radius: 23.691px;
    border: 0.948px solid transparent;
    background-color: rgba(76, 76, 76, 0.09);
    background-clip: padding-box;
    position: relative;
    overflow: clip;
    -webkit-backdrop-filter: blur(14px) saturate(1.12);
    backdrop-filter: blur(14px) saturate(1.12);
}

.brand-pill::before,
.fast-row::before,
.inventory::before,
.balance-chip::before {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: inherit;
    padding: var(--glass-border, 1.5px);
    box-sizing: border-box;
    pointer-events: none;
    background: linear-gradient(
        to bottom,
        rgba(255, 255, 255, 0.12) 0%,
        rgba(255, 255, 255, 0.04) 12%,
        rgba(255, 255, 255, 0) 92%
    );
    -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
    -webkit-mask-composite: xor;
    mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
    mask-composite: exclude;
}

.balance-chip::before {
    background:
        radial-gradient(
            ellipse 60% 100% at 50% 50%,
            rgba(255, 255, 255, 0.35) 0%,
            rgba(255, 255, 255, 0) 82%
        ),
        linear-gradient(
            to bottom,
            rgba(255, 255, 255, 0.10) 0%,
            rgba(255, 255, 255, 0.035) 12%,
            rgba(255, 255, 255, 0) 35%,
            rgba(255, 255, 255, 0) 65%,
            rgba(255, 255, 255, 0.035) 88%,
            rgba(255, 255, 255, 0.10) 100%
        );
    background-blend-mode: soft-light;
}

.brand {
    font-size: 20px;
    font-weight: 800;
    line-height: 20px;
    letter-spacing: -0.43px;
    white-space: nowrap;
}

.brand span.market { color: var(--orange); }

.balance-chip {
    position: relative;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 12px 6px 10px;
    border-radius: 12.229px;
    min-height: 36px;
    width: auto;
    --glass-border: 0.948px;
    border: 0.948px solid rgba(255, 255, 255, 0.00);
    overflow: clip;
    background:
        rgba(76, 76, 76, 0.09),
        linear-gradient(
            90deg,
            rgba(255, 255, 255, 0.00) 0%,
            rgba(255, 255, 255, 0.09) 39.58%,
            rgba(255, 255, 255, 0.10) 52.08%,
            rgba(255, 255, 255, 0.09) 64.58%,
            rgba(255, 255, 255, 0.00) 100%
        );
    background-blend-mode: normal, soft-light;
    -webkit-backdrop-filter: blur(10px) saturate(1.12);
    backdrop-filter: blur(10px) saturate(1.12);
}

.balance-chip > * {
    position: relative;
    z-index: 2;
}

.balance-chip .wallet-ic {
    flex-shrink: 0;
    width: 13px;
    height: 13px;
    display: block;
}

.balance-chip .bal {
    font-size: 13px;
    font-weight: 700;
    color: #fffefd;
    letter-spacing: -0.02em;
}

.roulette-hero {
    margin: 10px 0 14px;
    padding: 0 2px;
}

.roulette-hero-grid {
    display: grid;
    grid-template-columns: auto 1fr;
    grid-template-rows: auto auto;
    column-gap: 10px;
    row-gap: 8px;
    align-items: center;
}

.roulette-hero-icon {
    grid-row: 1;
    grid-column: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: 24.5px;
    flex-shrink: 0;
    gap: 3.76px;
}

.rh-bar {
    display: block;
    width: 24.457px;
    height: 3.763px;
    border-radius: 67.727px;
    background: rgba(255, 152, 49, 0.11);
}

.rh-bar--main {
    width: 20.694px;
    height: 7.525px;
    background: var(--orange);
}

.roulette-hero-title {
    grid-row: 1;
    grid-column: 2;
    margin: 0;
    font-family: "SF Pro Display", -apple-system, BlinkMacSystemFont, sans-serif;
    font-size: 30.624px;
    font-weight: 800;
    font-stretch: expanded;
    letter-spacing: -1.7859px;
    line-height: 30.361px;
    color: #fff;
}

.roulette-hero-sub {
    grid-row: 2;
    grid-column: 2;
    margin: 0;
    max-width: 234px;
    font-family: "SF Pro Text", -apple-system, BlinkMacSystemFont, sans-serif;
    font-size: 14.462px;
    font-weight: 500;
    color: rgba(255, 255, 255, 0.26);
    letter-spacing: -1.281px;
    line-height: 15.905px;
}

.reels-wrap {
    position: relative;
    flex: 1;
    min-height: 280px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 4px -16px 8px;
}

.marker {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    height: 5.335px;
    background: var(--orange);
    border-radius: 28.81px;
    z-index: 12;
    pointer-events: none;
}

.marker.left {
    left: 0;
    width: 16px;
}

.marker.right {
    right: 0;
    width: 16px;
}

.reels-wrap.reel--winner .ticket.center .ticket-art {
    filter:
        drop-shadow(0 0 6px rgba(255, 210, 100, 0.95))
        drop-shadow(0 0 16px rgba(255, 170, 50, 0.65))
        drop-shadow(0 0 28px rgba(255, 140, 40, 0.35));
    transition: filter 0.35s ease;
}

.reel {
    width: 100%;
    height: 320px;
    overflow: hidden;
    position: relative;
}

.reel.is-spinning .ticket {
    transition: none;
}

.strip {
    display: flex;
    flex-direction: column;
    align-items: center;
    will-change: transform;
}

.strip.roulette-calibrate .ticket {
    transform: none !important;
    opacity: 1 !important;
}

.ticket {
    flex-shrink: 0;
    width: min(343.64px, calc(100vw - 48px));
    height: var(--item-h, 108px);
    margin: 6px 0;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    transition: transform 0.28s cubic-bezier(0.25, 0.1, 0.25, 1), opacity 0.28s cubic-bezier(0.25, 0.1, 0.25, 1);
}

.ticket.far {
    transform: scale(0.68);
    opacity: 0.21;
}

.ticket.near {
    transform: scale(0.82);
    opacity: 0.35;
}

.ticket.center {
    transform: scale(1);
    opacity: 1;
}

.ticket-skin {
    width: 100%;
    height: 100%;
    position: relative;
    overflow: visible;
    box-shadow: none;
}

.ticket-art {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: fill;
    object-position: center;
    pointer-events: none;
    -webkit-user-drag: none;
    user-select: none;
    display: block;
}

.ticket-body {
    position: relative;
    z-index: 1;
    width: 100%;
    height: 100%;
    box-sizing: border-box;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 14px;
    padding: 26px 26px;
}

.ticket.dim .ticket-skin {
    opacity: 0.21;
}

.ticket.dim .ticket-art {
    filter: saturate(0.85);
}

.ticket-main {
    font-family: "SF Pro Display", -apple-system, BlinkMacSystemFont, sans-serif;
    font-size: 32.091px;
    font-weight: 800;
    color: var(--ticket-dark);
    letter-spacing: -1.8715px;
    line-height: 31.815px;
    font-stretch: expanded;
    white-space: nowrap;
}

.ticket-badge {
    background: var(--ticket-dark);
    color: #fff;
    font-family: "SF Pro Display", -apple-system, BlinkMacSystemFont, sans-serif;
    font-size: 15.179px;
    font-weight: 600;
    padding: 8.095px 12.143px;
    border-radius: 20.238px;
    letter-spacing: -1.0119px;
    line-height: 20.238px;
    white-space: nowrap;
}

.fast-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin: 8px auto 14px;
    width: 100%;
    max-width: 335px;
    padding: 12px 18px;
    border-radius: 999px;
    min-height: 52px;
    border: 0.948px solid transparent;
    background-color: rgba(76, 76, 76, 0.09);
    background-clip: padding-box;
    position: relative;
    overflow: clip;
    -webkit-backdrop-filter: blur(12px) saturate(1.1);
    backdrop-filter: blur(12px) saturate(1.1);
}

.fast-row span {
    font-size: 14px;
    font-weight: 500;
    letter-spacing: -0.05em;
}

.switch {
    position: relative;
    width: 48px;
    height: 28px;
    flex-shrink: 0;
}

.switch input {
    opacity: 0;
    width: 0;
    height: 0;
    position: absolute;
}

.switch-slider {
    position: absolute;
    inset: 0;
    background: rgba(255, 255, 255, 0.15);
    border-radius: 64px;
    cursor: pointer;
    transition: background 0.2s;
}

.switch-slider::before {
    content: "";
    position: absolute;
    height: 22px;
    width: 22px;
    left: 3px;
    top: 3px;
    background: #fff;
    border-radius: 50%;
    transition: transform 0.2s;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.2);
}

.switch input:checked + .switch-slider {
    background: var(--orange);
}

.switch input:checked + .switch-slider::before {
    transform: translateX(20px);
}

.spin-wrap {
    width: 100%;
    max-width: 340px;
    margin: 0 auto;
    position: relative;
}

.spin-btn {
    width: 100%;
    min-height: 48px;
    padding: 12px 24px;
    border: none;
    border-radius: 42px;
    background: var(--orange);
    color: #fff;
    font-size: 18px;
    font-weight: 600;
    letter-spacing: -0.02em;
    line-height: 1;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    box-shadow: 0 0 40px var(--orange-glow);
    transition: transform 0.1s, opacity 0.2s;
    -webkit-tap-highlight-color: transparent;
}

.spin-btn:active:not(:disabled) { transform: scale(0.98); }
.spin-btn:disabled { opacity: 0.45; cursor: not-allowed; box-shadow: none; }

.spin-btn-ic {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 27px;
    height: 27px;
    flex-shrink: 0;
}

.spin-btn-ic-svg {
    display: block;
    width: 27px;
    height: 27px;
}

.spin-btn-label {
    display: inline-flex;
    align-items: center;
    line-height: 1;
}

.spins-hint {
    text-align: center;
    margin-top: 10px;
    font-size: 11px;
    font-weight: 500;
    color: var(--white-50);
    letter-spacing: -0.04em;
}

.inventory {
    margin-top: 18px;
    margin-bottom: 20px;
    padding: 22px 16px 18px;
    border-radius: 29px;
    background: rgba(96, 96, 96, 0.05);
    backdrop-filter: blur(25px);
    -webkit-backdrop-filter: blur(25px);
    --glass-border: 0.948px;
    border: 0.948px solid transparent;
    box-shadow: none;
    position: relative;
    overflow: clip;
}

.inventory-label {
    font-family: "SF Pro Display", -apple-system, BlinkMacSystemFont, sans-serif;
    font-size: 15.094px;
    font-weight: 400;
    color: rgba(255, 255, 255, 0.4);
    text-align: left;
    letter-spacing: -0.7547px;
    line-height: normal;
}

.inventory-num {
    text-align: left;
    font-family: "Inter Tight", "Inter", "SF Pro Display", sans-serif;
    font-size: 45px;
    font-weight: 800;
    line-height: 1;
    margin: 12px 0 18px;
    letter-spacing: -0.02em;
    position: relative;
    min-height: 45px;
}

.inventory-num .ghost {
    position: absolute;
    left: 0;
    top: 0;
    filter: blur(45.7px);
    opacity: 0.37;
    color: rgba(255, 255, 255, 0.37);
    pointer-events: none;
}

.inventory-num .solid {
    position: relative;
    color: #fff;
}

.btn-buy {
    width: 100%;
    min-height: 40.936px;
    border: none;
    border-radius: 36.842px;
    background: #fff;
    color: #595959;
    font-family: "SF Pro Display", -apple-system, BlinkMacSystemFont, sans-serif;
    font-size: 16.583px;
    font-weight: 600;
    letter-spacing: -0.4195px;
    line-height: 21.46px;
    cursor: pointer;
    padding: 0 19.649px;
    display: flex;
    align-items: center;
    justify-content: center;
    -webkit-tap-highlight-color: transparent;
    transition: transform 0.1s ease, opacity 0.2s ease, filter 0.12s ease;
}

.btn-buy:active:not(:disabled) {
    transform: scale(0.98);
    filter: brightness(0.94);
}

.btn-buy:disabled {
    opacity: 0.5;
    cursor: wait;
}

.inventory-foot {
    text-align: center;
    font-family: "SF Pro", -apple-system, BlinkMacSystemFont, sans-serif;
    font-size: 11.289px;
    font-weight: 500;
    color: rgba(255, 255, 255, 0.5);
    letter-spacing: -1px;
    line-height: 17.74px;
    margin-top: 12px;
}

.tabbar {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 100;
    max-width: 430px;
    width: 100%;
    margin: 0;
    padding: 12px 16px calc(10px + env(safe-area-inset-bottom, 0px));
    box-sizing: border-box;
    background: var(--bar-bg);
    border-radius: 28px 28px 0 0;
    border: none;
    box-shadow: none;
    overflow: clip;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
}

.tabbar::before {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: inherit;
    padding: 0.5px;
    box-sizing: border-box;
    pointer-events: none;
    background: linear-gradient(
        to bottom,
        rgba(255, 255, 255, 0.12) 0%,
        rgba(255, 255, 255, 0.04) 12%,
        rgba(255, 255, 255, 0) 92%
    );
    -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
    -webkit-mask-composite: xor;
    mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
    mask-composite: exclude;
}

.tabbar-row {
    display: flex;
    justify-content: center;
    gap: 8px;
    width: 100%;
}

.tab {
    flex: 1;
    max-width: 140px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    padding: 6px 8px 10px;
    background: none;
    border: none;
    color: rgba(255, 255, 255, 0.4);
    font-size: 11px;
    font-weight: 500;
    cursor: pointer;
    font-family: inherit;
    -webkit-tap-highlight-color: transparent;
}

.tab.active {
    color: var(--orange);
}

.tab-ic {
    width: 40px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.tab.active .tab-ic svg:not(.tab-roulette-ic):not(.tab-tasks-ic) { stroke: var(--orange); fill: var(--orange); }
.tab:not(.active) .tab-ic svg:not(.tab-roulette-ic):not(.tab-tasks-ic) { stroke: rgba(255, 255, 255, 0.45); fill: none; }

.tab.active .tab-ic svg.tab-roulette-ic rect:nth-child(1),
.tab.active .tab-ic svg.tab-roulette-ic rect:nth-child(3) {
    fill: rgba(255, 152, 49, 0.11);
}

.tab.active .tab-ic svg.tab-roulette-ic rect:nth-child(2) {
    fill: var(--orange);
}

.tab:not(.active) .tab-ic svg.tab-roulette-ic rect:nth-child(1),
.tab:not(.active) .tab-ic svg.tab-roulette-ic rect:nth-child(3) {
    fill: rgba(255, 255, 255, 0.11);
}

.tab:not(.active) .tab-ic svg.tab-roulette-ic rect:nth-child(2) {
    fill: rgba(255, 255, 255, 0.45);
}

.home-ind {
    width: 36%;
    height: 5px;
    background: rgba(255, 255, 255, 0.9);
    border-radius: 100px;
    opacity: 0.85;
    display: none;
}
