@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap');
@import url('https://fonts.cdnfonts.com/css/sf-pro-display-2');
@import url('assets/fonts/sf-pro-rounded.css');

:root {
    --primary-blue: #00b3f0;
    --primary-black: #000000;
    --text-primary: #000000;
    /* alias — used throughout UI */
    --gray-text: #a1a5a8;
    --gray-light: #8e8e93;
    --bg-secondary: #7474801f;
    --bg-nav: #7474800d;
    --btn-inactive-bg: #e8e8e9;
    --btn-inactive-text: #b9b9ba;
    --bg-white: #ffffff;
    --border-color: #c8c7cb;
    --gift-gradient: linear-gradient(90deg, #0881EF 0%, #A02ECE 31.73%, #E13775 61.06%, #F76571 81.25%, #F0AA17 100%);
    --font-display: 'SF Pro Display', 'SF Pro', 'Inter', -apple-system, sans-serif;
    --font-rounded: 'SF Pro Rounded', 'SF Pro Display', 'SF Pro', 'Inter', -apple-system, sans-serif;
    --font-text: 'SF Pro Display', 'SF Pro', 'Inter', -apple-system, sans-serif;
    --font-mono: 'SF Mono', 'SFMono-Regular', ui-monospace, 'DejaVu Sans Mono', Menlo, Consolas, monospace;
    --radius-btn: 99px;
    --radius-nav: 15px;
    --transition-standard: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

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

body {
    font-family: var(--font-text);
    background-color: var(--bg-white);
    color: var(--primary-black);
    min-height: 100vh;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
    letter-spacing: -0.02em;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
}

input,
textarea,
[contenteditable="true"],
.key-text,
button,
.btn,
.ripple-effect {
    -webkit-user-select: text;
    -moz-user-select: text;
    -ms-user-select: text;
    user-select: text;
}

* {
    -webkit-tap-highlight-color: transparent;
}

#app {
    position: relative;
    width: 100vw;
    min-height: 100vh;
}

.screen {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    min-height: 100%;
    background: #fff;
    display: none;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.4s ease, transform 0.4s ease;
}

.screen.active {
    display: flex;
    opacity: 1;
    transform: translateY(0);
}

#screen-dashboard {
    position: relative;
    min-height: 100vh;
    justify-content: flex-start;
    transform: none !important;
}

#screen-dashboard.active {
    transform: none !important;
}

/* Gift Banner */
.gift-banner {
    position: relative;
    width: 400px;
    height: 84px;
    background: #EFEFF4;
    border-radius: 20px;
    display: flex;
    align-items: flex-start;
    padding: 20px;
    margin-top: 0;
    margin-bottom: 97px;
    text-align: left;
}

.gift-icon {
    width: 20px;
    height: 22px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-right: 8px;
    flex-shrink: 0;
}

.gift-icon img {
    width: 20px;
    height: 20px;
}

.gift-text {
    font-size: 16px;
    font-weight: 590;
    color: var(--primary-black);
    line-height: 22px;
    letter-spacing: -0.31px;
}

.gradient-text {
    background: var(--gift-gradient);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    display: inline;
    /* Changed to inline to flow naturally but will wrap properly with the BR */
}

.gift-badge {
    position: absolute;
    top: -9px;
    right: -10px;
    /* Overflows the container to the right */
    width: 54px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: none;
}

.gift-badge img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

/* Dashboard Styles */
.dashboard-header {
    width: 100%;
    display: flex;
    justify-content: center;
    align-items: flex-start;
    padding: 0 20px;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 80;
    pointer-events: none;
}

.dashboard-header-inner {
    width: 100%;
    max-width: 900px;
    height: 92px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 18px 20px 0;
    position: relative;
    z-index: 1;
    overflow: visible;
    pointer-events: auto;
    background: transparent;
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
}

.dashboard-header-inner::before {
    content: none;
}

.dashboard-header-inner::after {
    content: none;
}

.dashboard-header-inner>* {
    position: relative;
    z-index: 1;
}

.logo-small,
.dashboard-fixed-brand {
    display: flex;
    align-items: center;
}

.logo-small {
    gap: 16px;
}

.logo-icon-s {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    overflow: hidden;
    flex-shrink: 0;
    position: relative;
}

.logo-text-s {
    font-size: 24px;
    font-weight: 700;
    color: var(--primary-black);
    letter-spacing: -0.8px;
    font-family: var(--font-rounded);
}

.icon-btn-round {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--bg-secondary);
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
}

.dashboard-content {
    width: 100%;
    max-width: 900px;
    padding: 116px 20px 80px;
    display: flex;
    flex-direction: column;
    gap: 28px;
    position: relative;
}

.dashboard-header-brand {
    display: flex;
    align-items: center;
    gap: 14px;
    background: rgba(255, 255, 255, 0.18);
    backdrop-filter: blur(1px);
    -webkit-backdrop-filter: blur(1px);
    border-radius: 14px;
    padding: 6px 14px 6px 6px;
}

.dashboard-brand-logo {
    flex-shrink: 0;
}

.dashboard-brand-title {
    font-family: var(--font-rounded);
    font-size: 26px;
    font-weight: 700;
    line-height: 1;
    letter-spacing: -0.8px;
    color: var(--primary-black);
}

.balance-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 8px 0 56px;
    font-family: var(--font-rounded);
}

.section-label-centered {
    color: #8E8E93;
    font-size: 13px;
    font-weight: 600;
    letter-spacing: -0.08px;
    margin-bottom: 4px;
}

.days-remaining {
    font-size: 80px;
    font-weight: 700;
    color: var(--primary-black);
    font-family: var(--font-rounded);
    line-height: 0.95;
    letter-spacing: -2px;
    margin-bottom: 4px;
}

.days-remaining .unit {
    font-size: 52px;
    font-weight: 700;
    letter-spacing: -1px;
}

.balance-text {
    font-size: 15px;
    color: #8E8E93;
    margin-bottom: 24px;
    font-weight: 500;
    letter-spacing: -0.24px;
}

.balance-text .amount {
    color: #8E8E93;
    font-weight: 500;
}

.dashboard-actions {
    display: flex;
    gap: 12px;
}

.mobile-break {
    display: none;
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    padding: 0 4px 12px;
}


.section-title {
    font-size: 14px;
    font-weight: 560;
    color: #8E8E93;
    letter-spacing: 0px;
}





/* h2 global reset — form-header h2 handles its own styles */
h2 {
    font-weight: inherit;
    color: inherit;
}

.status-online {
    font-size: 14px;
    font-weight: 560;
    color: #34C759;
}

.list-container {
    background: var(--bg-nav);
    border-radius: 20px;
    overflow: hidden;
    padding: 0;
    /* Changed from 4px 16px to allow edge-to-edge ripple */
}

.list-item {
    display: flex;
    align-items: center;
    padding: 4px 16px;
    /* Moved padding here from container */
    gap: 12px;
    height: 48px;
    cursor: pointer;
    transition: background 0.2s;
    position: relative;
    overflow: hidden;
}

.list-item:hover {
    background: rgba(0, 0, 0, 0.02);
}

.list-item:not(:last-child):not(.no-border) .item-content {
    border-bottom: 1px solid rgba(116, 116, 128, 0.08);
}

.item-icon-wrapper {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.item-icon-wrapper.blue-bg {
    background: rgba(0, 179, 240, 0.1);
}

.item-icon-wrapper.gray-icon {
    background: transparent;
}

.item-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding: 10px 0;
}

.item-title {
    font-size: 16px;
    font-weight: 590;
    color: var(--primary-black);
    letter-spacing: -0.41px;
}

.item-subtitle {
    font-size: 14px;
    color: #8E8E93;
    font-weight: 510;
    letter-spacing: -0.24px;
}

.list-footer-text {
    text-align: center;
    font-size: 14px;
    line-height: 18px;
    letter-spacing: -0.15px;
    color: #8E8E93;
    font-weight: 500;
    margin-top: 12px;
}

.referral-card {
    background: var(--bg-nav);
    border-radius: 20px;
    padding: 40px;
    display: flex;
    justify-content: flex-start;
    gap: 120px;
    align-items: center;
}

.referral-text {
    width: 394px;
    display: flex;
    flex-direction: column;
}

.ref-title {
    font-size: 20px;
    font-weight: 700;
    margin-bottom: 12px;
    color: var(--primary-black);
    line-height: 24px;
    letter-spacing: -0.45px;
}

.ref-desc {
    font-size: 15px;
    color: #8E8E93;
    line-height: 20px;
    margin-bottom: 24px;
    letter-spacing: -0.24px;
    font-weight: 400;
}

.ref-actions {
    display: flex;
    gap: 12px;
}

.btn-ref {
    height: 40px;
    border-radius: 99px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 10px 16px;
    border: none;
    cursor: pointer;
    font-family: var(--font-rounded);
    font-size: 15px;
    font-weight: 590;
    letter-spacing: -0.24px;
    transition: var(--transition-standard);
    position: relative;
    overflow: hidden;
}

.ref-btn-share {
    background: var(--primary-blue);
    color: #fff;
    width: 140px;
}

.ref-btn-copy {
    background: rgba(0, 179, 240, 0.1);
    color: var(--primary-blue);
    width: 157px;
}

.referral-emoji {
    font-size: 125px;
    flex-shrink: 0;
    line-height: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.ref-fist {
    display: inline-block;
}

.ref-fist-img {
    width: 1em;
    height: 1em;
    display: block;
    pointer-events: none;
    user-select: none;
    -webkit-user-drag: none;
}

@media (min-width: 1101px) {
    .referral-emoji {
        transform: translateX(-16px);
    }
}

@media (min-width: 1280px) and (max-width: 1470px) {
    .referral-emoji {
        font-size: 110px;
        transform: translateX(-12px);
    }
}

@media (min-width: 1471px) and (max-width: 1728px) {
    .referral-emoji {
        font-size: 130px;
        transform: translateX(-20px);
    }
}

@media (min-width: 769px) and (max-width: 1100px) {
    .referral-emoji {
        font-size: 96px;
    }
}

@media (max-width: 380px) {
    .referral-emoji {
        font-size: 52px;
    }
}

@media (max-width: 768px) {
    .dashboard-header {
        padding: 0 20px;
    }

    .dashboard-header-inner {
        height: 84px;
        padding: 16px 20px 0;
    }

    .dashboard-header-inner::before {
        width: 220px;
        height: 60px;
        top: 8px;
        filter: blur(12px);
    }

    .logo-small {
        gap: 12px;
    }

    .logo-icon-s {
        width: 30px;
        height: 30px;
        border-radius: 8px;
    }

    /* logo: video shown on all devices, image as fallback */

    .logo-text-s {
        font-size: 18px;
        letter-spacing: -0.5px;
    }

    .dashboard-header-brand {
        gap: 12px;
    }

    .dashboard-brand-title {
        font-size: 22px;
        letter-spacing: -0.5px;
    }

    .referral-card {
        flex-direction: column;
        padding: 24px;
        text-align: center;
    }

    .ref-desc {
        max-width: none;
    }

    .ref-actions {
        justify-content: center;
    }

}

/* Context Menu */
.header-action-wrapper {
    position: relative;
}

.context-menu {
    position: absolute;
    top: calc(100% + 12px);
    right: 0;
    width: 250px;
    background: #FFFFFF;
    border-radius: 20px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.12);
    display: none;
    flex-direction: column;
    z-index: 1000;
    overflow: hidden;
    animation: menuFade 0.2s ease-out;
    transform-origin: top right;
}

.context-menu.show {
    display: flex;
}

.menu-item {
    padding: 14px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 50px;
    cursor: pointer;
    transition: background 0.2s;
}

.menu-item:hover {
    background: rgba(0, 0, 0, 0.05);
}

.menu-icon {
    width: 20px;
    height: 20px;
}

.menu-label {
    font-size: 17px;
    font-weight: 590;
    color: var(--primary-black);
    flex: 1;
    letter-spacing: -0.41px;
}

.menu-item.logout .menu-label {
    color: #FF3B30;
}

.menu-divider {
    height: 1px;
    background: #74748014;
    margin: 0;
}

@keyframes menuFade {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: scale(0.98);
    }

    to {
        opacity: 1;
        transform: scale(1);
    }
}

/* Ripple Effect Styles */
.ripple {
    position: absolute;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.1);
    transform: scale(0);
    animation: ripple-animation 0.5s ease-out;
    pointer-events: none;
    z-index: 1;
}

@keyframes ripple-animation {
    to {
        transform: scale(4);
        opacity: 0;
    }
}

.container {
    width: 400px;
    max-width: 400px;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
}

.container.align-left {
    text-align: left;
    align-items: flex-start;
}

/* TOP NAV */
.top-nav {
    margin-bottom: 32px;
    width: 100%;
}

.back-btn {
    border: none;
    background: var(--bg-nav);
    height: 34px;
    padding: 8px 12px;
    border-radius: var(--radius-nav);
    color: #8E8E93;
    font-size: 17px;
    font-weight: 500;
    letter-spacing: -0.41px;
    display: flex;
    align-items: center;
    gap: 4px;
    cursor: pointer;
    transition: var(--transition-standard);
}

.back-btn:hover {
    background: rgba(116, 116, 128, 0.1);
}

.back-btn-round {
    background: none;
    border: none;
    padding: 8px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-left: -8px;
    /* Offset padding for perfect alignment */
    transition: var(--transition-standard);
}

.back-btn-round:hover {
    opacity: 0.7;
}

.back-btn-round img {
    width: 22px;
    height: 22px;
}


/* ── OTP / Code Verification Screen ───────────────────── */
.otp-header {
    margin-bottom: 28px;
}

.otp-title {
    font-family: var(--font-text);
    font-size: 20px;
    font-weight: 700;
    letter-spacing: -0.45px;
    line-height: 24px;
    color: var(--primary-black);
    margin-bottom: 12px;
}

.otp-subtitle-block {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.otp-hint-gray {
    font-size: 14px;
    font-weight: 510;
    color: #A1A5A8;
    letter-spacing: -0.15px;
    line-height: 18px;
}

.otp-hint-black {
    font-size: 14px;
    font-weight: 510;
    color: var(--primary-black);
    letter-spacing: -0.15px;
    line-height: 18px;
}

/* OTP digit boxes container */
.otp-field {
    display: flex;
    gap: 8px;
    position: relative;
    cursor: text;
}

/* Hidden real input */
.otp-field input#otp-input {
    position: absolute;
    opacity: 0;
    width: 1px;
    height: 1px;
    pointer-events: none;
}

/* Each digit box — SF Mono 28px as in Figma */
.otp-digit {
    width: 38px;
    height: 46px;
    border-radius: 12px;
    border: 1.5px solid var(--border-color);
    /* #c8c7cb default */
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: var(--font-mono);
    font-size: 28px;
    font-weight: 500;
    letter-spacing: 0.39px;
    color: var(--primary-black);
    transition: border-color 0.15s;
    background: transparent;
    user-select: none;
}

/* Active (cursor on it) */
.otp-digit.active {
    border-color: var(--primary-blue);
    background: #FFFFFF;
}

/* States set by JS */
.otp-digit.state-success {
    border-color: #34C759;
}

.otp-digit.state-error {
    border-color: #FF3B30;
}

/* Status lines below digits */
.otp-status {
    display: none;
    align-items: center;
    gap: 4px;
    margin-top: 8px;
    font-size: 14px;
    font-weight: 510;
    letter-spacing: -0.15px;
    line-height: 18px;
}

.otp-status.visible {
    display: flex;
}

.otp-success {
    color: #34C759;
}

.otp-error {
    color: #FF3B30;
}

/* ─────────────────────────────────────────────────────── */

/* FORM HEADERS */

.form-header {
    margin-bottom: 24px;
    width: 100%;
    padding: 0 4px;
    /* Matching Figma's 392px content area */
}

.form-header h2 {
    font-family: var(--font-text);
    font-size: 28px;
    font-weight: 700;
    color: var(--primary-black);
    margin-bottom: 12px;
    line-height: 34px;
    letter-spacing: 0.36px;
}


.subtitle {
    font-size: 17px;
    font-weight: 400;
    line-height: 22px;
    letter-spacing: -0.41px;
    color: #8E8E93;
    white-space: pre-line;
}

.form-header .subtitle {
    margin-bottom: 0px;
}

.inputs-stack {
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-bottom: 32px;
}

.inputs-stack+.error-text {
    margin-top: -20px;
    /* Adjusting gap when error is present */
    margin-bottom: 24px;
}

/* INPUTS */
.input-container {
    width: 100%;
    height: 46px;
    background: var(--bg-secondary);
    border-radius: var(--radius-btn);
    display: flex;
    align-items: center;
    padding: 0 16px;
    margin-top: 0;
    margin-bottom: 0;
    /* Removed fixed margin */
    transition: all 0.23s ease;
    border: 1px solid transparent;
}

/* Ensure single input containers still have the 32px margin if not in a stack */
#screen-email .input-container,
#screen-phone .input-container {
    margin-bottom: 32px;
}

.input-container.error {
    border: 1px solid #FF3B30;
    background: #ff3b301a;
}

.error-text {
    color: #FF3B30;
    font-size: 14px;
    font-weight: 510;
    margin-top: -16px;
    margin-bottom: 24px;
    width: 100%;
    display: none;
    padding-left: 4px;
    /* Aligned with header/inputs */
    letter-spacing: -0.15px;
}

.error-text.show {
    display: block;
}

.input-container.error input {
    color: #FF3B30;
}

.input-container input {
    flex: 1;
    border: none;
    background: transparent;
    outline: none;
    font-size: 17px;
    font-weight: 400;
    letter-spacing: -0.43px;
    font-family: inherit;
    color: var(--primary-black);
}

.input-container input::placeholder {
    color: var(--btn-inactive-text);
}

/* Promocode Specific Styles */
#promo-field {
    text-transform: uppercase;
}

#promo-field::placeholder {
    text-transform: none;
}

#promo-field.promo-error {
    color: #FF3B30;
}

.clear-btn {
    border: none;
    background: none;
    padding: 6px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition-standard);
    opacity: 0;
    pointer-events: none;
}

.clear-btn.show {
    opacity: 1;
    pointer-events: auto;
}

.clear-btn:hover {
    opacity: 0.7;
}

.clear-btn img {
    width: 20px;
    height: 20px;
}

.icon-right {
    border: none;
    background: none;
    padding: 4px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition-standard);
}

.icon-right:hover {
    opacity: 0.7;
}

.icon-right img {
    width: 24px;
    height: 24px;
}

/* BUTTONS */
.btn {
    height: 50px;
    width: 400px;
    border-radius: var(--radius-btn);
    border: none;
    font-size: 17px;
    font-weight: 600 !important;
    line-height: 22px;
    letter-spacing: -0.41px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: var(--transition-standard);
    text-decoration: none;
    position: relative;
    overflow: hidden;
    flex-shrink: 0;
}

.btn-telegram,
.btn-primary {
    background-color: var(--primary-blue) !important;
    color: #ffffff !important;
}

.btn-secondary {
    background-color: var(--bg-secondary) !important;
    color: #303030;
}

.btn-promo {
    background-color: rgba(0, 179, 240, 0.1) !important;
    color: var(--primary-blue) !important;
}

.dashboard-cta {
    width: 151px;
    height: 40px;
    font-size: 15px;
    font-weight: 590;
    letter-spacing: -0.24px;
}

.btn-inactive {
    background-color: var(--btn-inactive-bg);
    color: var(--btn-inactive-text);
    cursor: default;
    pointer-events: none;
}

.btn-icon {
    width: 24px;
    height: 24px;
    margin-right: 12px;
    object-fit: contain;
}

/* Shine Effect */
.btn-shine {
    position: relative;
    overflow: hidden;
}

.btn-shine::after {
    content: '';
    position: absolute;
    top: 0;
    left: -150%;
    width: 50%;
    height: 100%;
    background: linear-gradient(to right,
            rgba(255, 255, 255, 0) 0%,
            rgba(255, 255, 255, 0.4) 50%,
            rgba(255, 255, 255, 0) 100%);
    transform: skewX(-25deg);
    pointer-events: none;
}

.btn-shine:not(.btn-inactive):hover::after {
    animation: shine 0.75s cubic-bezier(0.19, 1, 0.22, 1);
}

@keyframes shine {
    0% {
        left: -150%;
        opacity: 0;
    }

    50% {
        opacity: 1;
    }

    100% {
        left: 150%;
        opacity: 0;
    }
}

#topup-submit {
    margin-top: 24px !important;
}

.action-area {
    margin-top: 32px;
    width: 100%;
    padding-top: 0;
}

/* WELCOME SPECIFIC */
#screen-welcome .container {
    height: 626px;
    display: flex;
    flex-direction: column;
}

#screen-welcome .welcome-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    margin-bottom: 32px;
}

#screen-welcome .logo-container {
    width: 120px;
    height: 120px;
    margin-bottom: 32px;
    margin-left: auto;
    margin-right: auto;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
}

.main-logo {
    width: 100%;
    height: 100%;
    object-fit: contain;
    display: block;
}


#screen-welcome h1 {
    font-family: var(--font-text);
    font-size: 28px;
    font-weight: 700;
    line-height: 34px;
    letter-spacing: 0.36px;
    margin-bottom: 16px;
    white-space: pre-line;
    color: var(--primary-black);
}

/* Welcome subtitle slightly smaller than body */
#screen-welcome .subtitle {
    font-size: 15px;
    line-height: 20px;
    letter-spacing: -0.24px;
    color: #8E8E93;
    font-weight: 400;
}

#screen-welcome .buttons-group {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

/* MODAL POPUP */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.3);
    /* iOS-like dimming */
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 2000;
    transition: var(--transition-standard);
}

.modal-overlay.no-transition,
.modal-overlay.no-transition .modal-container {
    transition: none !important;
    animation: none !important;
}

.modal-overlay.show {
    display: flex;
}

/* Smooth modal switching */
.modal-overlay.switching {
    transition: none !important;
}

.modal-container {
    background: #FFFFFF;
    width: 100%;
    max-width: 412px;
    border-radius: 32px;
    padding: 24px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.15);
    animation: modalSlide 0.3s ease-out;
    position: relative;
    overflow: visible;
    z-index: 10;
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.3s ease;
}

.modal-container.fade-out {
    opacity: 0 !important;
    transform: translateY(-8px) scale(0.98) !important;
    animation: none !important;
}

.modal-container.fade-in {
    opacity: 0 !important;
    transform: translateY(8px) scale(1.02) !important;
    animation: none !important;
}

@keyframes modalSlide {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.modal-divider-top,
.mobile-modal-nav {
    display: none;
}

.modal-divider-top {
    justify-content: center;
    padding: 0px 0 10px;
}


.modal-handle {
    width: 48px;
    height: 4px;
    background: rgba(116, 116, 128, 0.12);
    border-radius: 99px;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0;
}

.modal-content {
    padding: 0;
}

.modal-title {
    font-size: 20px;
    font-weight: 600 !important;
    color: var(--primary-black);
    letter-spacing: -0.45px;
    font-family: 'SF Pro', var(--font-text), sans-serif;
    margin-bottom: 0;
}

.modal-close {
    width: 32px;
    height: 32px;
    border-radius: 15px;
    background: var(--bg-nav);
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: var(--transition-standard);
}

.modal-close:hover {
    background: rgba(116, 116, 128, 0.15);
}

.modal-divider {
    height: 1px;
    background: rgba(116, 116, 128, 0.08);
    margin-bottom: 16px;
}

.key-field {
    background: #f8f8f9;
    padding: 11px 16px;
    border-radius: 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 24px;
}

.key-text {
    font-size: 15px;
    color: var(--primary-black);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    font-weight: 400;
    letter-spacing: -0.24px;
    opacity: 0.6;
}

.key-qr-panel {
    background: #f8f8f9;
    border-radius: 24px;
    padding: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 24px;
}

.key-qr-panel.is-empty {
    display: none;
}

.key-qr-code {
    width: 208px;
    height: 208px;
    max-width: 100%;
    background: #ffffff;
    border-radius: 20px;
    padding: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.key-qr-code img,
.key-qr-code canvas {
    display: block;
    width: auto !important;
    height: auto !important;
    max-width: 100%;
    max-height: 100%;
    border-radius: 0;
}

.modal-actions {
    display: flex;
    gap: 12px;
    position: relative;
    margin-top: 24px;
}

.modal-action-btn {
    flex: 1;
    height: 50px;
    border-radius: 99px;
    font-size: 17px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.btn-dots {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: rgba(0, 179, 240, 0.1);
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 3px;
    cursor: pointer;
    transition: var(--transition-standard);
}

.btn-dots.active {
    background: rgba(0, 179, 240, 0.25);
}

.modal-menu {
    position: absolute;
    top: calc(100% - 14px);
    /* starts 14px before modal bottom → hangs below */
    right: 24px;
    width: 308px;
    background: #FFFFFF;
    border-radius: 24px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.15);
    display: none;
    flex-direction: column;
    z-index: 3000;
    overflow: hidden;
    padding: 20px;
    gap: 0;
    animation: menuFade 0.2s ease-out;
    transform-origin: top right;
}

.modal-menu.show {
    display: flex;
}

.modal-menu .menu-item {
    padding: 8px;
    border-radius: 10px;
    height: 36px;
}

.modal-menu .menu-label {
    font-size: 17px;
    font-weight: 590;
    letter-spacing: -0.41px;
}

.dot {
    width: 4px;
    height: 4px;
    border-radius: 50%;
    background: var(--primary-blue);
}

/* Replenish Balance Modal — Figma: 564px wide */
#modal-topup .modal-container,
.topup-container {
    max-width: 564px;
    padding: 24px;
    overflow: hidden;
}

.topup-title {
    font-family: var(--font-text);
    font-size: 20px;
    font-weight: 590;
    letter-spacing: -0.45px;
    line-height: 24px;
    color: var(--primary-black);
}

.topup-section {
    margin-top: 24px;
}

.topup-error-text {
    color: #FF3B30;
    font-size: 14px;
    font-weight: 510;
    letter-spacing: -0.15px;
    line-height: 18px;
    padding-left: 4px;
    margin-top: 4px;
    margin-bottom: 8px;
    display: none;
}

.topup-error-text.show {
    display: block;
}

.section-label {
    display: block;
    font-family: var(--font-rounded);
    font-size: 14px;
    font-weight: 600;
    letter-spacing: 0.49px;
    color: #8E8E93;
    margin-bottom: 8px;
    padding-left: 0;
}

.sum-display-container {
    display: flex;
    align-items: baseline;
    justify-content: center;
    margin: 12px 0 4px;
}

.sum-value {
    font-size: 40px;
    font-weight: 690;
    color: #b9b9ba;
    letter-spacing: 0.36px;
    font-family: var(--font-rounded);
    transition: color 0.2s;
    outline: none;
    display: inline-block;
    min-width: 20px;
    cursor: text;
}

.sum-value.has-value {
    color: var(--primary-black);
}

.sum-value.error,
.sum-value.error+.sum-currency {
    color: #FF3B30 !important;
}

.sum-currency {
    font-size: 28px;
    font-weight: 690;
    letter-spacing: 0.36px;
    font-family: var(--font-rounded);
    color: #8E8E93;
    margin-left: 4px;
}

.sum-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
    margin-top: 16px;
}

.sum-btn {
    height: 32px;
    border-radius: 30px;
    border: none;
    background: rgba(116, 116, 128, 0.08);
    font-family: var(--font-rounded);
    font-size: 15px;
    font-weight: 600;
    letter-spacing: 0.44px;
    color: var(--primary-black);
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.1, 0, 0.1, 1);
}

.sum-btn.active {
    background: rgba(0, 179, 240, 0.12);
    color: #00B3F0;
}

/* Payment Methods List Container */
.payment-methods-container {
    background: rgba(116, 116, 128, 0.05);
    border-radius: 20px;
    padding: 0 16px;
}

.payment-item {
    display: flex;
    align-items: center;
    padding: 14px 0;
    cursor: pointer;
}

.payment-item:not(:last-child) {
    border-bottom: 0.5px solid rgba(116, 116, 128, 0.1);
}

.payment-icon-wrapper {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #FFFFFF;
    border-radius: 10px;
    margin-right: 12px;
}

.payment-label {
    flex: 1;
    font-size: 17px;
    font-weight: 600;
    color: var(--primary-black);
    letter-spacing: -0.2px;
}

.payment-check {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    border: 1.5px solid rgba(116, 116, 128, 0.2);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.payment-check.active {
    background: #00B3F0;
    border-color: #00B3F0;
}

.topup-pay-btn {
    width: 100%;
    height: 50px;
    margin-top: 24px;
    background: #00B3F0;
    color: #FFFFFF;
    font-size: 17px;
    font-weight: 590;
    letter-spacing: -0.41px;
    border-radius: 99px;
    border: none;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(0, 179, 240, 0.25);
    transition: all 0.2s;
}

.topup-pay-btn.disabled {
    background: var(--btn-inactive-bg);
    color: var(--btn-inactive-text);
    box-shadow: none;
    cursor: default;
    pointer-events: none;
}

.topup-pay-btn:active {
    transform: scale(0.98);
}



/* Notification (Toast) */
.notification-container {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 3000;
    display: flex;
    flex-direction: column-reverse;
    align-items: flex-end;
    gap: 8px;
    pointer-events: none;
}

@media (max-width: 480px) {
    .notification-container {
        right: 0;
        left: 0;
        align-items: center;
        padding-bottom: env(safe-area-inset-bottom, 0);
    }
}

.notification {
    background: #34C759;
    color: #FFFFFF;
    border-radius: 12px;
    padding: 8px 18px 8px 12px;
    display: flex;
    align-items: center;
    gap: 10px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
    width: max-content;
    height: 40px;
    transition: all 0.3s ease;
    animation: toastSlideIn 0.4s cubic-bezier(0.18, 0.89, 0.32, 1.28) forwards;
    pointer-events: auto;
}

@keyframes toastSlideIn {
    0% {
        opacity: 0;
        transform: translateX(100%) scale(0.9);
    }

    70% {
        transform: translateX(-10px) scale(1.02);
    }

    100% {
        opacity: 1;
        transform: translateX(0) scale(1);
    }
}

@keyframes toastSlideOut {
    0% {
        opacity: 1;
        transform: translateX(0) scale(1);
    }

    100% {
        opacity: 0;
        transform: translateX(100%) scale(0.9);
    }
}

@keyframes toastShake {

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

    20%,
    60% {
        transform: translateX(-4px);
    }

    40%,
    80% {
        transform: translateX(4px);
    }
}

.notification.fade-out {
    animation: toastSlideOut 0.3s cubic-bezier(0.4, 0, 1, 1) forwards;
}

@keyframes toastErrorInertia {
    0% {
        opacity: 0;
        transform: translateX(100%) scale(0.9);
    }

    40% {
        opacity: 1;
        transform: translateX(-25px) scale(1.05);
        /* Резкий пролет вперед */
    }

    55% {
        transform: translateX(15px);
        /* Отскок назад */
    }

    70% {
        transform: translateX(-10px);
        /* Тряска от инерции */
    }

    85% {
        transform: translateX(4px);
    }

    100% {
        opacity: 1;
        transform: translateX(0) scale(1);
    }
}

.notification.error {
    background: #FF3B30;
    animation: toastErrorInertia 0.6s cubic-bezier(0.23, 1, 0.32, 1) forwards;
}

.notification-icon {
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.notification-icon img {
    width: 20px;
    height: 20px;
}

.notification-text {
    font-size: 16px;
    font-weight: 510;
    letter-spacing: -0.31px;
    white-space: nowrap;
    line-height: 22px;
}

/* OTP Verification Screen */
.otp-header {
    margin-bottom: 24px;
}

.otp-title {
    font-size: 28px;
    font-weight: 700;
    margin-bottom: 8px;
    letter-spacing: 0.38px;
}

.otp-subtitle-block {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    font-size: 15px;
    line-height: 20px;
}

.otp-hint-gray {
    color: #8E8E93;
}

.otp-hint-black {
    color: var(--primary-black);
    font-weight: 510;
}

.otp-field {
    display: flex;
    justify-content: space-between;
    gap: 8px;
    margin: 0 0 8px;
    position: relative;
    cursor: text;
}


.otp-digit {
    width: 38px;
    height: 46px;
    background: rgba(255, 255, 255, 0.08);
    /* var(--bg-secondary) */
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    font-weight: 600;
    color: var(--primary-black);
    border: 1.5px solid var(--border-color);
    transition: all 0.2s cubic-bezier(0.1, 0, 0.1, 1);
}

.otp-digit.active {
    border-color: var(--primary-blue);
    background: #FFFFFF;
    box-shadow: 0 4px 12px rgba(0, 179, 240, 0.1);
}

.otp-digit.state-success {
    border-color: #34C759;
    color: #34C759;
}

.otp-digit.state-error {
    border-color: #FF3B30;
    color: #FF3B30;
}

#otp-input {
    position: absolute;
    opacity: 0;
    pointer-events: none;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
}

.otp-status {
    display: none;
    align-items: center;
    justify-content: center;
    gap: 6px;
    font-size: 15px;
    font-weight: 510;
    margin-top: 16px;
    margin-bottom: 20px;
    animation: fadeIn 0.3s ease;
}

.otp-status.visible {
    display: flex;
}

.otp-success {
    color: #34C759;
}

.otp-error {
    color: #FF3B30;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(-5px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

#modal-select-device .modal-container {
    height: 476px;
    display: flex;
    flex-direction: column;
}

#modal-select-device .modal-content {
    flex: 1;
    overflow: hidden;
    /* Fits perfectly, no scroll needed */
    padding-top: 0 !important;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

/* Stage 1: Platform Selection */
.select-device-list {
    background: #F2F2F7;
    border-radius: 20px;
    padding: 0 16px;
    display: flex;
    flex-direction: column;
    margin-bottom: 12px;
}

.device-option {
    display: flex;
    align-items: center;
    height: 48px;
    /* Fixed height from Figma 104:9366 */
    padding: 0;
    cursor: pointer;
    transition: background 0.2s ease;
}

.device-option:hover {
    background: rgba(116, 116, 128, 0.04);
}

.device-option .option-icon-wrap {
    width: 44px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: flex-start;
    padding-left: 0;
    margin-right: 0;
    flex-shrink: 0;
}

.device-option .option-icon-wrap img {
    width: 20px;
    height: 20px;
}

.device-option .option-label {
    flex: 1;
    height: 100%;
    display: flex;
    align-items: center;
    font-size: 16px;
    font-weight: 590;
    color: var(--primary-black);
    font-family: var(--font-display);
    border-bottom: 1.5px solid #74748014;
}

.device-option:last-child .option-label {
    border-bottom: none;
}

.device-option .option-check {
    width: 22px;
    height: 22px;
    border-radius: 50%;
    border: 1.5px solid #E5E5EA;
    /* Standard iOS border color */
    margin-left: 12px;
    position: relative;
    transition: all 0.2s;
    flex-shrink: 0;
}

/* Selected state - icon blue, text black, checkbox blue check */
.device-option.selected .option-icon-wrap img {
    filter: invert(58%) sepia(93%) saturate(2206%) hue-rotate(164deg) brightness(97%) contrast(101%);
}

.device-option.selected .option-check {
    background: var(--primary-blue);
    border-color: var(--primary-blue);
}

.device-option.selected .option-check::after {
    content: '';
    position: absolute;
    left: 7px;
    top: 3px;
    width: 4px;
    height: 9px;
    border: solid white;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
}

/* Stage 2 & 3: Headers and Subtitles */
.modal-subtitle {
    color: #747480;
    font-size: 15px;
    font-weight: 510;
    line-height: 1.33;
    margin-bottom: 24px;
    text-align: left;
    letter-spacing: -0.24px;
}

.input-container.label-top {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    padding-top: 0;
    height: auto;
    border: none;
    background: transparent;
}

.input-container.label-top .input-label {
    font-size: 13px;
    font-weight: 510;
    color: #8E8E93;
    margin-bottom: 6px;
    margin-left: 16px;
}

.input-container.label-top input {
    height: 56px;
    width: 100%;
    background: #F2F2F7;
    border-radius: 14px;
    border: none;
    padding: 0 20px;
    font-size: 17px;
    color: var(--primary-black);
}

/* Stage 3: Key display */
.key-box-container {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.key-box-label {
    font-size: 13px;
    font-weight: 510;
    color: #8E8E93;
    margin-left: 16px;
}

.key-box {
    background: #7474800d;
    height: 52px;
    border-radius: 14px;
    display: flex;
    align-items: center;
    padding: 0 16px;
    gap: 12px;
}

.key-box-text {
    flex: 1;
    font-size: 15px;
    color: var(--primary-black);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    opacity: 0.6;
}

.key-copy-btn {
    background: none;
    border: none;
    padding: 8px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* App Store / Google Play Buttons - generic mockups */
.store-btn {
    flex: 1;
    height: 48px;
    background: #000000;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    border: none;
}

.store-btn img {
    height: 24px;
}

.setup-instruction-link a:hover {
    text-decoration: underline;
}

/* ═══════════════════════════════════════════════════════
   MOBILE ADAPTIVE — max-width: 480px
   ═══════════════════════════════════════════════════════ */
@media (max-width: 480px) {

    /* ── Global container ── */
    .container {
        width: 100%;
        max-width: 100%;
        padding: 0 40px;
    }

    /* ── Buttons — full width ── */
    .btn {
        width: 100%;
    }

    /* ── SCREEN WELCOME ── */
    #screen-welcome .container {
        height: auto;
        padding: 0 40px;
        justify-content: center;
    }

    #screen-welcome .welcome-content {
        margin-bottom: 32px;
    }

    #screen-welcome .logo-container {
        width: 120px;
        height: 120px;
        margin-bottom: 32px;
    }

    #screen-welcome h1 {
        font-size: 28px;
        line-height: 34px;
        letter-spacing: 0.38px;
    }

    #screen-welcome .subtitle {
        font-size: 14px;
        line-height: 18px;
        letter-spacing: -0.15px;
        font-weight: 510;
    }

    /* Gift banner — full width */
    .gift-banner {
        width: 100%;
    }

    /* Buttons group */
    #screen-welcome .buttons-group {
        width: 100%;
        gap: 16px;
    }

    #screen-welcome .buttons-group .btn {
        width: 100%;
        height: 50px;
    }

    /* ── AUTH FORM SCREENS (email, phone, password, OTP) ── */

    /* Screen itself — start from top, stretch container to full width */
    .screen:has(.container.align-left) {
        justify-content: flex-start;
        align-items: stretch;
    }

    /* Container — full width, full height, padding 20px all sides */
    .container.align-left {
        width: 100%;
        max-width: 100%;
        min-height: 100%;
        padding: 20px;
        align-items: flex-start;
    }

    .form-header h2 {
        font-size: 20px;
        line-height: 24px;
        letter-spacing: -0.45px;
    }

    .form-header .subtitle {
        font-size: 14px;
        line-height: 18px;
        letter-spacing: -0.15px;
        font-weight: 510;
        color: #a1a5a8;
    }

    /* Back button — icon-only, 32x32, matching Figma */
    .back-btn {
        width: 32px;
        height: 32px;
        padding: 8px;
        border-radius: 15px;
        background: var(--bg-nav);
        font-size: 0;
        letter-spacing: 0;
        gap: 0;
        flex-shrink: 0;
    }

    .back-btn span,
    .back-btn svg+* {
        display: none;
    }

    /* top-nav — reduce bottom gap on mobile */
    .top-nav {
        margin-bottom: 32px;
    }

    /* Кнопка «Продолжить» — сразу после инпута */
    .action-area {
        margin-top: 230px;
    }

    .action-area .btn {
        width: 100%;
    }

    .input-container {
        width: 100%;
        margin-bottom: 0;
    }

    .error-text {
        margin-top: 8px;
        margin-bottom: -8px;
        /* Offset some of the 230px margin when error is present */
        padding-left: 16px;
    }

    /* ── OTP SCREEN ── */
    #screen-otp .otp-header {
        margin-bottom: 24px;
        padding: 0 4px;
    }

    #screen-otp .otp-subtitle-block {
        display: flex;
        flex-direction: column;
        gap: 4px;
    }

    #screen-otp .otp-field {
        justify-content: flex-start;
        gap: 8px;
        margin-top: 0 !important;
        margin-bottom: 32px !important;
    }

    #screen-otp .otp-digit {
        width: 38px;
        height: 46px;
        font-size: 28px;
        line-height: 34px;
        border-radius: 12px;
        background: transparent;
        border: 1px solid #c8c7cb;
    }

    #screen-otp .otp-digit.active {
        border-color: var(--primary-blue);
        background: transparent;
        box-shadow: none;
    }

    #screen-otp .otp-digit.state-success {
        border-color: #34c759;
    }

    #screen-otp .otp-digit.state-error {
        border-color: #ff3b30;
    }

    #screen-otp .action-area {
        margin-top: 230px;
    }

    /* ── NOTIFICATIONS ── */
    .notification-container {
        position: fixed;
        /* Keep it fixed so it slides from top viewport regardless of scroll */
        display: flex !important;
        left: 0;
        right: 0;
        top: 0;
        bottom: auto;
        width: 100%;
        padding: 0 15.5px;
        justify-content: center;
        align-items: center;
        transform: translateY(-150%);
        /* Hides it above top edge completely */
    }

    .notification-container.show {
        transform: translateY(62px);
        /* Slides it down exactly to y: 62 */
    }

    .notification {
        width: 100%;
        max-width: 100%;
        justify-content: flex-start;
    }

    /* ── DASHBOARD ── */
    .dashboard-header {
        padding: 0 20px !important;
        top: 0;
        z-index: 40;
    }

    .dashboard-header-inner {
        height: 84px;
        padding: 16px 20px 0;
    }

    .header-action-wrapper {
        position: relative;
        right: auto;
    }

    .dashboard-content {
        padding: 102px 20px 48px;
        gap: 24px;
    }

    .dashboard-actions {
        width: auto;
        justify-content: center;
        gap: 12px;
    }

    .dashboard-cta {
        width: 148px;
        /* average for 150 and 146 */
        flex: none;
    }

    .section-title {
        font-size: 14px;
        font-weight: 560;
    }





    .status-online {
        font-size: 14px;
    }

    .section-header {
        padding: 0 4px 12px;
    }


    .list-item {
        padding: 10px 16px;
    }

    .mobile-break {
        display: block;
    }

    .referral-card {
        flex-direction: column;
        padding: 32px 20px 20px;
        align-items: center;
        text-align: center;
        width: 100%;
        box-sizing: border-box;
        gap: 0;
    }


    .referral-emoji {
        order: -1;
        margin: 0 0 32px 0;
        font-size: 64px;
    }

    .referral-text {
        align-items: center;
        text-align: center;
        width: 100%;
        max-width: 100%;
    }

    .ref-title {
        font-size: 20px;
        line-height: 24px;
        text-align: center;
        margin-bottom: 12px;
        width: 100%;
        word-wrap: break-word;
    }

    .ref-desc {
        text-align: center;
        margin-bottom: 24px;
        width: 100%;
    }

    .ref-actions {
        width: 100%;
        gap: 10px;
        justify-content: space-between;
    }

    .btn-ref {
        width: 150.5px;
        flex: none;
        height: 54px;
        flex-direction: column;
        justify-content: center;
        gap: 2px;
        padding: 8px;
        border-radius: 12px;
    }

    .btn-ref span {
        font-size: 11px;
        line-height: 13px;
        font-weight: 590;
    }

    .btn-ref img {
        margin: 0 !important;
        width: 24px !important;
        height: 24px !important;
    }

    /* ── MODALS (Bottom Sheet mode) ── */
    .modal-overlay {
        align-items: flex-end;
    }

    .modal-container {
        width: 100% !important;
        max-width: calc(100% - 32px) !important;
        border-radius: 32px !important;
        margin: 0 16px calc(16px + env(safe-area-inset-bottom, 0px)) !important;
        padding: 0 !important;
        /* We use internal paddings for precision */
        background: #fff !important;
        max-height: calc(100dvh - 32px);
        box-shadow: 0px -10px 40px rgba(0, 0, 0, 0.05) !important;
        overflow: visible;
        /* Changed from hidden to show menu */
        display: flex;
        flex-direction: column;
        animation: bottomSheetSlide 0.3s cubic-bezier(0.4, 0, 0.2, 1) forwards;
    }

    .modal-divider-top {
        display: flex !important;
        justify-content: center;
        padding: 8px 0 !important;
    }

    .modal-handle {
        width: 48px !important;
        height: 4px !important;
        background: rgba(116, 116, 128, 0.12) !important;
        border-radius: 99px;
    }

    .modal-header {
        padding: 12px 24px 16px !important;
        display: flex;
        justify-content: space-between;
        align-items: center;
        margin-bottom: 0 !important;
    }

    .modal-title {
        font-size: 20px !important;
        font-weight: 590 !important;
        letter-spacing: -0.45px !important;
        color: var(--primary-black);
        line-height: 24px;
    }

    .modal-close {
        width: 32px !important;
        height: 32px !important;
        border-radius: 16px !important;
        background: rgba(116, 116, 128, 0.08) !important;
        display: flex !important;
        align-items: center;
        justify-content: center;
        padding: 0 !important;
        border: none;
        box-shadow: none !important;
    }

    .modal-close svg path {
        stroke: #8E8E93;
        stroke-width: 2.5;
    }

    .modal-divider {
        height: 1px;
        background: rgba(116, 116, 128, 0.08);
        margin: 0 24px !important;
        display: block !important;
    }

    .modal-content {
        padding: 16px 24px 26px !important;
    }

    .key-qr-panel {
        padding: 16px;
        margin-bottom: 20px;
    }

    .key-qr-code {
        width: 184px;
        height: 184px;
        padding: 14px;
    }

    @keyframes bottomSheetSlide {
        from {
            opacity: 0;
            transform: translateY(100%);
        }

        to {
            opacity: 1;
            transform: translateY(0);
        }
    }

    /* Override normal fade animations on mobile */
    .modal-container.fade-out {
        transform: translateY(100%) !important;
        opacity: 0 !important;
        transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.3s;
    }

    .modal-container.fade-in {
        transform: translateY(100%) !important;
    }

    /* ── CONTEXT MENU MOBILE FIX ── */
    .btn-dots {
        position: static;
        width: 50px;
        height: 50px;
    }

    .modal-menu {
        width: 250px;
        border-radius: 20px;
        padding: 0;
        right: 16px;
        overflow: hidden;
        top: auto;
        bottom: 90px;
        /* Offset from bottom to be above the buttons */
        transform-origin: bottom right;
    }

    .modal-menu .menu-item {
        height: 50px;
        padding: 14px 20px;
        border-radius: 0;
    }

    .modal-menu .menu-label {
        font-size: 17px;
        font-weight: 510;
        letter-spacing: -0.43px;
    }

    .modal-menu .menu-icon {
        width: 20px;
        height: 20px;
    }

    .menu-divider {
        margin: 0;
        height: 1px;
    }

    .sum-btn {
        height: 36px;
        font-size: 14px;
    }

    /* ── FULL SCREEN TOPUP MOBILE ── */
    #modal-topup .modal-container {
        position: fixed;
        inset: 0;
        width: 100% !important;
        max-width: 100% !important;
        height: 100dvh !important;
        max-height: 100dvh !important;
        border-radius: 0 !important;
        margin: 0 !important;
        background: #fff !important;
        box-shadow: none !important;
        animation: slideUpFull 0.35s cubic-bezier(0.32, 0.72, 0, 1);
    }

    #modal-topup .mobile-modal-nav {
        display: flex;
        align-items: center;
        justify-content: space-between;
        padding: 8px 16px;
        height: 46px;
        background: #fff;
        border-bottom: 0.5px solid rgba(116, 116, 128, 0.1);
    }

    #modal-topup .modal-header.desktop-only,
    #modal-topup .modal-divider-top {
        display: none !important;
    }

    .nav-title-group {
        display: flex;
        align-items: center;
        gap: 8px;
    }

    .nav-logo {
        width: 24px;
        height: 24px;
        border-radius: 6px;
    }

    .nav-title-text {
        font-size: 17px;
        font-weight: 590;
        letter-spacing: -0.43px;
    }

    .nav-back-btn,
    .nav-more-btn {
        background: rgba(116, 116, 128, 0.05);
        border: none;
        padding: 8px;
        border-radius: 12px;
        display: flex;
        align-items: center;
        justify-content: center;
    }

    #modal-topup .modal-content {
        flex: 1;
        padding: 32px 20px !important;
    }

    #modal-topup .topup-pay-btn {
        margin-top: auto;
        margin-bottom: calc(20px + env(safe-area-inset-bottom, 20px)) !important;
    }

    @keyframes slideUpFull {
        from {
            transform: translateY(100%);
        }

        to {
            transform: translateY(0);
        }
    }

    /* ── SELECT DEVICE MODAL MOBILE ── */
    #modal-select-device .modal-container {
        height: auto !important;
        max-height: 90dvh !important;
    }

    #modal-select-device .modal-content {
        flex: 1;
        padding: 16px 24px 16px !important;
        display: flex;
        flex-direction: column;
    }

    .select-device-list {
        background: rgba(116, 116, 128, 0.05);
        border-radius: 20px;
        padding: 4px 0;
        margin-bottom: 16px;
        overflow: hidden;
    }

    .device-option {
        height: 48px;
        display: flex;
        align-items: center;
        border-bottom: 0.5px solid rgba(116, 116, 128, 0.08);
    }

    .device-option:last-child {
        border-bottom: none;
    }

    .option-icon-wrap {
        width: 52px;
        display: flex;
        align-items: center;
        padding-left: 20px;
        box-sizing: border-box;
    }

    .option-icon-wrap img {
        width: 20px;
        height: 20px;
    }

    .option-label {
        font-size: 16px;
        font-weight: 590;
        letter-spacing: -0.31px;
    }

    .option-check {
        margin-left: auto;
        margin-right: 16px;
    }

    #select-device-btn {
        margin-top: auto;
        height: 50px;
        width: 100% !important;
        font-weight: 590;
        border-radius: 99px;
    }

    /* ── FORM ELEMENTS IN MODALS ── */
    .input-container-rounded {
        height: 48px !important;
        margin-bottom: 24px !important;
    }

    .sum-display-container {
        margin-top: 24px;
        margin-bottom: 32px;
    }

    .sum-value {
        font-size: 40px !important;
    }

    .sum-currency {
        font-size: 32px !important;
    }

    /* ── GIFTS & OTHERS ── */
    #modal-welcome-gift .modal-container,
    #modal-autorenew .modal-container {
        height: auto !important;
    }
}

/* ── AUTO-RENEW TOGGLE ── */
.autorenew-toggle {
    position: relative;
    width: 51px;
    height: 31px;
    border-radius: 99px;
    background: #E5E5EA;
    border: none;
    cursor: pointer;
    transition: background 0.2s;
    flex-shrink: 0;
    padding: 0;
}
.autorenew-toggle.active { background: #34C759; }
.toggle-thumb {
    position: absolute;
    top: 2px;
    left: 2px;
    width: 27px;
    height: 27px;
    border-radius: 50%;
    background: #fff;
    box-shadow: 0 1px 4px rgba(0,0,0,0.18);
    transition: transform 0.2s;
}
.autorenew-toggle.active .toggle-thumb { transform: translateX(20px); }

/* ── PERIOD BUTTONS ── */
.period-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    line-height: 1.4;
    padding: 10px 6px;
}

/* ── LEGAL MODAL ── */
.legal-modal-container {
    height: 85vh;
    display: flex;
    flex-direction: column;
    padding: 0;
}

.legal-tabs-header {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 12px 20px 0;
}

.legal-tab {
    background: none;
    border: none;
    font-family: var(--font-text);
    font-size: 15px;
    font-weight: 500;
    color: #8E8E93;
    padding: 8px 12px;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
    letter-spacing: -0.24px;
}

.legal-tab.active {
    color: var(--primary-black);
    font-weight: 600;
    background: rgba(116, 116, 128, 0.1);
}

.legal-content {
    flex: 1;
    overflow-y: auto;
    padding: 20px 20px 32px;
    -webkit-overflow-scrolling: touch;
    user-select: text;
    -webkit-user-select: text;
}

.legal-content h3 {
    font-size: 20px;
    font-weight: 700;
    color: var(--primary-black);
    letter-spacing: -0.4px;
    margin-bottom: 4px;
}

.legal-content .legal-date {
    font-size: 13px;
    color: #8E8E93;
    margin-bottom: 20px;
}

.legal-content h4 {
    font-size: 15px;
    font-weight: 600;
    color: var(--primary-black);
    letter-spacing: -0.24px;
    margin: 18px 0 6px;
}

.legal-content p {
    font-size: 14px;
    font-weight: 400;
    color: #3C3C43;
    line-height: 1.6;
    letter-spacing: -0.1px;
}

.legal-content ul {
    margin: 6px 0 0 16px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.legal-content ul li {
    font-size: 14px;
    color: #3C3C43;
    line-height: 1.6;
    letter-spacing: -0.1px;
}

/* Guide modal */
.guide-steps {
    margin: 0;
    padding: 0 0 0 22px;
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.guide-steps li {
    font-size: 15px;
    line-height: 1.5;
    color: var(--primary-black);
    letter-spacing: -0.2px;
}

.guide-download-links {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 10px;
    margin-left: -22px;
}

.guide-download-btn {
    display: inline-flex;
    align-items: center;
    padding: 7px 14px;
    background: rgba(0, 179, 240, 0.1);
    color: #00B3F0;
    border-radius: 10px;
    font-size: 13px;
    font-weight: 600;
    text-decoration: none;
    letter-spacing: -0.1px;
    transition: background 0.18s;
}

.guide-download-btn:active {
    background: rgba(0, 179, 240, 0.2);
}
