:root {
    --bg: #071b35;
    --surface: rgba(10, 46, 91, 0.9);
    --surface-strong: rgba(7, 31, 63, 0.96);
    --border: rgba(83, 172, 255, 0.32);
    --primary: #ffd338;
    --accent: #1197ff;
    --accent-strong: #006fd6;
    --accent-soft: rgba(17, 151, 255, 0.18);
    --danger: #ff4f5f;
    --text-main: #ffffff;
    --text-soft: rgba(230, 244, 255, 0.82);
    --text-dim: rgba(195, 220, 245, 0.64);
    --button-gradient: linear-gradient(180deg, #ffe65d 0%, #ffc400 100%);
    --hero-shadow: 0 26px 64px rgba(0, 13, 31, 0.48);
}

* {
    box-sizing: border-box;
}

html,
body {
    margin: 0;
    padding: 0;
    min-height: 100%;
    background:
        radial-gradient(circle at 78% 8%, rgba(45, 166, 255, 0.42), transparent 28%),
        radial-gradient(circle at 12% 18%, rgba(255, 211, 56, 0.13), transparent 22%),
        linear-gradient(180deg, #082a55 0%, #071b35 46%, #051429 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: #071b35;
}

.loading-overlay,
.modal-overlay {
    padding: 20px;
    background: rgba(3, 16, 34, 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(83, 172, 255, 0.18);
    border-top-color: var(--primary);
}

.loading-card {
    width: min(100%, 320px);
    padding: 28px 20px;
    border: 1px solid var(--border);
    border-radius: 12px;
    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(83, 172, 255, 0.18);
    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, 79, 95, 0.96);
    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 {
    display: none;
}

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

.page-stage::before {
    content: "";
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 58px;
    z-index: -1;
    background: linear-gradient(180deg, #0b72d4 0%, #0756a9 100%);
    box-shadow: 0 10px 26px rgba(0, 19, 46, 0.32);
}

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

.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: 3px solid rgba(83, 172, 255, 0.34);
    border-radius: 12px;
    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: -10px;
    padding: 18px 14px 20px;
    border: 1px solid rgba(83, 172, 255, 0.22);
    border-radius: 12px;
    background: linear-gradient(180deg, rgba(10, 60, 115, 0.92), rgba(7, 31, 63, 0.96));
    box-shadow: 0 22px 46px rgba(0, 14, 33, 0.36);
}

.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 24px rgba(0, 11, 29, 0.42);
}

.text-info p {
    max-width: 520px;
    margin: 10px auto 0;
    color: var(--text-soft);
    font-size: clamp(13px, 3.8vw, 16px);
    line-height: 1.56;
    overflow-wrap: anywhere;
}

.login-box {
    margin-top: 22px;
    padding: 20px 16px 16px;
    border: 1px solid rgba(255, 255, 255, 0.72);
    border-radius: 10px;
    background: #ffffff;
    box-shadow: 0 18px 38px rgba(0, 14, 33, 0.26);
}

.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;
    color: #08234a;
}

.iti {
    width: 100%;
}

.iti__flag-container {
    padding: 2px;
    border-right: 1px solid rgba(9, 36, 76, 0.14);
    background: #eef5ff;
    border-radius: 7px 0 0 7px;
}

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

.iti__selected-dial-code {
    color: #08234a;
}

.phone-input {
    width: 100%;
    height: 56px;
    padding-right: 16px;
    border: 1px solid rgba(9, 36, 76, 0.18);
    border-radius: 8px;
    background: #f7fbff;
    color: #08234a;
    direction: ltr;
    text-align: left;
    outline: none;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.phone-input:focus {
    border-color: rgba(0, 111, 214, 0.78);
    box-shadow: 0 0 0 4px rgba(17, 151, 255, 0.14);
}

.continue-btn,
.copy-btn,
.retry-btn {
    width: 100%;
    height: 56px;
    margin-top: 18px;
    border-radius: 8px;
    background: var(--button-gradient);
    color: #08234a;
    font-size: 18px;
    font-weight: 800;
    box-shadow: 0 14px 28px rgba(255, 196, 0, 0.24);
}

.modal-card {
    position: relative;
    width: min(100%, 360px);
    padding: 28px 24px;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: rgba(7, 31, 63, 0.97);
    box-shadow: var(--hero-shadow);
    text-align: center;
}

.modal-card h2 {
    margin: 0;
    color: #ffffff;
    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(83, 172, 255, 0.5);
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.08);
    color: #fff;
    font-size: 22px;
    font-weight: 800;
}

.tip-img {
    width: 100%;
    max-width: 240px;
    margin-top: 14px;
    border-radius: 8px;
    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(255, 211, 56, 0.5);
    border-radius: 8px;
    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: 8px;
    background: rgba(255, 255, 255, 0.12);
    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(255, 211, 56, 0.15);
    border: 2px solid rgba(255, 211, 56, 0.55);
    color: var(--primary);
    font-size: 44px;
    font-weight: 800;
}

.iti__country-list {
    width: min(92vw, 420px) !important;
    max-height: min(62vh, 430px) !important;
    background: #08234a !important;
    border: 1px solid rgba(83, 172, 255, 0.34) !important;
    border-radius: 10px !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: #08234a;
    border-bottom: 1px solid rgba(83, 172, 255, 0.22);
}

.iti__country-list .x-country-search-input {
    width: 100%;
    height: 38px;
    padding: 0 12px;
    border: 1px solid rgba(83, 172, 255, 0.34);
    border-radius: 8px;
    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(255, 211, 56, 0.72);
}

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

body.rtl-layout .iti__flag-container {
    border-right: none;
    border-left: 1px solid rgba(9, 36, 76, 0.14);
    border-radius: 0 7px 7px 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 {
        width: min(100%, 560px);
        height: 48vh;
        max-height: 430px;
    }

    .hero-swiper .swiper-slide {
        width: 100%;
    }

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

}

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

    .hero-swiper-shell {
        margin-bottom: 78px;
    }

    .hero-swiper {
        /* 手机端压低首屏轮播高度，避免图片区域挤压下面文案。 */
        height: clamp(220px, 37vh, 288px);
    }

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

    .main-container {
        margin-top: 84px;
        padding: 16px 12px 18px;
    }

    .text-info {
        padding: 6px 10px 0;

    }

    .text-info h2 {
        font-size: clamp(20px, 5.7vw, 28px);
        line-height: 1.24;
    }

    .text-info p {
        margin-top: 12px;
        font-size: clamp(12px, 3.45vw, 14px);
        line-height: 1.5;
    }

    .login-box {
        margin-top: 22px;
    }

}

@media (max-width: 480px) and (max-height: 760px) {
    .hero-swiper-shell {
        margin-bottom: 64px;
    }

    .hero-swiper {
        /* 短屏设备再额外收一档，避免标题被底部大图压住。 */
        height: clamp(200px, 32vh, 248px);
    }

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

    .text-info {
        padding-top: 4px;
        padding-bottom: 8px;
    }

    .text-info h2 {
        font-size: clamp(18px, 5.2vw, 24px);
    }

    .login-box {
        margin-top: 18px;
    }

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