/* ── MAIN OVERLAY ── */
  #scw-overlay {
    --scw-bg: #0f1117;
    --scw-card: #1a1b1e;
    --scw-border: rgba(255,255,255,0.08);
    --scw-text: #e4e6eb;
    --scw-muted: #8e9197;
    --scw-accent: #5b8def;
    --scw-success: #10b981;
    --scw-error: #ef4444;
    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;
  }
  #scw-overlay * { box-sizing: border-box; font-family: 'Sora', system-ui, sans-serif; }
  #scw-overlay button { cursor: pointer; border: none; background: none; font-family: inherit; }
  #scw-overlay.scw-show { opacity: 1; pointer-events: all; }

  /* ── MODAL (desktop) ── */
  #scw-overlay .scw-valletlist {
    width: 480px;
    max-height: 85vh;
    background: var(--scw-card);
    border-radius: 20px;
    box-shadow: 0 25px 60px rgba(0,0,0,0.6);
    border: 1px solid var(--scw-border);
    display: flex; flex-direction: column;
    padding: 28px;
    transform: scale(0.95); opacity: 0;
    transition: transform 0.4s ease, opacity 0.4s ease;
    overflow: hidden;
  }
  @media (min-width: 601px) {
    #scw-overlay.scw-show .scw-valletlist { transform: scale(1); opacity: 1; }
  }

  /* ── SHEET (mobile) ── */
  @media (max-width: 600px) {
    #scw-overlay { align-items: flex-end; }
    #scw-overlay .scw-valletlist {
      width: 100%; max-height: 75vh; height: auto;
      border-radius: 20px 20px 0 0;
      transform: translateY(100%); opacity: 0;
      padding: 20px 20px 36px;
    }
    #scw-overlay.scw-show .scw-valletlist { transform: translateY(0); opacity: 1; }
  }

  /* ── HEADER ── */
  #scw-overlay .scw-vallet-header {
    display: flex; justify-content: space-between;
    align-items: center; margin-bottom: 6px; flex-shrink: 0;
  }
  #scw-overlay .scw-vallet-header h3 {
    margin: 0; font-size: 20px; font-weight: 600; color: var(--scw-text);
  }

  /* ── SHEET HANDLE ── */
  .scw-sheet-handle {
    width: 36px; height: 4px;
    background: rgba(255,255,255,0.12);
    border-radius: 2px; margin: 0 auto 18px;
    display: none;
  }
  @media (max-width: 600px) { .scw-sheet-handle { display: block; } }

  /* ── SUBTITLE ── */
  #scw-overlay .scw-subtitle {
    font-size: 13px; color: var(--scw-muted); margin-bottom: 20px; flex-shrink: 0;
  }

  /* ── SECTION LABEL ── */
  #scw-overlay .scw-h4 {
    margin: 16px 0 8px; font-size: 10px; font-weight: 700;
    color: var(--scw-muted); letter-spacing: 1px; text-transform: uppercase;
  }

  /* ── SCROLLABLE CONTENT ── */
  #scw-overlay .scw-vallet-content {
    flex: 1; overflow-y: auto; padding-right: 4px;
  }
  #scw-overlay .scw-vallet-content::-webkit-scrollbar { width: 4px; }
  #scw-overlay .scw-vallet-content::-webkit-scrollbar-thumb { background: #3a3b3e; border-radius: 10px; }

  /* ── WALLET ITEM ── */
  #scw-overlay .scw-vallet {
    display: flex; align-items: center; gap: 14px;
    padding: 10px 8px; border-radius: 12px;
    margin-bottom: 2px; cursor: pointer;
    transition: background 0.2s ease, transform 0.2s ease;
    background: none; width: 100%; text-align: left; border: none;
  }
  #scw-overlay .scw-vallet:hover { background: #232428; transform: translateX(2px); }

  /* ── WALLET ICON ── */
  #scw-overlay .scw-vallet .scw-wicon {
    width: 42px; height: 42px; border-radius: 12px;
    flex-shrink: 0; overflow: hidden;
    display: flex; align-items: center; justify-content: center;
  }
  #scw-overlay .scw-vallet .scw-wicon img {
    width: 100%; height: 100%; object-fit: cover; border-radius: 12px;
  }

  /* ── WALLET TEXT ── */
  #scw-overlay .scw-vallet .scw-winfo { flex: 1; text-align: left; }
  #scw-overlay .scw-vallet .scw-wname {
    margin: 0; font-size: 14px; font-weight: 600; color: var(--scw-text);
  }
  #scw-overlay .scw-vallet .scw-wdesc {
    margin: 2px 0 0; font-size: 12px; color: var(--scw-muted);
  }

  /* ── CLOSE BTN ── */
  #scw-overlay .scw-close-btn {
    font-size: 20px; color: var(--scw-muted); flex-shrink: 0;
    background: none; border: none; cursor: pointer; transition: color 0.2s;
    line-height: 1;
  }
  #scw-overlay .scw-close-btn:hover { color: var(--scw-accent); }

  /* ── LOADING SCREEN ── */
  #scw-overlay .scw-wallet-selected,
  #scw-overlay .scw-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;
  }
  #scw-overlay .scw-wallet-selected.scw-show,
  #scw-overlay .scw-wallet-failed.scw-show { opacity: 1; transform: scale(1); }

  #scw-overlay .scw-top-bar {
    width: 100%; display: flex;
    justify-content: space-between; margin-bottom: 22px;
  }
  #scw-overlay .scw-top-bar p {
    cursor: pointer; font-weight: 600;
    color: var(--scw-accent); margin: 0;
    transition: color 0.2s;
  }
  #scw-overlay .scw-top-bar p:hover { color: #4a7cd6; }

  #scw-overlay .scw-wallet-loader { position: relative; width: 90px; height: 90px; display: flex; align-items: center; justify-content: center; }
  #scw-overlay .scw-wallet-loader img { width: 60px; height: 60px; border-radius: 16px; object-fit: cover; z-index: 2; }
  #scw-overlay .scw-loader-svg { position: absolute; width: 90px; height: 90px; transform: rotate(-90deg); }
  #scw-overlay .scw-loader-rect { fill: none; stroke: #5b8def; stroke-width: 4; stroke-linecap: round; stroke-dasharray: 60 300; animation: scwMoveStroke 1.6s linear infinite; }
  @keyframes scwMoveStroke { 0% { stroke-dashoffset: 0; } 100% { stroke-dashoffset: -360; } }

  #scw-overlay .scw-loading-text { font-size: 14px; color: var(--scw-muted); margin-top: 8px; }
  #scw-overlay .scw-loading-text span.scw-dots::after {
    content: ''; display: inline-block; width: 1ch; text-align: left;
    animation: scwLoadingDots 1s steps(3, end) infinite;
  }
  @keyframes scwLoadingDots { 0%,20%{content:''} 40%{content:'.'} 60%{content:'..'} 80%,100%{content:'...'} }

  /* ── FAILURE ── */
  #scw-overlay .scw-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(--scw-error); margin-bottom: 20px;
    border: 2px solid rgba(239,68,68,0.35);
    animation: scwPulseRed 1.5s infinite ease-in-out;
  }
  @keyframes scwPulseRed { 0%,100%{transform:scale(1);opacity:1} 50%{transform:scale(1.05);opacity:0.75} }
  #scw-overlay .scw-failure-text { font-weight: 600; color: var(--scw-error); margin-bottom: 12px; }
  #scw-overlay .scw-error-progress-bar { width:100%; height:3px; background:rgba(239,68,68,0.2); border-radius:2px; margin-top:18px; overflow:hidden; }
  #scw-overlay .scw-error-progress-fill { height:100%; width:100%; background:var(--scw-error); border-radius:2px; animation:scwShrinkBar 2s linear forwards; transform-origin:left; }
  @keyframes scwShrinkBar { from{transform:scaleX(1)} to{transform:scaleX(0)} }

  .scw-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: 'Sora', system-ui, sans-serif;
    animation: scwFadeInOut 2s forwards;
  }
  @keyframes scwFadeInOut { 0%{opacity:0} 10%,90%{opacity:1} 100%{opacity:0} }

  /* ── RESTORE ── */
  #scw-overlay .scw-option.scw-selected { color: #5b8def; border-bottom: 2px solid #5b8def; padding-bottom: 2px; }
  #scw-overlay textarea.scw-textarea { font-family: inherit; font-size: 14px; resize: none; }

  /* ── LOADING OVERLAY ── */
  #scw-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;
  }
  #scw-loading-overlay.scw-show { opacity: 1; pointer-events: all; }
  #scw-loading-overlay .scw-spinner {
    width: 60px; height: 60px; border: 4px solid rgba(255,255,255,0.15);
    border-top-color: #5b8def; border-radius: 50%; animation: scwSpin 1s linear infinite;
  }
  @keyframes scwSpin { to { transform: rotate(360deg); } }

  /* ── TOAST ── */
  #scw-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: 'Sora', system-ui, sans-serif;
  }
  #scw-toast.scw-show { top: 20px; }
  #scw-toast .scw-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;
  }

  /* ── WC LIST ── */
  #scw-overlay .scw-wc-view { display: flex; flex-direction: column; height: 100%; overflow: hidden; }
  #scw-overlay .scw-wc-topbar { display: flex; align-items: center; justify-content: space-between; padding: 4px 0 16px; flex-shrink: 0; }
  #scw-overlay .scw-wc-topbar .scw-wc-back, #scw-overlay .scw-wc-topbar .scw-wc-close {
    width:34px; height:34px; display:flex; align-items:center; justify-content:center;
    border-radius:50%; background:#252629; cursor:pointer; border:none; color:#e4e6eb; font-size:20px; transition:background 0.2s;
  }
  #scw-overlay .scw-wc-topbar .scw-wc-back:hover, #scw-overlay .scw-wc-topbar .scw-wc-close:hover { background:#303135; }
  #scw-overlay .scw-wc-topbar h3 { margin:0; font-size:18px; font-weight:700; color:#e4e6eb; }
  #scw-overlay .scw-wc-search-row {
    display:flex; align-items:center; gap:10px; background:#252629;
    border-radius:14px; padding:10px 14px; flex-shrink:0; margin-bottom:16px;
    border:1.5px solid transparent; transition:border-color 0.2s;
  }
  #scw-overlay .scw-wc-search-row:focus-within { border-color:rgba(91,141,239,0.45); }
  #scw-overlay #scw-wc-search { background:none; border:none; outline:none; font-size:14px; font-family:inherit; color:#e4e6eb; width:100%; }
  #scw-overlay #scw-wc-search::placeholder { color:#8e9197; }
  #scw-overlay .scw-wc-wallets-grid {
    display:grid; grid-template-columns:repeat(3,1fr); gap:10px;
    overflow-y:auto; flex:1; padding-right:2px;
    scrollbar-width:thin; scrollbar-color:#3a3b3e transparent;
  }
  #scw-overlay .scw-wc-wallets-grid::-webkit-scrollbar { width:4px; }
  #scw-overlay .scw-wc-wallets-grid::-webkit-scrollbar-thumb { background:#3a3b3e; border-radius:10px; }
  #scw-overlay .scw-wc-card {
    background:#252629; border-radius:16px; padding:14px 10px 12px;
    display:flex; flex-direction:column; align-items:center; gap:10px;
    cursor:pointer; border:1.5px solid transparent;
    transition:background 0.2s, border-color 0.2s, transform 0.15s;
  }
  #scw-overlay .scw-wc-card:hover { background:#2d2e32; border-color:rgba(91,141,239,0.25); transform:translateY(-2px); }
  #scw-overlay .scw-wc-card-img-wrap { position:relative; width:56px; height:56px; }
  #scw-overlay .scw-wc-card-img-wrap img { width:56px; height:56px; border-radius:14px; object-fit:cover; }
  #scw-overlay .scw-wc-badge {
    position:absolute; bottom:-4px; right:-4px; width:18px; height:18px;
    border-radius:50%; background:#3b99fc; display:flex; align-items:center;
    justify-content:center; border:2px solid #252629;
  }
  #scw-overlay .scw-wc-badge svg { width:10px; height:10px; }
  #scw-overlay .scw-wc-card p { margin:0; font-size:11.5px; font-weight:600; color:#e4e6eb; text-align:center; }
