/* global.css - HGFAST SPA Global Engine Ultimate Final */

/* =========================================================
   1. Reset
   ========================================================= */
*, *::before, *::after {
    box-sizing: border-box !important;
    -webkit-tap-highlight-color: transparent;
}

html, body {
    margin: 0;
    padding: 0;
    width: 100%;
    max-width: 100%;
    min-height: 100vh;
    min-height: 100dvh;
    background: #000;
    color: #f5f5f7;
    font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "PingFang SC", "Microsoft YaHei", sans-serif;
    overflow-x: clip !important;
}

body {
    position: relative;
}

img, svg, video, canvas {
    max-width: 100%;
    height: auto;
}

button, input, textarea, select {
    font: inherit;
}

@supports not (overflow: clip) {
    html, body {
        overflow-x: hidden !important;
    }
}

/* =========================================================
   2. Theme
   ========================================================= */
:root {
    --sidebar-w: 260px;
    --sidebar-mobile-w: min(84vw, 320px);
    --mobile-header-h: 64px;
    --safe-top: env(safe-area-inset-top, 0px);
    --safe-bottom: env(safe-area-inset-bottom, 0px);

    --bg: #000;
    --card-bg: rgba(18, 18, 20, 0.72);
    --card-strong: rgba(22, 22, 24, 0.92);
    --text: #f5f5f7;
    --sub: #86868b;
    --blue: #0A84FF;
    --green: #32D74B;
    --purple: #BF5AF2;
    --orange: #FF9F0A;
    --red: #FF453A;
    --gold: #d4af37;
    --border: rgba(255,255,255,0.08);
    --shadow-lg: 0 30px 80px rgba(0,0,0,0.5);
}

/* =========================================================
   3. Global background
   ========================================================= */
.bg-grid {
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 0;
    max-width: 100%;
    background-image:
        linear-gradient(rgba(255,255,255,0.03) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255,255,255,0.03) 1px, transparent 1px);
    background-size: 40px 40px;
    mask-image: radial-gradient(circle at center, rgba(0,0,0,0.9), transparent 85%);
    -webkit-mask-image: radial-gradient(circle at center, rgba(0,0,0,0.9), transparent 85%);
    opacity: 0.35;
}

.bg-glow {
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 0;
    max-width: 100%;
    background:
        radial-gradient(circle at 10% 10%, rgba(10,132,255,0.22), transparent 26%),
        radial-gradient(circle at 88% 16%, rgba(191,90,242,0.18), transparent 22%),
        radial-gradient(circle at 55% 80%, rgba(50,215,75,0.14), transparent 22%);
    filter: blur(60px);
    opacity: 0.95;
}

/* =========================================================
   4. App Root
   ========================================================= */
#app-root {
    position: relative;
    z-index: 1;
    min-height: 100vh;
    min-height: 100dvh;
    margin-left: var(--sidebar-w);
    width: auto;
    max-width: calc(100% - var(--sidebar-w));
    overflow-x: clip;
    transition:
        margin-left 0.35s cubic-bezier(0.16, 1, 0.3, 1),
        max-width 0.35s cubic-bezier(0.16, 1, 0.3, 1),
        opacity 0.25s ease;
}

/* 无侧边栏页面：登录 / 注册 / 忘记密码 */
body.no-sidebar-layout #app-root {
    margin-left: 0 !important;
    width: 100% !important;
    max-width: 100% !important;
    min-height: 100vh !important;
    min-height: 100dvh !important;
    position: relative !important;
    z-index: 2 !important;
    display: block !important;
}

/* =========================================================
   5. Container
   ========================================================= */
#app-root .container,
#app-root .store-container {
    position: relative;
    z-index: 1;
    width: 100%;
    max-width: 100%;
    margin: 0;
    padding: 40px 40px 100px;
}

@media (min-width: 1920px) {
    #app-root .container,
    #app-root .store-container {
        max-width: 1600px;
        margin: 0 auto;
    }
}

@media (max-width: 850px) {
    #app-root {
        margin-left: 0 !important;
        width: 100% !important;
        max-width: 100% !important;
        padding-top: calc(60px + var(--safe-top));
    }

    body.no-sidebar-layout #app-root {
        padding-top: 0 !important;
    }

    #app-root .container,
    #app-root .store-container {
        padding: 24px 20px calc(100px + var(--safe-bottom));
    }
}

/* =========================================================
   6. Toast
   ========================================================= */
#toast-container {
    position: fixed;
    top: calc(18px + var(--safe-top));
    left: 50%;
    transform: translateX(-50%);
    z-index: 2147483647;
    display: flex;
    flex-direction: column;
    gap: 12px;
    pointer-events: none;
    width: min(92vw, 520px);
}

/* =========================================================
   7. Modal Engine
   ========================================================= */
.modal-overlay,
.sys-modal-overlay {
    position: fixed !important;
    inset: 0 !important;
    display: flex !important;
    justify-content: center !important;
    align-items: center !important;
    padding: 20px !important;
    background: rgba(0,0,0,0.82) !important;
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity .35s ease, visibility .35s ease;
    z-index: 2147483600 !important;
}

.modal-overlay.show,
.sys-modal-overlay.show {
    opacity: 1 !important;
    visibility: visible !important;
    pointer-events: auto !important;
}

.modal-box,
.checkout-box,
.confirm-box,
.st-modal-box,
.sys-confirm-box {
    width: 100%;
    max-width: 480px;
    max-height: 90vh;
    overflow: auto;
    border-radius: 30px;
    border: 1px solid rgba(255,255,255,0.1);
    background: rgba(22,22,24,0.96);
    box-shadow: 0 40px 100px rgba(0,0,0,0.88);
    transform: scale(.95) translateY(20px);
    transition: transform .45s cubic-bezier(0.16,1,0.3,1);
    position: relative;
    color: #fff;
}

.modal-box.wide,
.checkout-box.wide,
.st-modal-box.wide {
    max-width: 860px;
}

.modal-overlay.show .modal-box,
.modal-overlay.show .checkout-box,
.modal-overlay.show .confirm-box,
.modal-overlay.show .st-modal-box,
.sys-modal-overlay.show .sys-confirm-box {
    transform: scale(1) translateY(0);
}

@media (max-width: 768px) {
    .modal-overlay,
    .sys-modal-overlay {
        align-items: flex-end !important;
        padding: 0 !important;
    }

    .modal-box,
    .checkout-box,
    .confirm-box,
    .st-modal-box,
    .sys-confirm-box {
        max-width: 100% !important;
        width: 100% !important;
        border-radius: 28px 28px 0 0 !important;
        border-bottom: none !important;
        border-left: none !important;
        border-right: none !important;
        transform: translateY(100%);
        padding-bottom: calc(20px + env(safe-area-inset-bottom));
    }
}

/* =========================================================
   8. Auth Wrapper
   ========================================================= */
#login-container-wrapper,
#register-container-wrapper,
#forgot-container-wrapper {
    position: fixed !important;
    inset: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
    width: auto !important;
    max-width: 100% !important;
    display: flex !important;
    justify-content: center !important;
    align-items: center !important;
    overflow: hidden !important;
    padding: 20px !important;
    background: transparent !important;
    z-index: 990 !important;
}

.login-mesh-bg,
.register-mesh-bg,
.forgot-mesh-bg {
    position: absolute;
    inset: 0;
    z-index: 0;
    background-image:
        radial-gradient(at 0% 0%, hsla(253,16%,7%,1) 0, transparent 50%),
        radial-gradient(at 50% 0%, hsla(225,39%,30%,0.5) 0, transparent 50%),
        radial-gradient(at 100% 0%, hsla(339,49%,30%,0.4) 0, transparent 50%);
    filter: blur(60px);
    opacity: 0.8;
    animation: pulseMesh 15s ease-in-out infinite alternate;
}

@keyframes pulseMesh {
    0% { transform: scale(1) rotate(0deg); opacity: 0.7; }
    100% { transform: scale(1.1) rotate(2deg); opacity: 1; }
}

.auth-card {
    position: relative;
    z-index: 1;
    width: 100%;
    max-width: 420px;
    padding: 48px 40px;
    border-radius: 32px;
    background: rgba(20,20,22,0.65);
    backdrop-filter: blur(40px);
    -webkit-backdrop-filter: blur(40px);
    border: 1px solid rgba(255,255,255,0.10);
    border-top: 1px solid rgba(255,255,255,0.18);
    border-left: 1px solid rgba(255,255,255,0.12);
    box-shadow: 0 30px 60px rgba(0,0,0,0.4);
}

.auth-card.success-warp {
    transform: scale(1.04);
    opacity: 0;
    filter: blur(10px);
    transition: all .5s ease;
}

.brand {
    text-align: center;
    margin-bottom: 36px;
}

.brand-icon {
    width: 64px;
    height: 64px;
    border-radius: 20px;
    margin: 0 auto 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #1d1d1f, #2c2c2e);
    border: 1px solid rgba(255,255,255,0.10);
    color: #fff;
    font-size: 30px;
    box-shadow: 0 10px 20px rgba(0,0,0,.3);
}

.brand h1 {
    font-size: 26px;
    font-weight: 800;
    letter-spacing: -0.5px;
    margin: 0 0 8px;
    color: #fff;
}

.brand p {
    font-size: 14px;
    color: var(--sub);
    font-weight: 500;
    margin: 0;
}

.input-group {
    position: relative;
    margin-bottom: 20px;
    width: 100%;
}

.input-group i {
    position: absolute;
    left: 18px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--sub);
    font-size: 22px;
    z-index: 2;
    transition: .25s;
}

.input-group input {
    width: 100%;
    padding: 18px 18px 18px 52px;
    background: rgba(255,255,255,0.06);
    border: 1px solid transparent;
    border-radius: 16px;
    font-size: 15px;
    font-weight: 600;
    color: #fff;
    outline: none;
    transition: .25s;
}

.input-group input::placeholder {
    color: rgba(255,255,255,0.3);
}

.input-group input:focus {
    background: rgba(255,255,255,0.1);
    border-color: rgba(255,255,255,0.26);
    box-shadow: 0 4px 20px rgba(0,0,0,0.2);
}

.btn-submit {
    width: 100%;
    border: none;
    border-radius: 16px;
    padding: 18px;
    background: #fff;
    color: #000;
    font-size: 16px;
    font-weight: 800;
    cursor: pointer;
    transition: .25s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.btn-submit:hover {
    background: #e5e5ea;
    transform: translateY(-2px);
    box-shadow: 0 15px 35px rgba(255,255,255,0.15);
}

.btn-submit:disabled {
    background: #3a3a3c;
    color: #86868b;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.links {
    display: flex;
    justify-content: space-between;
    margin-top: 24px;
    font-size: 14px;
    font-weight: 600;
    gap: 12px;
    flex-wrap: wrap;
}

.links a {
    color: var(--sub);
    text-decoration: none;
    transition: .2s;
    cursor: pointer;
}

.links a:hover {
    color: #fff;
}

input:-webkit-autofill,
input:-webkit-autofill:hover,
input:-webkit-autofill:focus,
input:-webkit-autofill:active {
    -webkit-box-shadow: 0 0 0 1000px #1c1c1e inset !important;
    -webkit-text-fill-color: #fff !important;
    caret-color: #fff !important;
    transition: background-color 5000s ease-in-out 0s;
    border-radius: 16px !important;
}

/* =========================================================
   9. HGFAST Boot Screen
   ========================================================= */
.boot-screen {
    min-height: 78vh;
    min-height: 78dvh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 32px 20px;
}

.boot-core {
    width: 100%;
    max-width: 520px;
    padding: 36px 28px;
    border-radius: 28px;
    background:
        linear-gradient(180deg, rgba(255,255,255,0.06), rgba(255,255,255,0.02)),
        rgba(16,16,20,0.72);
    border: 1px solid rgba(255,255,255,0.08);
    backdrop-filter: blur(24px) saturate(180%);
    -webkit-backdrop-filter: blur(24px) saturate(180%);
    box-shadow:
        0 30px 80px rgba(0,0,0,0.45),
        inset 0 1px 0 rgba(255,255,255,0.06);
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    position: relative;
    overflow: hidden;
}

.boot-core::before {
    content: "";
    position: absolute;
    inset: -30% auto auto -20%;
    width: 220px;
    height: 220px;
    background: radial-gradient(circle, rgba(10,132,255,0.22), transparent 70%);
    filter: blur(12px);
    pointer-events: none;
}

.boot-core::after {
    content: "";
    position: absolute;
    inset: auto -20% -30% auto;
    width: 220px;
    height: 220px;
    background: radial-gradient(circle, rgba(191,90,242,0.18), transparent 70%);
    filter: blur(12px);
    pointer-events: none;
}

.boot-orb {
    width: 84px;
    height: 84px;
    border-radius: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 18px;
    background:
        radial-gradient(circle at 30% 30%, rgba(255,255,255,0.18), transparent 35%),
        linear-gradient(135deg, rgba(10,132,255,0.92), rgba(191,90,242,0.88));
    box-shadow:
        0 20px 40px rgba(10,132,255,0.28),
        0 0 0 1px rgba(255,255,255,0.08) inset;
    animation: bootFloat 2.6s ease-in-out infinite;
    position: relative;
    z-index: 1;
}

.boot-orb i {
    font-size: 38px;
    color: #fff;
    filter: drop-shadow(0 4px 16px rgba(255,255,255,0.28));
}

.boot-brand {
    position: relative;
    z-index: 1;
    font-size: 28px;
    font-weight: 900;
    letter-spacing: 1.2px;
    color: #fff;
    margin-bottom: 8px;
    line-height: 1.1;
}

.boot-sub {
    position: relative;
    z-index: 1;
    font-size: 13px;
    font-weight: 600;
    color: rgba(255,255,255,0.56);
    letter-spacing: 1.8px;
    text-transform: uppercase;
    margin-bottom: 26px;
}

.boot-progress-wrap {
    width: 100%;
    position: relative;
    z-index: 1;
    margin-bottom: 20px;
}

.boot-progress-bar {
    position: relative;
    width: 100%;
    height: 12px;
    border-radius: 999px;
    background: rgba(255,255,255,0.08);
    overflow: hidden;
    border: 1px solid rgba(255,255,255,0.06);
    box-shadow: inset 0 2px 8px rgba(0,0,0,0.35);
}

.boot-progress-fill {
    position: absolute;
    inset: 0 auto 0 0;
    width: 72%;
    border-radius: 999px;
    background: linear-gradient(90deg, #0A84FF 0%, #5AC8FA 45%, #BF5AF2 100%);
    box-shadow: 0 0 24px rgba(10,132,255,0.45);
    animation: bootLoading 2.4s ease-in-out infinite;
}

.boot-progress-glow {
    position: absolute;
    top: 0;
    bottom: 0;
    left: -20%;
    width: 24%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.45), transparent);
    filter: blur(2px);
    animation: bootShine 2.2s linear infinite;
}

.boot-progress-text {
    margin-top: 12px;
    font-size: 13px;
    font-weight: 700;
    color: #9ec9ff;
    letter-spacing: 0.3px;
    animation: bootBlink 1.5s ease-in-out infinite;
}

.boot-status-list {
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 10px;
    position: relative;
    z-index: 1;
}

.boot-status-item {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 14px;
    border-radius: 16px;
    background: rgba(255,255,255,0.035);
    border: 1px solid rgba(255,255,255,0.06);
    color: #d9e7ff;
    font-size: 13px;
    font-weight: 600;
    text-align: left;
    box-shadow: inset 0 1px 0 rgba(255,255,255,0.03);
}

.boot-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: #32D74B;
    box-shadow: 0 0 12px rgba(50,215,75,0.8);
    flex-shrink: 0;
    animation: bootPulse 1.6s infinite;
}

@keyframes bootFloat {
    0%,100% { transform: translateY(0); }
    50% { transform: translateY(-6px); }
}

@keyframes bootPulse {
    0% { transform: scale(1); opacity: 1; }
    50% { transform: scale(1.18); opacity: .75; }
    100% { transform: scale(1); opacity: 1; }
}

@keyframes bootBlink {
    0%,100% { opacity: 1; }
    50% { opacity: .55; }
}

@keyframes bootShine {
    0% { left: -28%; }
    100% { left: 108%; }
}

@keyframes bootLoading {
    0% { width: 38%; }
    50% { width: 82%; }
    100% { width: 58%; }
}

/* =========================================================
   10. Crisp 防竖条 / 防横向溢出补丁
   ========================================================= */
body,
#app-root,
.bg-grid,
.bg-glow,
#login-container-wrapper,
#register-container-wrapper,
#forgot-container-wrapper {
    max-width: 100% !important;
}

#crisp-chatbox,
.crisp-client,
.crisp-client > div,
.crisp-client iframe {
    max-width: 100vw !important;
}

/* =========================================================
   11. Crisp 全局防冲突补丁
   ========================================================= */
html,
body,
#app-root,
.bg-grid,
.bg-glow,
#login-container-wrapper,
#register-container-wrapper,
#forgot-container-wrapper {
    max-width: 100% !important;
    overflow-x: hidden !important;
}

#crisp-chatbox,
#crisp-chatbox *,
.crisp-client,
.crisp-client * {
    box-sizing: border-box !important;
    max-width: 100vw !important;
}

.crisp-client {
    position: fixed !important;
    left: auto !important;
    right: 16px !important;
    bottom: calc(16px + var(--safe-bottom)) !important;
    top: auto !important;
    transform: none !important;
    z-index: 2147482500 !important;
    max-width: calc(100vw - 32px) !important;
}

.crisp-client iframe,
#crisp-chatbox iframe {
    left: auto !important;
    right: 0 !important;
    bottom: 0 !important;
    max-width: calc(100vw - 32px) !important;
}

@media (min-width: 851px) {
    .crisp-client {
        right: 16px !important;
        left: auto !important;
        bottom: calc(16px + var(--safe-bottom)) !important;
    }
}

/* =========================================================
   12. Mobile
   ========================================================= */
@media (max-width: 850px) {
    .crisp-client,
    .crisp-client iframe,
    #crisp-chatbox,
    #crisp-chatbox iframe {
        max-width: 100vw !important;
    }

    body.gs-sidebar-open .crisp-client,
    body.gs-sidebar-open #crisp-chatbox {
        opacity: 0 !important;
        visibility: hidden !important;
        pointer-events: none !important;
    }

    .boot-screen {
        min-height: 68vh;
        min-height: 68dvh;
        padding: 20px 14px;
    }

    .boot-core {
        max-width: 100%;
        padding: 26px 18px;
        border-radius: 22px;
    }

    .boot-orb {
        width: 70px;
        height: 70px;
        border-radius: 20px;
        margin-bottom: 14px;
    }

    .boot-orb i {
        font-size: 30px;
    }

    .boot-brand {
        font-size: 22px;
        margin-bottom: 6px;
    }

    .boot-sub {
        font-size: 11px;
        letter-spacing: 1.2px;
        margin-bottom: 20px;
    }

    .boot-progress-bar {
        height: 10px;
    }

    .boot-progress-text {
        font-size: 12px;
        margin-top: 10px;
    }

    .boot-status-list {
        gap: 8px;
    }

    .boot-status-item {
        padding: 10px 12px;
        border-radius: 14px;
        font-size: 12px;
    }

    .boot-dot {
        width: 8px;
        height: 8px;
    }
}

@media (max-width: 480px) {
    .auth-card {
        padding: 32px 24px;
        border-radius: 28px;
    }

    .brand {
        margin-bottom: 28px;
    }

    .brand-icon {
        width: 56px;
        height: 56px;
        font-size: 28px;
        border-radius: 16px;
        margin-bottom: 12px;
    }

    .brand h1 {
        font-size: 22px;
    }

    .input-group input {
        padding: 16px 16px 16px 48px;
        font-size: 14px;
    }

    .input-group i {
        left: 16px;
        font-size: 20px;
    }

    .btn-submit {
        padding: 16px;
        font-size: 15px;
    }

    .links {
        font-size: 13px;
        margin-top: 20px;
    }

    .boot-core {
        padding: 22px 16px;
    }

    .boot-brand {
        font-size: 20px;
    }

    .boot-sub {
        font-size: 10px;
        letter-spacing: 1px;
    }

    .boot-progress-text {
        font-size: 11px;
    }

    .boot-status-item {
        font-size: 11px;
    }

    #toast-container {
        top: calc(12px + var(--safe-top));
        width: min(94vw, 520px);
    }
}