
/* === NEXUS UI KIT v2.0 === */

/* 1. TOAST NOTIFICATIONS */
#toast-container {
    position: fixed; top: 20px; left: 50%; transform: translateX(-50%);
    z-index: 100000; display: flex; flex-direction: column; gap: 10px;
    width: 90%; max-width: 400px; pointer-events: none;
}

.nexus-toast {
    background: rgba(10, 15, 25, 0.95);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-left: 4px solid #fff;
    padding: 15px; border-radius: 12px;
    color: #fff; font-family: 'Inter', sans-serif;
    box-shadow: 0 10px 30px rgba(0,0,0,0.5);
    backdrop-filter: blur(10px);
    display: flex; align-items: center; justify-content: space-between;
    animation: toastSlideIn 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    pointer-events: auto;
}

.nexus-toast.success { border-left-color: var(--n-green); box-shadow: 0 5px 20px rgba(57, 255, 20, 0.1); }
.nexus-toast.error { border-left-color: var(--n-red); box-shadow: 0 5px 20px rgba(255, 0, 60, 0.15); }
.nexus-toast.info { border-left-color: var(--n-cyan); box-shadow: 0 5px 20px rgba(0, 243, 255, 0.1); }

.toast-content { display: flex; flex-direction: column; gap: 4px; }
.toast-title { font-weight: 800; font-size: 13px; text-transform: uppercase; letter-spacing: 0.5px; }
.toast-msg { font-size: 12px; color: #a0aec0; line-height: 1.4; }

.toast-close {
    background: transparent; border: none; color: #555;
    font-size: 18px; cursor: pointer; padding: 5px;
}

@keyframes toastSlideIn { from { transform: translateY(-20px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }
@keyframes toastFadeOut { to { transform: translateY(-10px); opacity: 0; } }

/* 2. GLOBAL LOADER */
#global-loader {
    position: fixed; inset: 0; background: rgba(0,0,0,0.6);
    backdrop-filter: blur(5px); z-index: 99999;
    display: none; align-items: center; justify-content: center;
    flex-direction: column; gap: 20px;
    opacity: 0; transition: opacity 0.3s;
}
#global-loader.visible { display: flex; opacity: 1; }

.scanner {
    width: 60px; height: 60px; border-radius: 50%;
    border: 2px solid transparent; border-top-color: var(--n-cyan);
    animation: spin 1s linear infinite; position: relative;
}
.scanner::before {
    content: ''; position: absolute; inset: 5px; border-radius: 50%;
    border: 2px solid transparent; border-top-color: var(--n-blue);
    animation: spin 1.5s linear infinite reverse;
}
.loader-text {
    font-family: 'JetBrains Mono', monospace; font-size: 12px;
    color: var(--n-cyan); font-weight: 700; letter-spacing: 2px;
    animation: pulse 1s infinite;
}

@keyframes spin { 0% { transform: rotate(0deg); } 100% { transform: rotate(360deg); } }
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.5; } }


/* ============================================================
   🛸 ONBOARDING SYSTEM (FTUE)
   ============================================================ */

#onboarding-overlay {
    position: fixed; inset: 0; z-index: 99990; /* Поверх всего, кроме загрузчика */
    display: flex; flex-direction: column; justify-content: flex-end;
    pointer-events: auto; /* Блокируем клики по экрану под маской */
    transition: opacity 0.5s ease;
}

#onboarding-overlay.hidden { display: none; opacity: 0; pointer-events: none; }

/* 1. Световая маска */
.onboarding-mask {
    position: absolute; top: 0; left: 0; width: 100%; height: 100%;
    pointer-events: none; z-index: 1;
}

/* 2. Контейнер UI (Сам терминал и Персонаж) */
.onboarding-ui {
    position: relative; z-index: 10; width: 100%; max-width: 500px;
    margin: 0 auto; display: flex; flex-direction: column; align-items: center;
    padding-bottom: 20px;
}

/* 3. Аватар Черепахи */
.onboarding-character-wrap {
    position: relative; width: 120px; height: 120px;
    margin-bottom: -15px; /* Чтобы она "сидела" на окне диалога */
    animation: floatAvatar 3s ease-in-out infinite;
}

.onboarding-avatar { width: 100%; height: 100%; object-fit: contain; filter: drop-shadow(0 -5px 15px rgba(0, 243, 255, 0.3)); }

.char-glow {
    position: absolute; inset: 0; border-radius: 50%;
    background: radial-gradient(circle, rgba(0,243,255,0.4) 0%, transparent 70%);
    z-index: -1; animation: pulseGlow 2s infinite;
}

/* 4. Окно Диалога (Sci-Fi Glass) */
.onboarding-dialog-box {
    width: 90%; background: rgba(5, 7, 10, 0.95);
    border: 1px solid rgba(0, 243, 255, 0.3); border-radius: 16px;
    padding: 20px; box-shadow: 0 0 30px rgba(0, 0, 0, 0.8), inset 0 0 15px rgba(0, 243, 255, 0.1);
    backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px);
}

.dialog-header { display: flex; justify-content: space-between; font-family: var(--mono); font-size: 9px; color: #5a6a85; margin-bottom: 12px; font-weight: 800; text-transform: uppercase; }
.dialog-tag { color: var(--n-cyan); letter-spacing: 1px; }

#onboarding-title { font-size: 16px; font-weight: 900; color: #fff; margin-bottom: 8px; letter-spacing: 1px; }
#onboarding-text { font-size: 13px; line-height: 1.5; color: #a0aec0; min-height: 60px; }
#onboarding-text b { color: var(--n-cyan); font-weight: 900; }

/* 5. Кнопки навигации */
.onboarding-actions { display: flex; justify-content: space-between; margin-top: 15px; }

.btn-skip { background: transparent; border: none; color: #5a6a85; font-size: 11px; font-weight: 800; cursor: pointer; }
.btn-next { background: var(--n-cyan); color: #000; border: none; padding: 10px 20px; border-radius: 8px; font-weight: 900; font-size: 12px; cursor: pointer; box-shadow: 0 0 15px rgba(0,243,255,0.3); display: flex; align-items: center; gap: 8px; }
.btn-next:active { transform: scale(0.95); }

/* Анимации */
@keyframes floatAvatar { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-10px); } }
@keyframes fadeInText { from { opacity: 0; transform: translateY(5px); } to { opacity: 1; transform: translateY(0); } }

/* ============================================================
   INTRA NEXUS / PROJECT CORE
   ============================================================ */

.modal-content:has(.nexus-hub-v2) {
    box-sizing: border-box;
    width: min(94vw, 460px);
    max-width: 460px;
    max-height: min(88vh, calc(100dvh - 28px));
    padding: 22px;
    overflow-x: hidden;
    border: 1px solid rgba(62, 222, 255, 0.22);
    border-radius: 24px;
    background:
        linear-gradient(90deg, rgba(0, 243, 255, 0.025) 1px, transparent 1px),
        linear-gradient(rgba(0, 243, 255, 0.02) 1px, transparent 1px),
        radial-gradient(circle at 22% 0%, rgba(0, 224, 255, 0.11), transparent 34%),
        linear-gradient(155deg, #071019 0%, #02060b 52%, #010306 100%);
    background-size: 30px 30px, 30px 30px, auto, auto;
    box-shadow:
        0 28px 70px rgba(0, 0, 0, 0.78),
        inset 0 0 0 1px rgba(255, 255, 255, 0.025),
        inset 0 -30px 70px rgba(0, 116, 154, 0.045);
}

.modal-content:has(.nexus-hub-v2)::before {
    content: '';
    position: absolute;
    top: 0;
    left: 24px;
    right: 72px;
    height: 2px;
    background: linear-gradient(90deg, #00e5ff, rgba(0, 229, 255, 0.18), transparent);
    pointer-events: none;
}

.modal-content:has(.nexus-hub-v2) #modal-context-title {
    display: none;
}

.modal-content:has(.nexus-hub-v2) .m-close {
    top: 16px;
    right: 16px;
    width: 44px;
    height: 44px;
    border: 1px solid rgba(117, 161, 183, 0.18);
    border-radius: 13px;
    background: rgba(3, 9, 15, 0.92);
    color: #7890a5;
    font-size: 20px;
    line-height: 1;
}

.modal-content:has(.nexus-hub-v2) .m-close:hover {
    border-color: rgba(0, 229, 255, 0.44);
    background: rgba(0, 229, 255, 0.08);
    color: #e9fdff;
}

.nexus-hub-v2 {
    display: grid;
    gap: 12px;
    min-width: 0;
    color: #f4fbff;
}

.nh2-hero {
    display: grid;
    grid-template-columns: 72px minmax(0, 1fr);
    align-items: center;
    gap: 14px;
    min-width: 0;
    min-height: 76px;
    padding-right: 50px;
}

.nh2-mark-frame {
    position: relative;
    display: block;
    width: 72px;
    height: 72px;
    overflow: visible;
}

.nh2-mark-frame img {
    position: absolute;
    top: 50%;
    left: 50%;
    display: block;
    width: 98%;
    max-width: none;
    height: 98%;
    object-fit: contain;
    transform: translate(-50%, -50%);
    filter:
        drop-shadow(0 0 8px rgba(0, 229, 255, 0.24))
        drop-shadow(0 0 18px rgba(0, 229, 255, 0.09));
    pointer-events: none;
    user-select: none;
}

.nh2-identity {
    min-width: 0;
}

.nh2-kicker,
.nh2-manifest-label,
.nh2-metric-label,
.nh2-update-label {
    font-family: var(--mono);
    font-weight: 900;
    text-transform: uppercase;
}

.nh2-kicker {
    color: #00e5ff;
    font-size: 8px;
    letter-spacing: 0.2em;
}

.nh2-title {
    margin: 7px 0 0;
    color: #f6fbff;
    font-size: clamp(22px, 7vw, 30px);
    line-height: 0.92;
    font-weight: 950;
    letter-spacing: 0.015em;
    text-wrap: balance;
    text-shadow: 0 0 18px rgba(0, 229, 255, 0.16);
}

.nh2-status {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-top: 9px;
    color: #768aa0;
    font-family: var(--mono);
    font-size: 7px;
    font-weight: 900;
    letter-spacing: 0.16em;
}

.nh2-status span,
.nh2-update-label span {
    flex: 0 0 auto;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #39ff14;
    box-shadow: 0 0 9px rgba(57, 255, 20, 0.72);
}

.nh2-manifest {
    position: relative;
    padding: 16px 17px 16px 19px;
    overflow: hidden;
    border: 1px solid rgba(0, 229, 255, 0.16);
    border-radius: 14px;
    background: linear-gradient(135deg, rgba(0, 229, 255, 0.07), rgba(255, 255, 255, 0.016));
}

.nh2-manifest::before {
    content: '';
    position: absolute;
    top: 14px;
    bottom: 14px;
    left: 0;
    width: 2px;
    background: linear-gradient(180deg, #00e5ff, rgba(0, 229, 255, 0.08));
    box-shadow: 0 0 9px rgba(0, 229, 255, 0.4);
}

.nh2-manifest-label {
    color: #6e839b;
    font-size: 7px;
    letter-spacing: 0.16em;
}

.nh2-manifest p,
.nh2-update p {
    margin: 8px 0 0;
    color: #bdc9d8;
    font-size: 12px;
    line-height: 1.55;
    font-weight: 650;
}

.nh2-metrics {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 7px;
    min-width: 0;
}

.nh2-metric {
    min-width: 0;
    padding: 11px 10px;
    overflow: hidden;
    border: 1px solid rgba(132, 164, 186, 0.12);
    border-radius: 11px;
    background: rgba(0, 0, 0, 0.34);
}

.nh2-metric-label {
    overflow: hidden;
    color: #65788f;
    font-size: 6px;
    letter-spacing: 0.09em;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.nh2-metric-value {
    margin-top: 6px;
    overflow-wrap: anywhere;
    color: #f2f8ff;
    font-size: 10px;
    line-height: 1.1;
    font-weight: 950;
}

.nh2-metric--market .nh2-metric-value {
    color: #00e5ff;
}

.nh2-metric--mode .nh2-metric-value {
    color: #39ff14;
}

.nh2-update {
    padding: 14px 15px;
    border: 1px solid rgba(57, 255, 20, 0.15);
    border-radius: 13px;
    background: linear-gradient(135deg, rgba(57, 255, 20, 0.045), rgba(0, 0, 0, 0.2));
}

.nh2-update-label {
    display: flex;
    align-items: center;
    gap: 7px;
    color: #69ef58;
    font-size: 7px;
    letter-spacing: 0.13em;
}

.nh2-update-label span {
    width: 5px;
    height: 5px;
}

.nh2-update p {
    font-size: 11px;
}

.nh2-close {
    width: 100%;
    min-height: 50px;
    border: 1px solid rgba(0, 229, 255, 0.58);
    border-radius: 11px;
    background: linear-gradient(180deg, rgba(0, 229, 255, 0.13), rgba(0, 229, 255, 0.055));
    color: #35efff;
    font-size: 11px;
    font-weight: 950;
    letter-spacing: 0.15em;
    text-transform: uppercase;
    box-shadow: inset 0 0 20px rgba(0, 229, 255, 0.035);
}

.nh2-close:active {
    transform: scale(0.985);
}

@media (max-width: 420px) {
    .modal-content:has(.nexus-hub-v2) {
        width: 100%;
        max-height: calc(100dvh - max(20px, env(safe-area-inset-top)) - max(20px, env(safe-area-inset-bottom)));
        padding: 16px 13px 14px;
        border-radius: 18px;
    }

    .modal-content:has(.nexus-hub-v2) .m-close {
        top: 11px;
        right: 11px;
    }

    .nexus-hub-v2 {
        gap: 9px;
    }

    .nh2-hero {
        grid-template-columns: 60px minmax(0, 1fr);
        gap: 11px;
        min-height: 62px;
        padding-right: 42px;
    }

    .nh2-mark-frame {
        width: 60px;
        height: 60px;
    }

    .nh2-title {
        margin-top: 5px;
        font-size: clamp(19px, 7.5vw, 25px);
    }

    .nh2-status {
        margin-top: 7px;
    }

    .nh2-manifest {
        padding: 13px 13px 13px 15px;
    }

    .nh2-manifest p,
    .nh2-update p {
        margin-top: 6px;
        font-size: 10px;
        line-height: 1.48;
    }

    .nh2-metric {
        padding: 9px 7px;
    }

    .nh2-metric-value {
        font-size: 9px;
    }

    .nh2-update {
        padding: 11px 12px;
    }

    .nh2-close {
        min-height: 46px;
    }
}

@media (max-height: 650px) {
    .modal-content:has(.nexus-hub-v2) {
        max-height: calc(100dvh - 16px);
    }

    .nexus-hub-v2 {
        gap: 8px;
    }
}

@media (prefers-reduced-motion: reduce) {
    .modal-content:has(.nexus-hub-v2),
    .modal-content:has(.nexus-hub-v2) .m-close,
    .nh2-close {
        animation: none;
        transition: none;
    }
}

/* Mystery collectibles and the saved exchange result share the reserve's visual language. */
.collectible-dossier { display:flex; flex-direction:column; align-items:center; gap:16px; padding:20px 12px; color:#edf3fc; text-align:center; overflow-wrap:anywhere; }
.collectible-kicker { font:700 12px/1.5 var(--mono); color:var(--n-gold); letter-spacing:1px; }
.collectible-dossier h2 { margin:0; font-size:clamp(22px,5vw,30px); line-height:1.2; }
.collectible-dossier img { width:120px; height:120px; object-fit:contain; }
.collectible-dossier dl { margin:0; padding:14px 22px; background:rgba(255,204,0,.06); border:1px solid rgba(255,204,0,.2); border-radius:12px; max-width:100%; box-sizing:border-box; }
.collectible-dossier dt { color:#b8c6d8; font-size:13px; }
.collectible-dossier dd { margin:8px 0 0; color:var(--n-gold); font:700 22px/1.4 var(--mono); }
.collectible-dossier p { margin:0; max-width:48ch; font-size:15px; line-height:1.6; }
.collectible-dossier .collectible-note { color:#a9b8cb; font-size:13px; }
.collectible-close { width:100%; min-height:46px; padding:12px; border:1px solid rgba(255,204,0,.4); border-radius:8px; background:rgba(255,204,0,.1); color:#ffdd80; font:700 14px/1.4 var(--mono); cursor:pointer; }
.vault-card-collectible .vc-meta-apex, .vault-card-collectible .vc-stat-badge { font-size:11px; line-height:1.5; }
.exchange-operation-status { grid-column:1/-1; order:-1; padding:14px; border:1px solid rgba(0,243,255,.25); border-radius:8px; background:rgba(0,243,255,.04); color:#d5e7f7; font-size:14px; line-height:1.55; overflow-wrap:anywhere; }
.modal-content:has(.collectible-dossier) #modal-context-title { visibility:hidden; }
.exchange-operation-status[hidden] { display:none; }
#ex-slider:disabled { opacity:.4; cursor:default; }
/* Free practice: the same rules before a round and in its result. */
.practice-summary, .practice-report { padding:18px; border:1px solid rgba(0,243,255,.24); border-radius:12px; background:linear-gradient(145deg,rgba(0,42,49,.45),rgba(5,12,20,.95)); color:#e4f0fa; }
.practice-summary { margin:0 0 18px; }
.practice-kicker { color:var(--n-cyan); font:700 12px/1.5 var(--mono); letter-spacing:1px; text-transform:uppercase; }
.practice-summary h2, .practice-report h2 { margin:8px 0 12px; font-size:22px; line-height:1.25; }
.practice-summary p, .practice-report p { margin:10px 0 0; font-size:14px; line-height:1.6; color:#b5c7d9; }
.practice-score { display:flex; justify-content:space-between; align-items:center; gap:12px; margin:20px 0; padding:16px 0; border-block:1px solid rgba(255,255,255,.1); }
.practice-score strong { color:var(--n-cyan); font:700 24px/1.4 var(--mono); overflow-wrap:anywhere; }
.practice-back { width:100%; min-height:46px; margin-top:20px; padding:12px; border:1px solid rgba(0,243,255,.35); border-radius:8px; background:rgba(0,243,255,.1); color:#c3f8ff; font:700 14px/1.4 var(--mono); cursor:pointer; }

/* Durable upgrade reports and the recorded history of synthesized units. */
.upgrade-notice, .unit-lineage { padding:16px; border:1px solid rgba(0,243,255,.24); border-radius:10px; background:#07151d; color:#b8ccdf; font-size:14px; line-height:1.6; overflow-wrap:anywhere; }
.unit-lineage h3 { color:#d9faff; margin:0 0 8px; font-size:17px; }
.unit-lineage h4 { margin:14px 0 6px; font-size:14px; }
.unit-lineage p { margin:6px 0; }
.unit-lineage ul { margin:0; padding-left:20px; }
.unit-lineage li + li { margin-top:5px; }

#nexus-modal .forge-shell.phase-result { height:auto; }
#nexus-modal .forge-shell.phase-result .forge-work-panel { height:auto; }
@media (max-width:760px) { #nexus-modal .forge-shell.phase-result { grid-template-rows:auto auto; } }
