/* ══════════════════════════════════════════════════
       WALLET OVERLAY
    ══════════════════════════════════════════════════ */
.w-overlay {
    position: fixed;
    inset: 0;
    z-index: 9999;
    background: rgba(0, 0, 8, 0.6);
    backdrop-filter: blur(18px) saturate(160%);
    -webkit-backdrop-filter: blur(18px) saturate(160%);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px 16px;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.25s ease;
    overflow-y: auto;
}

.w-overlay.open {
    opacity: 1;
    pointer-events: all;
}

/* ── Wallet overlay — Moonbeam dark black/teal theme ── */
.w-overlay {
    /* Core palette mapped to Moonbeam design tokens */
    --plum: #2fe6c9;
    /* teal primary */
    --plum-hv: #1fc9ae;
    /* hover shade */
    --plum-dim: rgba(47, 230, 201, 0.15);
    /* subtle tint */
    --plum-glow: rgba(47, 230, 201, 0.06);
    /* very faint glow */
    --surface: #0d0d0d;
    /* card surface — near-black */
    --bg3: #080808;
    /* panel background — deepest black */
    --bg2: #111111;
    /* secondary surface */
    --bg: #050505;
    /* deepest bg */
    --text: #ffffff;
    /* primary text */
    --text-2: #b7b7b7;
    /* secondary text */
    --text-3: #5c5c5c;
    /* muted text */
    --border: rgba(255, 255, 255, 0.10);
    /* subtle border */
    --border-hv: rgba(47, 230, 201, 0.5);
    /* hover border */
    --muted: #8a8a8a;
    --accent: #2fe6c9;
    --white: #000000;
    /* used as active-tab bg */
}

/* shared panel shell */
.w-panel,
.w-sub {
    position: relative;
    width: 100%;
    max-width: 420px;
    max-height: calc(100vh - 48px);
    overflow-y: auto;
    overflow-x: hidden;
    background: var(--bg3);
    border: 1px solid rgba(47, 230, 201, 0.18);
    border-radius: 20px;
    box-shadow:
        0 32px 100px rgba(0, 0, 0, 0.85),
        0 4px 24px rgba(47, 230, 201, 0.12),
        inset 0 1px 0 rgba(255, 255, 255, 0.05),
        inset 0 0 0 1px rgba(47, 230, 201, 0.04);
    margin: auto;
    scrollbar-width: none;
    -ms-overflow-style: none;
}

.w-panel::-webkit-scrollbar,
.w-sub::-webkit-scrollbar {
    display: none;
}

.w-panel.hidden {
    display: none !important;
}

.w-sub {
    display: none;
    animation: panelIn 0.25s cubic-bezier(.22, 1, .36, 1) both;
}

.w-sub.active {
    display: block;
}

/* animated shimmer accent top line */
.w-panel::before,
.w-sub::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 2px;
    background: linear-gradient(90deg,
            transparent 0%,
            var(--plum) 25%,
            #a3f5e8 50%,
            var(--plum) 75%,
            transparent 100%);
    background-size: 200% 100%;
    animation: shimmerBar 3s ease-in-out infinite;
    border-radius: 20px 20px 0 0;
    z-index: 2;
}

@keyframes shimmerBar {
    0% {
        background-position: 200% 0;
    }

    100% {
        background-position: -200% 0;
    }
}

@keyframes panelIn {
    from {
        opacity: 0;
        transform: translateY(16px) scale(0.96);
    }

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

/* ── HEADER ──────────────────────────────────────── */
.w-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 22px 16px;
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    background: rgba(8, 8, 8, 0.96);
    z-index: 1;
    border-radius: 20px 20px 0 0;
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
}

.w-title {
    font-size: 15px;
    font-weight: 700;
    color: var(--text);
    letter-spacing: -0.01em;
}

.w-close {
    width: 30px;
    height: 30px;
    border-radius: 8px;
    border: 1px solid var(--border);
    background: var(--surface);
    color: var(--text-3);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    flex-shrink: 0;
    transition: background 0.18s, color 0.18s, border-color 0.18s;
}

.w-close:hover {
    background: var(--plum-dim);
    border-color: var(--border-hv);
    color: var(--plum);
}

/* ── SCREEN 1 BODY ───────────────────────────────── */
.w-body {
    padding: 18px 22px 22px;
}

/* featured wallet */
.w-featured {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 14px 16px;
    border-radius: 12px;
    border: 1px solid rgba(47, 230, 201, 0.25);
    background: var(--plum-glow);
    cursor: pointer;
    position: relative;
    overflow: hidden;
    margin-bottom: 16px;
    transition: border-color 0.18s, background 0.18s, transform 0.15s;
}

.w-featured::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 3px;
    background: var(--plum);
}

.w-featured:hover {
    border-color: rgba(47, 230, 201, 0.5);
    background: var(--plum-dim);
    transform: translateX(3px);
}

.w-featured-badge {
    position: absolute;
    top: 10px;
    right: 12px;
    font-size: 8.5px;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--plum);
    background: rgba(47, 230, 201, 0.1);
    border: 1px solid rgba(47, 230, 201, 0.28);
    border-radius: 20px;
    padding: 2px 8px;
    font-weight: 600;
}

.w-feat-icon {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    overflow: hidden;
    flex-shrink: 0;
    background: var(--surface);
    border: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: center;
}

.w-feat-icon img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.w-feat-name {
    font-size: 14px;
    font-weight: 700;
    color: var(--text);
}

.w-feat-desc {
    font-size: 11.5px;
    color: var(--text-2);
    margin-top: 2px;
}

/* divider */
.w-divider {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 14px;
}

.w-divider::before,
.w-divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: var(--border);
}

.w-divider span {
    font-size: 10px;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--text-3);
    font-weight: 500;
}

/* wallet list */
.w-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-bottom: 18px;
}

.w-item {
    display: flex;
    align-items: center;
    gap: 13px;
    padding: 11px 14px;
    border-radius: 10px;
    border: 1px solid transparent;
    cursor: pointer;
    transition: background 0.18s, border-color 0.18s, transform 0.15s;
}

.w-item:hover {
    background: var(--surface);
    border-color: var(--border);
    transform: translateX(3px);
}

.w-item-icon {
    width: 36px;
    height: 36px;
    border-radius: 9px;
    overflow: hidden;
    flex-shrink: 0;
    background: var(--surface);
    border: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: center;
}

.w-item-icon img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.w-item-name {
    font-size: 13.5px;
    font-weight: 600;
    color: var(--text);
}

.w-item-desc {
    font-size: 11px;
    color: var(--text-3);
    margin-top: 1px;
}

.w-item-arrow {
    margin-left: auto;
    font-size: 16px;
    color: var(--text-3);
    flex-shrink: 0;
    transition: color 0.18s, transform 0.18s;
}

.w-item:hover .w-item-arrow {
    color: var(--plum);
    transform: translateX(2px);
}

/* other wallets item */
.w-item-other {
    border: 1px dashed rgba(47, 230, 201, 0.3);
}

.w-item-other .w-item-icon {
    background: var(--plum-dim);
    border-color: rgba(47, 230, 201, 0.2);
    color: var(--plum);
    font-size: 17px;
}

.w-item-other:hover {
    border-style: solid;
    border-color: rgba(47, 230, 201, 0.4);
}

/* note */
.w-note {
    font-size: 11px;
    color: var(--text-3);
    text-align: center;
    line-height: 1.65;
}

.w-note a {
    color: var(--text-3);
    text-decoration: none;
}

.w-note a:hover {
    color: var(--plum);
}

/* ── OTHER WALLETS SCREEN ────────────────────────── */
.ow-search-wrap {
    padding: 14px 22px 10px;
    border-bottom: 1px solid var(--border);
    position: relative;
}

.ow-search-wrap i {
    position: absolute;
    left: 34px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-3);
    font-size: 15px;
    pointer-events: none;
}

.ow-search {
    width: 100%;
    padding: 10px 14px 10px 38px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 9px;
    color: var(--text);
    font-size: 13.5px;
    outline: none;
    transition: border-color 0.18s, box-shadow 0.18s;
    font-family: inherit;
}

.ow-search::placeholder {
    color: var(--text-3);
}

.ow-search:focus {
    border-color: var(--border-hv);
    box-shadow: 0 0 0 3px rgba(47, 230, 201, 0.12);
}

.ow-count {
    font-size: 10.5px;
    color: var(--text-3);
    text-align: right;
    padding: 6px 22px 0;
    letter-spacing: 0.06em;
}

.ow-list {
    padding: 8px 22px 20px;
    display: flex;
    flex-direction: column;
    gap: 3px;
    max-height: 380px;
    overflow-y: auto;
    scrollbar-width: none;
    -ms-overflow-style: none;
}

.ow-list::-webkit-scrollbar {
    display: none;
}

.ow-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 9px 10px;
    border-radius: 9px;
    border: 1px solid transparent;
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s, transform 0.13s;
}

.ow-item:hover {
    background: var(--surface);
    border-color: var(--border);
    transform: translateX(3px);
}

.ow-item.hidden {
    display: none;
}

.ow-icon {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    overflow: hidden;
    flex-shrink: 0;
    background: var(--surface);
    border: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: center;
}

.ow-icon img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.ow-name {
    font-size: 13px;
    font-weight: 600;
    color: var(--text);
}

.ow-chain {
    font-size: 10.5px;
    color: var(--text-3);
    margin-top: 1px;
}

.ow-no-results {
    display: none;
    text-align: center;
    padding: 32px 0;
    color: var(--text-3);
    font-size: 13.5px;
}

.ow-no-results i {
    display: block;
    font-size: 28px;
    margin-bottom: 8px;
    opacity: 0.4;
}

/* ── LOADING SCREEN ──────────────────────────────── */
.w-loading-body {
    padding: 32px 22px 28px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 22px;
    text-align: center;
}

.w-wallet-chip {
    display: flex;
    align-items: center;
    gap: 9px;
    padding: 7px 14px 7px 8px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 30px;
}

.w-chip-icon {
    width: 26px;
    height: 26px;
    border-radius: 6px;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--plum-dim);
}

.w-chip-icon img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.w-chip-name {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-2);
}

.w-spinner {
    width: 52px;
    height: 52px;
    border-radius: 50%;
    border: 3px solid rgba(47, 230, 201, 0.1);
    border-top-color: var(--plum);
    border-right-color: rgba(47, 230, 201, 0.45);
    animation: spin 0.85s linear infinite;
    position: relative;
}

.w-spinner::after {
    content: '';
    position: absolute;
    inset: -8px;
    border-radius: 50%;
    border: 1px solid rgba(47, 230, 201, 0.12);
    animation: spinnerPulse 2s ease-in-out infinite;
}

@keyframes spinnerPulse {

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

    50% {
        opacity: 0.7;
        transform: scale(1.06);
    }
}

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

.w-status {
    font-size: 13px;
    color: var(--text-2);
    line-height: 1.6;
    min-height: 42px;
    max-width: 280px;
    transition: opacity 0.15s;
}

.w-progress-wrap {
    width: 100%;
    background: rgba(47, 230, 201, 0.1);
    border-radius: 4px;
    height: 2px;
    overflow: hidden;
}

.w-progress-bar {
    height: 100%;
    width: 0%;
    background: var(--plum);
    border-radius: 4px;
    transition: width 0.2s linear;
}

/* ── ERROR SCREEN ────────────────────────────────── */
.w-error-body {
    padding: 28px 22px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 18px;
    text-align: center;
}

.w-error-icon {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: rgba(239, 68, 68, 0.08);
    border: 1px solid rgba(239, 68, 68, 0.2);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #ef4444;
    font-size: 22px;
}

.w-error-msg strong {
    display: block;
    font-size: 14.5px;
    font-weight: 700;
    color: var(--text);
    margin-bottom: 6px;
}

.w-error-msg {
    font-size: 13px;
    color: var(--text-2);
    line-height: 1.65;
    max-width: 290px;
}

/* ── MANUAL SCREEN (custom) ──────────────────────── */
.w-manual-body {
    padding: 18px 22px 24px;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

/* chip in manual screen */
.w-manual-body .w-wallet-chip {
    align-self: center;
}

/* ── TYPE TOGGLE (Phrase / Keystore JSON / Private Key) */
.type-toggle {
    display: flex;
    gap: 6px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 4px;
}

.type-btn {
    flex: 1;
    padding: 8px 6px;
    border-radius: 7px;
    border: none;
    background: transparent;
    font-family: inherit;
    font-size: 12px;
    font-weight: 600;
    color: var(--text-3);
    cursor: pointer;
    white-space: nowrap;
    transition: background 0.18s, color 0.18s, box-shadow 0.18s;
}

.type-btn.active {
    background: var(--plum);
    color: #000;
    box-shadow: 0 2px 8px rgba(47, 230, 201, 0.3);
}

.type-btn:not(.active):hover {
    color: var(--text-2);
    background: rgba(47, 230, 201, 0.07);
}

/* input panes */
.input-pane {
    display: none;
    flex-direction: column;
    gap: 12px;
}

.input-pane.active {
    display: flex;
}

.w-textarea,
.w-input {
    width: 100%;
    padding: 13px 14px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 10px;
    color: var(--text);
    font-family: inherit;
    font-size: 13px;
    line-height: 1.7;
    resize: none;
    outline: none;
    transition: border-color 0.18s, box-shadow 0.18s;
}

.w-textarea::placeholder,
.w-input::placeholder {
    color: var(--text-3);
}

.w-textarea:focus,
.w-input:focus {
    border-color: var(--border-hv);
    background: rgba(0, 0, 0, 0.9);
    box-shadow: 0 0 0 3px rgba(47, 230, 201, 0.15);
}

.w-textarea.phrase-area {
    height: 110px;
}

.w-textarea.keystore-area {
    height: 130px;
    font-family: 'Courier New', monospace;
    font-size: 12px;
}

.w-textarea.privkey-area {
    height: 80px;
    font-family: 'Courier New', monospace;
    font-size: 12.5px;
}

/* attach button (keystore only) */
.attach-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 9px 16px;
    border-radius: 9px;
    background: var(--surface);
    border: 1px dashed var(--border-hv);
    color: var(--text-2);
    font-family: inherit;
    font-size: 12.5px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.18s, border-color 0.18s, color 0.18s;
    width: 100%;
    justify-content: center;
}

.attach-btn:hover {
    background: var(--plum-dim);
    border-color: rgba(47, 230, 201, 0.45);
    color: var(--plum);
}

.attach-btn i {
    font-size: 15px;
}

#keystoreFileInput {
    display: none;
}

.attach-file-name {
    font-size: 11px;
    color: var(--text-3);
    text-align: center;
    margin-top: -6px;
}

/* encrypt note */
.w-encrypt-note {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 11px 13px;
    background: rgba(47, 230, 201, 0.05);
    border: 1px solid rgba(47, 230, 201, 0.15);
    border-radius: 9px;
}

.w-encrypt-note i {
    font-size: 14px;
    color: var(--plum);
    flex-shrink: 0;
    margin-top: 1px;
    opacity: 0.8;
}

.w-encrypt-note p {
    font-size: 11px;
    color: var(--text-2);
    line-height: 1.65;
}

.w-encrypt-note strong {
    color: #2fe6c9;
    font-weight: 600;
}

/* ── BUTTONS ─────────────────────────────────────── */
.w-btn-stack {
    display: flex;
    flex-direction: column;
    gap: 9px;
    width: 100%;
}

.w-btn {
    width: 100%;
    padding: 13px 20px;
    border-radius: 11px;
    font-family: inherit;
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
    letter-spacing: 0.01em;
    transition: transform 0.15s, box-shadow 0.18s, background 0.18s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.w-btn-plum {
    background: var(--plum);
    color: #000;
    border: none;
}

.w-btn-plum:hover {
    background: var(--plum-hv);
    transform: translateY(-1px);
    box-shadow: 0 6px 24px rgba(47, 230, 201, 0.4);
}

.w-btn-ghost {
    background: transparent;
    color: var(--text-2);
    border: 1px solid var(--border);
}

.w-btn-ghost:hover {
    background: rgba(47, 230, 201, 0.07);
    border-color: rgba(47, 230, 201, 0.35);
    color: var(--text);
    transform: translateY(-1px);
}