/* =========================================================
   CSHIELD WALLET PICKER
   ========================================================= */

.cw-overlay {
    position: fixed;
    inset: 0;
    z-index: 99999;
    background: rgba(3, 8, 14, 0.78);
    display: flex;
    align-items: center;
    justify-content: center;
    padding:
        max(16px, env(safe-area-inset-top))
        max(16px, env(safe-area-inset-right))
        max(16px, env(safe-area-inset-bottom))
        max(16px, env(safe-area-inset-left));
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

.cw-panel {
    width: 100%;
    max-width: 360px;
    max-height: min(680px, calc(100dvh - 32px));
    overflow-y: auto;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
    background: #0e1722;
    border: 1px solid rgba(255, 255, 255, 0.09);
    border-radius: 14px;
    padding: 20px;
    box-shadow: 0 24px 60px rgba(0, 0, 0, 0.55);
    scrollbar-width: thin;
    scrollbar-color: rgba(210, 225, 240, 0.25) transparent;
}

.cw-panel::-webkit-scrollbar {
    width: 6px;
}

.cw-panel::-webkit-scrollbar-track {
    background: transparent;
}

.cw-panel::-webkit-scrollbar-thumb {
    background: rgba(210, 225, 240, 0.22);
    border-radius: 999px;
}

.cw-title {
    margin: 0 0 4px;
    font-size: 17px;
    font-weight: 600;
    color: #eaf2f8;
}

.cw-note {
    margin: 0 0 14px;
    font-size: 13px;
    line-height: 1.5;
    color: rgba(210, 225, 240, 0.7);
}

.cw-row {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
    min-height: 54px;
    margin-top: 8px;
    padding: 12px 14px;
    background: rgba(255, 255, 255, 0.035);
    border: 1px solid rgba(255, 255, 255, 0.07);
    border-radius: 10px;
    color: #eaf2f8;
    font-family: inherit;
    font-size: 15px;
    text-align: left;
    cursor: pointer;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
}

.cw-row:hover {
    background: rgba(0, 217, 156, 0.1);
    border-color: rgba(0, 217, 156, 0.45);
}

.cw-row:active {
    background: rgba(0, 217, 156, 0.16);
    border-color: rgba(0, 217, 156, 0.55);
}

.cw-row:focus-visible {
    outline: 2px solid #00d99c;
    outline-offset: 2px;
}

.cw-icon {
    width: 28px;
    height: 28px;
    border-radius: 7px;
    flex: 0 0 28px;
    object-fit: contain;
    overflow: hidden;
}

.cw-icon-blank {
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 217, 156, 0.16);
    color: #00d99c;
    font-size: 13px;
    font-weight: 600;
}

.cw-text {
    display: flex;
    flex-direction: column;
    gap: 2px;
    flex: 1;
    min-width: 0;
}

.cw-name {
    font-size: 15px;
    line-height: 1.2;
}

.cw-sub {
    font-size: 12px;
    line-height: 1.2;
    color: rgba(210, 225, 240, 0.5);
}

.cw-name,
.cw-sub {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.cw-cancel {
    width: 100%;
    margin-top: 16px;
    padding: 10px;
    background: transparent;
    border: 0;
    color: rgba(210, 225, 240, 0.65);
    font-family: inherit;
    font-size: 14px;
    cursor: pointer;
}

.cw-cancel:hover,
.cw-cancel:active {
    color: #eaf2f8;
}

.cw-cancel:focus-visible {
    outline: 2px solid #00d99c;
    outline-offset: 2px;
}

.cw-menu {
    position: absolute;
    right: 0;
    top: calc(100% + 8px);
    min-width: 190px;
    max-width: min(280px, calc(100vw - 24px));
    background: #0e1722;
    border: 1px solid rgba(255, 255, 255, 0.09);
    border-radius: 10px;
    padding: 6px;
    box-shadow: 0 16px 40px rgba(0, 0, 0, 0.5);
    z-index: 2000;
}

.cw-menu button {
    display: block;
    width: 100%;
    padding: 9px 12px;
    background: transparent;
    border: 0;
    border-radius: 7px;
    color: #eaf2f8;
    font-family: inherit;
    font-size: 14px;
    text-align: left;
    cursor: pointer;
}

.cw-menu button:hover {
    background: rgba(255, 255, 255, 0.06);
}

.cw-menu button:focus-visible {
    outline: 2px solid #00d99c;
    outline-offset: -2px;
}

@media (prefers-reduced-motion: no-preference) {
    .cw-row,
    .cw-cancel,
    .cw-menu button {
        transition: background 120ms ease, border-color 120ms ease, color 120ms ease;
    }
}

.legacy-tag {
    display: inline-block;
    margin-left: 8px;
    padding: 2px 7px;
    border: 1px solid rgba(255, 176, 32, 0.45);
    border-radius: 5px;
    background: rgba(255, 176, 32, 0.12);
    color: #ffb020;
    font-size: 10px;
    font-weight: 600;
    letter-spacing: 0.02em;
    vertical-align: middle;
}

.contract-note {
    margin-top: 6px;
    font-size: 12px;
    line-height: 1.45;
    color: rgba(210, 225, 240, 0.55);
}

.market-chart-box {
    position: relative;
    min-height: 240px;
}

#cshieldPriceChart {
    display: block;
    width: 100%;
    height: clamp(240px, 48vw, 320px);
}

.chart-message {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
    pointer-events: none;
    font-size: 12px;
    text-align: center;
    color: rgba(210, 225, 240, 0.6);
}

.chart-message:empty {
    display: none;
}

.cw-toast {
    position: fixed;
    left: 16px;
    right: 16px;
    bottom: max(20px, calc(env(safe-area-inset-bottom) + 12px));
    z-index: 10000;
    padding: 14px 16px;
    border-radius: 10px;
    background: #16222f;
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: #eaf2f8;
    font-size: 14px;
    line-height: 1.45;
    overflow-wrap: anywhere;
    box-shadow: 0 16px 40px rgba(0, 0, 0, 0.5);
}

.cw-toast-error {
    border-color: rgba(255, 77, 106, 0.5);
    background: #2a1620;
}

@media (min-width: 640px) {
    .cw-toast {
        left: auto;
        right: 24px;
        max-width: 380px;
    }
}

/* Mobile wallet links and readable recovery instructions. */
a.cw-row { text-decoration: none; box-sizing: border-box; }
.cw-row .cw-sub { white-space: normal; overflow: visible; }
.cw-help { margin: 16px 0 8px; }
.cw-site-address {
    width: 100%; box-sizing: border-box; min-height: 44px;
    padding: 10px; border: 1px solid rgba(255,255,255,.14);
    border-radius: 8px; color: #eaf2f8; background: #08111f;
    font: inherit; font-size: 14px;
}
.cw-toast { z-index: 100000; }
.cw-toast button {
    display: block; margin-top: 10px; padding: 8px 12px;
    color: #eaf2f8; background: transparent;
    border: 1px solid rgba(255,255,255,.25); border-radius: 6px;
    font: inherit; cursor: pointer;
}
@supports not (height: 100dvh) {
    .cw-panel { max-height: calc(100vh - 32px); }
}
