:root {
    --bg: #050507;
    --surface: rgba(18, 15, 26, 0.84);
    --surface-strong: rgba(24, 20, 34, 0.94);
    --border: rgba(183, 158, 255, 0.22);
    --primary: #f1c86b;
    --accent: #b984ff;
    --accent-strong: #7b39ef;
    --accent-soft: rgba(185, 132, 255, 0.18);
    --danger: #ff5f71;
    --text-main: #ffffff;
    --text-soft: rgba(255, 255, 255, 0.78);
    --text-dim: rgba(255, 255, 255, 0.58);
    --button-gradient: linear-gradient(90deg, #7134ea, #c796ff);
    --hero-shadow: 0 30px 80px rgba(0, 0, 0, 0.42);
}

* {
    box-sizing: border-box;
}

html,
body {
    margin: 0;
    padding: 0;
    min-height: 100%;
    background:
        radial-gradient(circle at top center, rgba(181, 126, 255, 0.18), transparent 24%),
        radial-gradient(circle at 20% 82%, rgba(255, 102, 146, 0.12), transparent 28%),
        linear-gradient(180deg, #040406 0%, #09070f 48%, #040406 100%);
    color: var(--text-main);
    font-family: "Trebuchet MS", "Segoe UI", sans-serif;
    overflow-x: hidden;
}

body {
    position: relative;
}

body.rtl-layout {
    direction: rtl;
}

button,
input {
    font: inherit;
}

button {
    border: none;
    cursor: pointer;
}

.screen-loading,
.loading-overlay,
.modal-overlay {
    position: fixed;
    inset: 0;
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.screen-loading {
    display: flex;
    flex-direction: column;
    gap: 18px;
    background: #050507;
}

.loading-overlay,
.modal-overlay {
    padding: 20px;
    background: rgba(2, 2, 6, 0.82);
    backdrop-filter: blur(10px);
}

.loader-ring,
.loading-ring {
    border-radius: 999px;
    animation: spin 0.9s linear infinite;
}

.loader-ring {
    width: 58px;
    height: 58px;
    border: 3px solid rgba(185, 132, 255, 0.15);
    border-top-color: var(--primary);
}

.loading-card {
    width: min(100%, 320px);
    padding: 28px 20px;
    border: 1px solid var(--border);
    border-radius: 24px;
    background: var(--surface-strong);
    text-align: center;
    box-shadow: var(--hero-shadow);
}

.loading-ring {
    width: 46px;
    height: 46px;
    margin: 0 auto 14px;
    border: 3px solid rgba(185, 132, 255, 0.15);
    border-top-color: var(--primary);
}

.loading-text {
    color: var(--text-soft);
    font-size: 15px;
    letter-spacing: 1.4px;
    text-transform: uppercase;
}

.custom-toast {
    position: fixed;
    top: 20px;
    left: 50%;
    z-index: 1100;
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 260px;
    max-width: calc(100vw - 28px);
    padding: 14px 18px;
    border-radius: 999px;
    background: rgba(255, 88, 88, 0.94);
    color: #fff;
    box-shadow: 0 18px 40px rgba(0, 0, 0, 0.36);
    transform: translateX(-50%) translateY(-120px);
    transition: transform 0.32s ease;
}

.custom-toast.show {
    transform: translateX(-50%) translateY(0);
}

#star-canvas {
    position: fixed;
    inset: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 1;
}

.page-stage {
    position: relative;
    z-index: 2;
    width: min(100%, 540px);
    margin: 0 auto;
    padding: 14px 14px 120px;
}

.header-logo {
    position: absolute;
    top: 14px;
    left: 14px;
    z-index: 6;
}

.header-logo img {
    width: 34px;
    height: 34px;
    filter: drop-shadow(0 8px 18px rgba(0, 0, 0, 0.34));
}

.hero-swiper-shell {
    position: relative;
    padding-top: 8px;
}

.hero-swiper {
    width: 100%;
    height: min(48vh, 390px);
    overflow: visible;
}

.hero-swiper .swiper-wrapper {
    align-items: center;
}

.hero-swiper .swiper-slide {
    width: calc(100% - 52px);
    height: min(48vh, 390px);
    border-radius: 26px;
    overflow: hidden;
    box-shadow: var(--hero-shadow);
    transition: transform 0.5s ease, opacity 0.5s ease;
}

.hero-swiper .swiper-slide img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.hero-swiper .swiper-slide:not(.swiper-slide-active) {
    transform: scale(0.94);
    opacity: 0.72;
}

.main-container {
    margin-top: -18px;
}

.text-info {
    text-align: center;
    padding: 0 8px;
}

.text-info h2 {
    margin: 0;
    font-size: clamp(24px, 6.6vw, 34px);
    line-height: 1.18;
    font-weight: 800;
    text-shadow: 0 10px 30px rgba(0, 0, 0, 0.38);
}

.text-info p {
    margin: 10px 0 0;
    color: var(--text-soft);
    font-size: clamp(16px, 4.8vw, 20px);
    line-height: 1.4;
}

.login-box {
    margin-top: 22px;
    padding: 24px 18px 18px;
    border: 1px solid var(--border);
    border-radius: 22px;
    background:
        linear-gradient(135deg, rgba(53, 25, 82, 0.8), rgba(97, 59, 134, 0.52)),
        rgba(255, 255, 255, 0.02);
    backdrop-filter: blur(16px);
    box-shadow: 0 24px 58px rgba(0, 0, 0, 0.32);
}

.login-box.error-shake {
    border-color: rgba(255, 96, 96, 0.9);
    animation: shake 0.38s ease-in-out;
}

.input-label {
    display: block;
    margin-bottom: 14px;
    text-align: center;
    font-size: clamp(19px, 5vw, 24px);
    font-weight: 800;
}

.iti {
    width: 100%;
}

.iti__flag-container {
    padding: 2px;
    border-right: 1px solid rgba(255, 255, 255, 0.08);
    background: rgba(255, 255, 255, 0.07);
    border-radius: 14px 0 0 14px;
}

.iti__selected-flag {
    background: transparent !important;
}

.phone-input {
    width: 100%;
    height: 56px;
    padding-right: 16px;
    border: 2px solid rgba(185, 132, 255, 0.28);
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.03);
    color: #fff;
    direction: ltr;
    text-align: left;
    outline: none;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.phone-input:focus {
    border-color: rgba(241, 200, 107, 0.68);
    box-shadow: 0 0 0 4px rgba(241, 200, 107, 0.08);
}

.continue-btn,
.copy-btn,
.retry-btn {
    width: 100%;
    height: 56px;
    margin-top: 18px;
    border-radius: 999px;
    background: var(--button-gradient);
    color: #fff;
    font-size: 18px;
    font-weight: 800;
    box-shadow: 0 16px 36px rgba(113, 52, 234, 0.3);
}

.modal-card {
    position: relative;
    width: min(100%, 360px);
    padding: 28px 24px;
    border: 1px solid var(--border);
    border-radius: 24px;
    background: rgba(17, 14, 25, 0.94);
    box-shadow: var(--hero-shadow);
    text-align: center;
}

.modal-card h2 {
    margin: 0;
    color: var(--primary);
    font-size: clamp(24px, 7vw, 32px);
    line-height: 1.2;
}

.modal-subtext,
.modal-paragraph {
    margin-top: 14px;
    color: var(--text-soft);
    line-height: 1.5;
}

.code-display-container {
    display: flex;
    justify-content: center;
    gap: 8px;
    margin: 22px 0;
    direction: ltr;
}

.code-char {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 44px;
    border: 1px solid rgba(185, 132, 255, 0.5);
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.04);
    color: #fff;
    font-size: 22px;
    font-weight: 800;
}

.tip-img {
    width: 100%;
    max-width: 240px;
    margin-top: 14px;
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.08);
}

.modal-highlight {
    margin-top: 14px;
    color: var(--primary);
    font-size: 14px;
    font-weight: 700;
    line-height: 1.5;
}

.verification-box {
    margin-top: 14px;
    padding: 12px;
    border: 1px dashed rgba(241, 200, 107, 0.35);
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.03);
    color: var(--text-soft);
}

.final-code-display {
    display: inline-block;
    margin-left: 8px;
    color: #fff;
    font-size: 20px;
    font-weight: 800;
    letter-spacing: 2px;
    direction: ltr;
}

.modal-close-btn {
    position: absolute;
    top: 12px;
    right: 12px;
    width: 34px;
    height: 34px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.08);
    color: #fff;
    font-size: 22px;
}

.ok-circle {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 88px;
    height: 88px;
    margin: 18px auto 0;
    border-radius: 999px;
    background: rgba(115, 235, 126, 0.14);
    border: 2px solid rgba(115, 235, 126, 0.42);
    color: #74e57d;
    font-size: 44px;
    font-weight: 800;
}

.share-container {
    position: fixed;
    right: 18px;
    bottom: 94px;
    z-index: 12;
}

.share-trigger {
    width: 54px;
    height: 54px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.14);
    color: #fff;
    backdrop-filter: blur(10px);
    box-shadow: 0 16px 28px rgba(0, 0, 0, 0.26);
}

.share-modal {
    position: absolute;
    right: 0;
    bottom: 68px;
    display: none;
    width: 170px;
    padding: 10px;
    border: 1px solid var(--border);
    border-radius: 16px;
    background: rgba(21, 17, 29, 0.94);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.36);
}

.share-modal.show {
    display: block;
}

.share-item {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
    padding: 12px;
    border-radius: 12px;
    background: transparent;
    color: #fff;
    text-align: left;
}

.share-item + .share-item {
    margin-top: 4px;
}

.share-item i {
    width: 18px;
    text-align: center;
}

.share-item:hover {
    background: rgba(255, 255, 255, 0.06);
}

.iti__country-list {
    width: min(92vw, 420px) !important;
    max-height: min(62vh, 430px) !important;
    background: #17131f !important;
    border: 1px solid rgba(185, 132, 255, 0.26) !important;
    border-radius: 14px !important;
    box-shadow: 0 16px 36px rgba(0, 0, 0, 0.36) !important;
}

.iti__country {
    display: flex !important;
    align-items: center !important;
    padding: 10px 12px !important;
}

.iti__country-name {
    color: #fff !important;
}

.iti__dial-code {
    color: rgba(255, 255, 255, 0.68) !important;
}

.iti__country-list .x-country-search-wrap {
    position: sticky;
    top: 0;
    z-index: 5;
    padding: 10px;
    background: #17131f;
    border-bottom: 1px solid rgba(185, 132, 255, 0.18);
}

.iti__country-list .x-country-search-input {
    width: 100%;
    height: 38px;
    padding: 0 12px;
    border: 1px solid rgba(185, 132, 255, 0.24);
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.06);
    color: #fff;
    direction: ltr;
    text-align: left;
    outline: none;
}

.iti__country-list .x-country-search-input:focus {
    border-color: rgba(241, 200, 107, 0.58);
}

body.rtl-layout .header-logo {
    left: auto;
    right: 14px;
}

body.rtl-layout .share-container {
    right: auto;
    left: 18px;
}

body.rtl-layout .share-modal {
    right: auto;
    left: 0;
}

body.rtl-layout .share-item {
    text-align: right;
}

body.rtl-layout .modal-close-btn {
    right: auto;
    left: 12px;
}

body.rtl-layout .iti__flag-container {
    border-right: none;
    border-left: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 0 14px 14px 0;
}

body.rtl-layout .verification-box {
    direction: rtl;
}

body.rtl-layout .final-code-display {
    margin-left: 0;
    margin-right: 8px;
}

body.rtl-layout .iti__country-list {
    direction: rtl;
}

body.rtl-layout .iti__country {
    text-align: right;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

@keyframes shake {
    0%, 100% {
        transform: translateX(0);
    }
    25% {
        transform: translateX(-8px);
    }
    50% {
        transform: translateX(8px);
    }
    75% {
        transform: translateX(-4px);
    }
}

@media (min-width: 768px) {
    .page-stage {
        width: min(100%, 720px);
        padding-bottom: 40px;
    }

    .hero-swiper {
        height: 48vh;
        max-height: 430px;
    }

    .hero-swiper .swiper-slide {
        width: calc(100% - 120px);
        max-width: 560px;
    }

    .main-container {
        width: min(100%, 560px);
        margin: -14px auto 0;
    }

    .share-container {
        bottom: 28px;
    }
}

@media (max-width: 480px) {
    .page-stage {
        padding-left: 12px;
        padding-right: 12px;
        padding-bottom: 120px;
    }

    .hero-swiper {
        height: 46vh;
    }

    .hero-swiper .swiper-slide {
        width: calc(100% - 42px);
        border-radius: 22px;
    }

    .main-container {
        margin-top: -12px;
    }

    .share-container {
        right: 14px;
        bottom: 92px;
    }

    body.rtl-layout .share-container {
        right: auto;
        left: 14px;
    }
}
