/* Global base styles */
:root {
    /* Black & Gold palette */
    --bg: #0b0c10;
    --fg: #ececec;
    --muted: #a0a6b0;
    --card: #121419;
    --line: rgba(255, 255, 255, .08);
    --nav-bg: rgba(17, 18, 24, .7);
    --accent: #f5ce66;
    --primary: #0f0f12;
    --shadow: 0 12px 30px rgba(0, 0, 0, .55);
    --radius: 16px;
    --radius-sm: 12px;
    --pad: 16px;
    --nav-h: 72px;
    --tap: 44px;

    --surface-2: #0f1115;
    --gold-grad: linear-gradient(180deg, #f7e28b 0%, #e7c85a 100%);
    --red-grad: linear-gradient(180deg, #e74c3c 0%, #9a3127 100%);
    --grey-grad: linear-gradient(180deg, #a0a6b0 0%, #686c73 100%);
}

* {
    box-sizing: border-box;
}

html, body {
    height: 100%;
}

/* ========== Base / layout ========== */
body {
    margin: 0;
    font: 16px/1.4 -apple-system, BlinkMacSystemFont, Segoe UI, Roboto, Inter, Arial, sans-serif;
    color: var(--fg);
    /* black gradient background */
    background: var(--bg);
    -webkit-font-smoothing: antialiased;
    /*-moz-osx-font-smoothing: grayscale;*/
}

.app {
    min-height: 100dvh;
    padding-bottom: calc(var(--nav-h) + env(safe-area-inset-bottom));
}

.content {
    padding: 20px 16px 24px;
    max-width: 560px;
    margin: 0 auto;
}

.page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.page-header h1 {
    margin: 8px 0 12px;
    font-size: 24px;
    letter-spacing: -0.02em;
}

.page-header-with-action {
    align-items: center;
}

/* ========== Buttons ========== */
.btn {
    align-items: center;
    height: var(--tap);
    padding: 0 14px;
    border-radius: 12px;
    border: 1px solid var(--line);
    background: var(--surface-2, #0f1115);
    color: var(--fg);
    font-weight: 600;
    cursor: pointer;
    box-shadow: 0 8px 20px rgba(0, 0, 0, .4);
}

.btn.primary {
    background: var(--gold-grad, linear-gradient(180deg, #f7e28b 0%, #e7c85a 100%));
    color: #101114;
    border-color: transparent;
    text-shadow: 0 1px 0 rgba(255, 255, 255, .25);
}

.btn:disabled {
    opacity: .6;
    cursor: not-allowed;
}

.btn .plus {
    font-size: 20px;
    margin-right: 6px;
}

.btn.danger {
    background: var(--red-grad);
}

.btn.primary.danger {
    background: var(--red-grad);
    color: #fff;
    border-color: transparent;
    text-shadow: 0 1px 0 rgba(255, 255, 255, .25);
}

/* ========== Dividers / search ========== */
.divider {
    border: 0;
    border-top: 1px solid var(--line);
    margin: 12px 0 16px;
}

.search-wrap {
    margin-bottom: 15px;
}

.search-wrap input[type=search] {
    width: 100%;
    height: 44px;
    border-radius: 12px;
    border: 1px solid var(--line);
    padding: 0 14px;
    background: var(--surface-2, #0f1115);
    color: var(--fg);
    outline: none;
}

.search-wrap input::placeholder {
    color: #848a94;
}

/* ========== Lists / cards ========== */
.list {
    width: 100%;
}

.list .row {
    display: grid;
    grid-template-columns: 48px minmax(0, 1fr) max-content;
    align-items: center;
    gap: 12px;
    padding: 12px;
    border: 1px solid var(--line);
    background: var(--card);
    border-radius: var(--radius);
    box-shadow: 0 10px 28px rgba(0, 0, 0, .45);
    margin: 6px 0;
}

.list .row > * {
    min-width: 0;
}

.list .row .badge {
    width: 40px;
    height: 40px;
    flex: 0 0 40px;
    border-radius: 12px;
    display: grid;
    place-items: center;
    overflow: hidden;
    background: #1e232d;
    color: #e7ebf0;
    font-weight: 700;
}

.list .row .badge .asset-ico {
    width: 100%;
    height: 100%;
    object-fit: contain;
    display: block;
    padding: 0;
}

.asset-meta .title {
    font-weight: 700;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.asset-meta .sub {
    font-size: 13px;
    color: var(--muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.right {
    text-align: right;
    font-variant-numeric: tabular-nums;
    color: #f7f8fa;
}

.empty {
    text-align: center;
    color: var(--muted);
    margin-top: 48px;
}

.empty .circle-ico {
    width: 64px;
    height: 64px;
    margin: 0 auto 8px;
    border-radius: 50%;
    background: #1e232d;
    display: grid;
    place-items: center;
    color: #9aa2af;
}

.amount-block {
    justify-self: end;
    text-align: right;
    font-variant-numeric: tabular-nums;
}

/* ========== Modal ========== */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, .45);
    backdrop-filter: blur(8px);
    z-index: 998;

}

.modal {
    position: fixed;
    inset: 0;
    display: grid;
    place-items: end center;
    padding: 20px;
    z-index: 999;
}

.modal .modal-text {
    margin: 8px 0 14px;
    color: var(--muted);
}

.modal-card {
    width: 100%;
    max-width: 560px;
    background: var(--card);
    color: var(--fg);
    border: 1px solid var(--line);
    border-radius: 20px;
    padding: 16px;
    box-shadow: 0 18px 40px rgba(0, 0, 0, .55);
}

.field {
    display: grid;
    gap: 8px;
    margin: 10px 0;
}

.field input {
    height: 44px;
    border-radius: 12px;
    border: 1px solid var(--line);
    padding: 0 12px;
    background: var(--surface-2, #0f1115);
    color: var(--fg);
}

.err {
    color: #ff7b7b;
    font-size: 13px;
}

.actions {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
    margin-top: 6px;
}

.hidden {
    display: none !important;
}

/* ========== Toast ========== */
.toast {
    position: fixed;
    left: 50%;
    bottom: calc(var(--nav-h) + 18px);
    transform: translateX(-50%);
    background: var(--gold-grad, linear-gradient(180deg, #f7e28b 0%, #e7c85a 100%));
    color: #101114;
    padding: 10px 14px;
    border-radius: 12px;
    box-shadow: 0 12px 32px rgba(0, 0, 0, .5);
    opacity: 0;
    pointer-events: none;
    transition: opacity .2s ease, transform .2s ease;
    font-size: 14px;
    z-index: 999;
}

.toast.show {
    opacity: 1;
    transform: translateX(-50%) translateY(-6px);
}

.portfolio-total {
    color: var(--muted);
    margin: 8px 0 12px;
}

.portfolio-total strong {
    color: var(--accent);
    font-weight: 800;
}

/* ========== Segmented pill navbar (bottom) ========== */
.seg-nav {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    background: transparent;
    display: grid;
    justify-items: center;
    padding: 8px 12px calc(8px + env(safe-area-inset-bottom));
    pointer-events: none;
}

.seg-wrap {
    pointer-events: auto;
    width: min(560px, 92vw);
    background: var(--nav-bg);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, .08);
    box-shadow: 0 10px 30px rgba(0, 0, 0, .55), 0 1px 0 rgba(255, 255, 255, .06) inset;
    border-radius: 999px;
    padding: 6px;
    display: flex;
    gap: 10px;
}

.seg-btn {
    height: 46px;
    border: 0;
    font-weight: 800;
    letter-spacing: .2px;
    color: #9aa2af;
    font-size: 12px;
    background: transparent;
    cursor: pointer;
    position: relative;
    z-index: 1;
    transition: color .18s ease;
    flex: 1 1 0;
    min-width: 0;
    display: grid;
    place-items: center;
    align-content: center;
    justify-content: center;
    white-space: nowrap;
    text-overflow: ellipsis;
    overflow: hidden;
}

.seg-ico {
    width: 20px;
    height: 20px;
    display: block;
    filter: brightness(0) saturate(100%) invert(62%) sepia(6%) saturate(0%) hue-rotate(180deg) brightness(92%) contrast(88%);
    opacity: .95;
    transition: filter .18s ease, opacity .18s ease, transform .18s ease;
    will-change: filter, opacity;
}

.seg-btn[aria-selected="true"] .seg-ico {
    filter: brightness(0) saturate(100%);
    opacity: 1;
    transform: translateY(-0.5px);
}

.seg-btn[aria-selected="true"] {
    color: #101114;
}

.seg-safe {
    height: 0;
}

/* sliding thumb (gold) */
.seg-wrap {
    position: relative;
}

.seg-thumb {
    position: absolute;
    top: 6px;
    left: 0;
    height: 46px;
    width: 50%;
    border-radius: 999px;
    background: var(--gold-grad, linear-gradient(180deg, #f7e28b 0%, #e7c85a 100%));
    box-shadow: 0 10px 22px rgba(0, 0, 0, .5), inset 0 -1px 0 rgba(15, 23, 42, .3);
    transition: transform .25s cubic-bezier(.2, .8, .2, 1), width .25s cubic-bezier(.2, .8, .2, 1);
    will-change: transform, width;
    z-index: 0;
}

.amount-main {
    font-weight: 600;
}

.amount-boost {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 12px;
    color: var(--muted);
}

.mult-tag {
    padding: 2px 8px;
    border-radius: 999px;
    border: 1px solid rgba(242, 211, 114, .25);
    background: rgba(242, 211, 114, .12);
    color: #f2d372;
    font-weight: 700;
    line-height: 1;
}

.boost-arrow {
    opacity: .6;
}

.boost-value {
    color: #fff;
}

.seg-coin {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 6px 12px;
    margin: 0 auto 8px;
    border-radius: 999px;
    background: var(--surface-2, #121418);
    border: 1px solid var(--line, #262a33);
    box-shadow: 0 0 10px var(--accent);

    color: var(--fg, #e6e7ea);
    font-size: 14px;
    font-weight: 700;
    width: fit-content;
}

.seg-coin-ico {
    width: 18px;
    height: 18px;
    display: inline-block;
    filter: drop-shadow(0 1px 1px rgba(0,0,0,.35));
}

.seg-coin-label {
    color: var(--muted, #a9adb7);
    font-weight: 600;
}

.seg-coin-amount {
    font-variant-numeric: tabular-nums;
}

.seg-coin.bump {
    animation: coin-bump .35s ease-out;
}
@keyframes coin-bump {
    0%   { transform: translateY(0) scale(1); }
    40%  { transform: translateY(-2px) scale(1.04); }
    100% { transform: translateY(0) scale(1); }
}
