html, body {
    margin: 0;
    padding: 0;
    height: 100%;
}

:root {
            --bg: #0a0b0d;
            --card: #1a1b1e;
            --card-hover: #232428;
            --border: rgba(255, 255, 255, 0.1);
            --text: #e4e6eb;
            --text-secondary: #b0b3b8;
            --muted: #8e9197;
            --accent: #5b8def;
            --accent-hover: #4a7cd6;
            --success: #10b981;
            --error: #ef4444;
            --input-bg: #2a2b2e;
            --input-border: #3a3b3e;
        }

        * {
            box-sizing: border-box;
            font-family: 'Inter', system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
        }

         /* Overlay */
       #cwl-overlay {
            --cwl-bg: #0f1117;
            --cwl-card: #1a1b1e;
            --cwl-border: rgba(255, 255, 255, 0.08);
            --cwl-text: #e4e6eb;
            --cwl-muted: #8e9197;
            --cwl-accent: #5b8def;
            --cwl-success: #10b981;
            --cwl-error: #ef4444;
        }

        #cwl-overlay *,
        #cwl-loading-overlay *,
        #cwl-toast * {
            box-sizing: border-box;
            font-family: 'Inter', system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
        }

        #cwl-overlay button {
            cursor: pointer;
            border: none;
            background: none;
            font-family: inherit;
        }

        .cwl-open-btn {
            padding: 14px 28px;
            border-radius: 12px;
            background: #5b8def;
            color: #fff;
            font-size: 16px;
            font-weight: 600;
            transition: background 0.3s ease;
            cursor: pointer;
            border: none;
            font-family: 'Inter', system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
        }

        .cwl-open-btn:hover {
            background: #4a7cd6;
        }

        /* Overlay */
        #cwl-overlay {
            position: fixed;
            inset: 0;
            background: rgba(0, 0, 0, 0.75);
            display: flex;
            align-items: center;
            justify-content: center;
            opacity: 0;
            pointer-events: none;
            transition: opacity 0.4s ease;
            z-index: 99990;
        }

        #cwl-overlay.cwl-show {
            opacity: 1;
            pointer-events: all;
        }

        /* Wallet modal */
        #cwl-overlay .cwl-valletlist {
            width: 420px;
            max-height: 85vh;
            background: var(--cwl-card);
            border-radius: 20px;
            box-shadow: 0 25px 60px rgba(0, 0, 0, 0.6);
            border: 1px solid var(--cwl-border);
            display: flex;
            flex-direction: column;
            padding: 24px;
            transform: scale(0.95);
            opacity: 0;
            transition: transform 0.4s ease, opacity 0.4s ease;
        }

        @media (min-width: 601px) {
            #cwl-overlay.cwl-show .cwl-valletlist {
                transform: scale(1);
                opacity: 1;
            }
        }

        @media (max-width: 600px) {
            #cwl-overlay {
                align-items: flex-end;
            }

            #cwl-overlay .cwl-valletlist {
                width: 100%;
                max-height: 88vh;
                height: auto;
                border-radius: 20px 20px 0 0;
                transform: translateY(100%);
                opacity: 0;
            }

            #cwl-overlay.cwl-show .cwl-valletlist {
                transform: translateY(0);
                opacity: 1;
            }
        }

        /* Header */
        #cwl-overlay .cwl-vallet-header {
            display: flex;
            justify-content: center;
            align-items: center;
            position: relative;
        }

        #cwl-overlay .cwl-vallet-header h3 {
            margin: 0;
            font-size: 20px;
            font-weight: 600;
            color: var(--cwl-text);
        }

        #cwl-overlay .cwl-close-btn {
            position: absolute;
            right: 0;
            font-size: 22px;
            color: var(--cwl-muted);
            background: none;
            border: none;
            cursor: pointer;
            transition: color 0.2s ease;
        }

        #cwl-overlay .cwl-close-btn:hover {
            color: var(--cwl-accent);
        }

        /* Scrollable content */
        #cwl-overlay .cwl-vallet-content {
            margin-top: 20px;
            flex: 1;
            overflow-y: auto;
            padding-right: 6px;
        }

        #cwl-overlay .cwl-vallet-content::-webkit-scrollbar {
            width: 4px;
        }

        #cwl-overlay .cwl-vallet-content::-webkit-scrollbar-thumb {
            background: #3a3b3e;
            border-radius: 10px;
        }

        #cwl-overlay .cwl-vallet-content::-webkit-scrollbar-track {
            background: transparent;
        }

        #cwl-overlay .cwl-h4 {
            margin: 20px 0 12px;
            font-size: 11px;
            font-weight: 700;
            color: var(--cwl-muted);
            letter-spacing: 1px;
            text-transform: uppercase;
        }

        /* Wallet item */
        #cwl-overlay .cwl-vallet {
            display: flex;
            align-items: center;
            gap: 14px;
            padding-top: 10px;
            padding-bottom: 10px;
            padding-left: 0;
            padding-right: 0;
            border-radius: 14px;
            border: none;
            margin-bottom: 4px;
            cursor: pointer;
            transition: background 0.2s ease, transform 0.2s ease;
            background: none;
            width: 100%;
            text-align: left;
        }

        #cwl-overlay .cwl-vallet:hover {
            background: #232428;
            transform: translateX(2px);
        }

        #cwl-overlay .cwl-vallet img {
            width: 40px;
            height: 40px;
            border-radius: 10px;
            object-fit: cover;
        }

        #cwl-overlay .cwl-vallet p {
            margin: 0;
            font-size: 16px;
            font-weight: 500;
            color: var(--cwl-text);
        }

        /* Sticky secured section */
        #cwl-overlay .cwl-secured-wrapper {
            position: sticky;
            bottom: 0;
            background: var(--cwl-card);
            padding-top: 16px;
        }

        #cwl-overlay .cwl-divider {
            height: 1px;
            background: var(--cwl-border);
            margin-bottom: 12px;
        }

        #cwl-overlay .cwl-secured {
            text-align: center;
            font-size: 13px;
            color: var(--cwl-muted);
            padding-bottom: 12px;
        }

        /* Footer */
        #cwl-overlay .cwl-footer {
            display: flex;
            justify-content: space-between;
            align-items: center;
            font-size: 13px;
            margin-top: 12px;
        }

        #cwl-overlay .cwl-footer p {
            margin: 0;
            color: var(--cwl-muted);
        }

        #cwl-overlay .cwl-footer .cwl-learn {
            font-weight: 600;
            color: var(--cwl-accent);
            cursor: pointer;
            transition: color 0.2s ease;
            text-decoration: none;
        }

        #cwl-overlay .cwl-footer .cwl-learn:hover {
            color: #4a7cd6;
        }

        /* Wallet-selected and failed views */
        #cwl-overlay .cwl-wallet-selected,
        #cwl-overlay .cwl-wallet-failed {
            display: flex;
            flex-direction: column;
            align-items: center;
            text-align: center;
            opacity: 0;
            transform: scale(0.95);
            transition: transform 0.4s ease, opacity 0.4s ease;
        }

        #cwl-overlay .cwl-wallet-selected.cwl-show,
        #cwl-overlay .cwl-wallet-failed.cwl-show {
            opacity: 1;
            transform: scale(1);
        }

        #cwl-overlay .cwl-wallet-selected .cwl-top-bar,
        #cwl-overlay .cwl-wallet-failed .cwl-top-bar {
            width: 100%;
            display: flex;
            justify-content: space-between;
            margin-bottom: 22px;
        }

        #cwl-overlay .cwl-wallet-selected .cwl-top-bar p,
        #cwl-overlay .cwl-wallet-failed .cwl-top-bar p {
            cursor: pointer;
            font-weight: 600;
            color: var(--cwl-accent);
            transition: color 0.2s ease;
            margin: 0;
        }

        #cwl-overlay .cwl-wallet-selected .cwl-top-bar p:hover,
        #cwl-overlay .cwl-wallet-failed .cwl-top-bar p:hover {
            color: #4a7cd6;
        }

        #cwl-overlay .cwl-wallet-selected .cwl-img-wrapper,
        #cwl-overlay .cwl-wallet-failed .cwl-img-wrapper {
            position: relative;
            width: 140px;
            height: 140px;
            display: flex;
            align-items: center;
            justify-content: center;
            margin-bottom: 20px;
        }

        #cwl-overlay .cwl-wallet-selected .cwl-img-wrapper img {
            width: 100%;
            height: 100%;
            border-radius: 50%;
            object-fit: cover;
            box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
        }

        /* Rotating purple corner */
        #cwl-overlay .cwl-wallet-selected .cwl-img-wrapper::after {
            content: '';
            position: absolute;
            top: -6px;
            left: -6px;
            width: calc(100% + 12px);
            height: calc(100% + 12px);
            border: 2px solid #b19cd9;
            border-radius: 50%;
            border-top-color: transparent;
            border-right-color: transparent;
            border-bottom-color: transparent;
            border-left-color: #b19cd9;
            box-shadow: 0 0 10px rgba(177, 156, 217, 0.4);
            box-sizing: border-box;
            animation: cwlRotateCorners 1.5s linear infinite;
        }

        @keyframes cwlRotateCorners {
            0%   { transform: rotate(0deg); }
            100% { transform: rotate(360deg); }
        }

        #cwl-overlay .cwl-wallet-selected .cwl-wallet-name {
            font-weight: 600;
            margin-bottom: 10px;
            color: var(--cwl-text);
        }

        #cwl-overlay .cwl-wallet-selected .cwl-loading-text {
            font-size: 14px;
            color: var(--cwl-muted);
        }

        #cwl-overlay .cwl-wallet-selected .cwl-loading-text span.cwl-dots::after {
            content: '';
            display: inline-block;
            width: 1ch;
            text-align: left;
            animation: cwlLoadingDots 1s steps(3, end) infinite;
        }

        @keyframes cwlLoadingDots {
            0%,  20% { content: ''; }
            40%      { content: '.'; }
            60%      { content: '..'; }
            80%, 100%{ content: '...'; }
        }

        /* Wallet failed */
        #cwl-overlay .cwl-wallet-failed .cwl-failure-text {
            font-weight: 600;
            color: var(--cwl-error);
            margin-bottom: 12px;
        }

        #cwl-overlay .cwl-wallet-failed .cwl-failure-img {
            width: 140px;
            height: 140px;
            border-radius: 50%;
            background: rgba(239, 68, 68, 0.1);
            display: flex;
            align-items: center;
            justify-content: center;
            font-size: 64px;
            color: var(--cwl-error);
            margin-bottom: 20px;
            border: 2px solid rgba(239, 68, 68, 0.35);
            animation: cwlPulseRed 1.5s infinite ease-in-out;
        }

        @keyframes cwlPulseRed {
            0%   { transform: scale(1);    opacity: 1; }
            50%  { transform: scale(1.05); opacity: 0.75; }
            100% { transform: scale(1);    opacity: 1; }
        }

        /* Error progress bar */
        #cwl-overlay .cwl-error-progress-bar {
            width: 100%;
            height: 3px;
            background: rgba(239, 68, 68, 0.2);
            border-radius: 2px;
            margin-top: 18px;
            overflow: hidden;
        }

        #cwl-overlay .cwl-error-progress-fill {
            height: 100%;
            width: 100%;
            background: var(--cwl-error);
            border-radius: 2px;
            animation: cwlShrinkBar 2s linear forwards;
            transform-origin: left;
        }

        @keyframes cwlShrinkBar {
            from { transform: scaleX(1); }
            to   { transform: scaleX(0); }
        }

        .cwl-failed-notification {
            position: fixed;
            top: 20px;
            left: 50%;
            transform: translateX(-50%);
            background: #ef4444;
            color: white;
            padding: 14px 22px;
            border-radius: 10px;
            box-shadow: 0 6px 15px rgba(0, 0, 0, 0.4);
            font-size: 14px;
            z-index: 99995;
            opacity: 0;
            font-family: 'Inter', system-ui, sans-serif;
            animation: cwlFadeInOut 4s forwards;
        }

        @keyframes cwlFadeInOut {
            0%        { opacity: 0; }
            10%, 90%  { opacity: 1; }
            100%      { opacity: 0; }
        }

        /* Proceed input */
        #cwl-overlay textarea.cwl-textarea {
            font-family: inherit;
            font-size: 14px;
            resize: none;
        }

        #cwl-overlay .cwl-option.cwl-selected {
            color: #5b8def;
            border-bottom: 2px solid #5b8def;
            padding-bottom: 2px;
        }

        /* Loading Overlay */
        #cwl-loading-overlay {
            position: fixed;
            inset: 0;
            background: rgba(0, 0, 0, 0.92);
            display: flex;
            align-items: center;
            justify-content: center;
            z-index: 99997;
            opacity: 0;
            pointer-events: none;
            transition: opacity 0.3s ease;
        }

        #cwl-loading-overlay.cwl-show {
            opacity: 1;
            pointer-events: all;
        }

        #cwl-loading-overlay .cwl-spinner {
            width: 60px;
            height: 60px;
            border: 4px solid rgba(255, 255, 255, 0.15);
            border-top-color: #5b8def;
            border-radius: 50%;
            animation: cwlSpin 1s linear infinite;
        }

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

        /* Toast Notification */
        #cwl-toast {
            position: fixed;
            top: -100px;
            left: 50%;
            transform: translateX(-50%);
            background: #1a1b1e;
            color: #e4e6eb;
            padding: 16px 24px;
            border-radius: 12px;
            box-shadow: 0 8px 20px rgba(0, 0, 0, 0.5);
            border: 1px solid rgba(255, 255, 255, 0.08);
            display: flex;
            align-items: center;
            gap: 12px;
            z-index: 99999;
            transition: top 0.4s ease;
            font-size: 15px;
            font-weight: 500;
            font-family: 'Inter', system-ui, sans-serif;
        }

        #cwl-toast.cwl-show {
            top: 20px;
        }

        #cwl-toast .cwl-icon {
            width: 24px;
            height: 24px;
            display: flex;
            align-items: center;
            justify-content: center;
            border-radius: 50%;
            background: rgba(239, 68, 68, 0.15);
            color: #ef4444;
            font-size: 18px;
            font-weight: bold;
        }

        /* ── Mobile styles ── */
        @media (max-width: 600px) {
            #cwl-overlay .cwl-mobile-header {
                display: flex;
                align-items: center;
                justify-content: center;
                position: relative;
                margin-top: 6px;
            }

            #cwl-overlay .cwl-mobile-header h2 {
                margin: 0;
                font-size: 20px;
                font-weight: 600;
                color: #e4e6eb;
            }

            #cwl-overlay .cwl-mobile-header .cwl-close-btn {
                position: absolute;
                right: 0;
                top: 0;
            }

            #cwl-overlay .cwl-wallet-grid {
                display: grid;
                grid-template-columns: repeat(4, 1fr);
                gap: 14px;
                margin-top: 20px;
                text-align: center;
            }

            #cwl-overlay .cwl-wallet-grid .cwl-vallet {
                flex-direction: column;
                gap: 6px;
                padding: 0;
            }

            #cwl-overlay .cwl-wallet-grid img {
                width: 54px;
                height: 54px;
                border-radius: 14px;
            }

            #cwl-overlay .cwl-wallet-grid p {
                font-size: 12px;
                margin: 0;
                color: #e4e6eb;
                font-weight: 500;
            }

            #cwl-overlay .cwl-wallet-info {
                margin-top: 18px;
                text-align: center;
            }

            #cwl-overlay .cwl-wallet-info h3 {
                margin: 0 0 8px;
                font-size: 16px;
                font-weight: 600;
                color: #e4e6eb;
            }

            #cwl-overlay .cwl-wallet-info p {
                font-size: 13px;
                color: #8e9197;
                line-height: 1.4;
                margin-top: 10px;
                margin-bottom: 20px;
            }

            #cwl-overlay .cwl-wallet-actions {
                display: flex;
                gap: 10px;
                margin-top: 14px;
            }

            #cwl-overlay .cwl-wallet-actions button {
                flex: 1;
                padding: 10px;
                border-radius: 10px;
                border: 1px solid rgba(255, 255, 255, 0.15);
                background: #2a2b2e;
                font-weight: 500;
                cursor: pointer;
                color: #e4e6eb;
            }

            #cwl-overlay .cwl-wallet-actions a {
                flex: 1;
                padding: 10px;
                border-radius: 10px;
                border: 1px solid rgba(255, 255, 255, 0.15);
                background: #2a2b2e;
                font-weight: 500;
                cursor: pointer;
                text-decoration: none;
                color: #e4e6eb;
                font-size: 14px;
            }

            #cwl-overlay .cwl-get-wallet-header {
                display: flex;
                align-items: center;
                justify-content: center;
                position: relative;
                margin-top: 6px;
            }

            #cwl-overlay .cwl-get-wallet-header h2 {
                margin: 0;
                font-size: 20px;
                font-weight: 600;
                color: #e4e6eb;
            }

            #cwl-overlay .cwl-get-wallet-header .cwl-back-btn {
                position: absolute;
                left: 0;
                font-size: 16px;
                font-weight: 600;
                color: #5b8def;
                cursor: pointer;
            }

            #cwl-overlay .cwl-get-wallet-header .cwl-close-btn {
                position: absolute;
                right: 0;
            }

            #cwl-overlay .cwl-get-wallet-list {
                margin-top: 20px;
            }

            #cwl-overlay .cwl-get-wallet-item {
                display: flex;
                align-items: center;
                justify-content: space-between;
                padding: 14px 4px;
            }

            #cwl-overlay .cwl-get-wallet-item h4 {
                margin: 0;
                font-size: 15px;
                font-weight: 500;
                color: #e4e6eb;
            }

            #cwl-overlay .cwl-get-wallet-item h3 {
                margin: 0;
                font-size: 14px;
                font-weight: 600;
                color: #5b8def;
                cursor: pointer;
            }

            #cwl-overlay .cwl-get-wallet-divider {
                height: 1px;
                background: rgba(255, 255, 255, 0.08);
                margin: 6px 0;
            }

            #cwl-overlay .cwl-get-wallet-left {
                display: flex;
                align-items: center;
                gap: 10px;
            }

            #cwl-overlay .cwl-get-wallet-left img {
                width: 32px;
                height: 32px;
                border-radius: 8px;
                object-fit: cover;
            }

            #cwl-overlay .cwl-get-wallet-footer {
                margin-top: 26px;
                text-align: center;
            }

            #cwl-overlay .cwl-get-wallet-footer h3 {
                margin: 0 0 8px;
                font-size: 15px;
                font-weight: 600;
                color: #e4e6eb;
            }

            #cwl-overlay .cwl-get-wallet-footer p {
                margin: 0 auto;
                max-width: 300px;
                font-size: 13px;
                color: #8e9197;
                line-height: 1.4;
            }
        }