:root {
    --bg-color: #151A18;
    /* Dark Greenish Black */
    --card-bg: #222B27;
    /* Slightly lighter green/black for cards */
    --text-primary: #FFFFFF;
    --text-secondary: #A0A0A0;
    --accent-purple: #AB9FF2;
    /* Lighter Purple from screenshot */
    --accent-purple-hover: #9A8EE0;
    --success-green: #27D17F;
    --danger-red: #FF5C5C;
    --nav-bg: rgba(21, 26, 24, 0.95);
    --font-family: 'Inter', sans-serif;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-font-smoothing: antialiased;
    -webkit-tap-highlight-color: transparent;
    -webkit-touch-callout: none;
    -webkit-user-select: none;
    user-select: none;
}

body {
    background-color: #000;
    font-family: var(--font-family);
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    color: var(--text-primary);
    overflow: hidden;
    touch-action: pan-y;
    position: fixed;
    width: 100%;
    height: 100%;
}

.app-container {
    width: 100vw;
    max-width: 414px;
    /* iPhone 11 width */
    height: 100vh;
    max-height: 896px;
    /* iPhone 11 height */
    /* Gradient Background: Dark Green to Black */
    background: linear-gradient(180deg, #1A2520 0%, #0D100F 100%);
    position: relative;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    box-shadow: 0 0 50px rgba(39, 209, 127, 0.05);
    transition: background 0.5s ease, transform 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
}

/* On actual iPhone, remove border radius and use full screen */
@media only screen and (max-width: 414px) {
    body {
        padding: 0;
        margin: 0;
    }

    .app-container {
        border-radius: 0;
        width: 100vw;
        height: 100vh;
        padding-top: 0;
    }

    .header {
        padding: 0px 6px 0px 6px;
        min-height: 35px;
        align-items: center;
    }

    .account-selector {
        padding: 1px 3px;
    }

    .account-icon {
        width: 22px;
        height: 22px;
    }

    .account-name {
        font-size: 13px;
    }

    .header-actions i {
        font-size: 18px;
    }

    .balance-section {
        padding: 0px 0;
        margin-bottom: 0px;
    }

    .total-balance {
        font-size: 24px;
        margin-bottom: 0px;
        line-height: 1.1;
    }

    .balance-change {
        font-size: 8px;
        padding: 0px 2px;
    }

    .actions-section {
        margin-bottom: 1px;
        gap: 3px;
        padding: 0 6px;
    }

    .pill-btn {
        padding: 3px 0;
        font-size: 9px;
        border-radius: 14px;
    }

    .tokens-section {
        flex: 1;
        padding: 0 4px 130px 4px;
        /* Very large bottom padding for nav visibility */
    }

    .token-item {
        padding: 3px 4px;
        margin-bottom: 1px;
        border-radius: 10px;
    }

    .token-icon {
        width: 28px;
        height: 28px;
        margin-right: 8px;
    }

    .token-item:nth-child(4) .token-icon {
        padding: 6px;
    }

    .token-name {
        font-size: 10px;
        margin-bottom: 0px;
    }

    .token-price {
        font-size: 8px;
    }

    .token-amount-sub {
        font-size: 8px;
    }

    .balance-usd {
        font-size: 10px;
        margin-bottom: 0px;
    }

    .change {
        font-size: 8px;
    }

    .bottom-nav {
        height: 60px;
        /* Reduced height */
        padding-bottom: 5px;
        /* Minimal padding */
        bottom: 80px;
        /* Raised by half panel height higher */
    }

    .nav-item {
        padding: 6px 10px;
        font-size: 22px;
    }
}

.app-container.negative-state {
    background: linear-gradient(180deg, #2A1212 0%, #0D100F 100%);
    box-shadow: 0 0 50px rgba(255, 92, 92, 0.05);
}

/* Refresh Spinner */
.refresh-spinner {
    position: absolute;
    top: 15px;
    left: 0;
    width: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    opacity: 0;
    transform: translateY(-20px);
    transition: opacity 0.2s;
    z-index: 10;
}

.refresh-spinner i {
    font-size: 24px;
    color: var(--accent-purple);
    animation: spin 1s linear infinite;
}

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

/* Header */
.header {
    padding: 20px;
    padding-top: 50px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    z-index: 20;
}

.account-selector {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    padding: 8px 12px;
    border-radius: 20px;
    transition: background 0.2s;
}

.account-selector:hover {
    background: rgba(255, 255, 255, 0.05);
}

.account-icon {
    width: 28px;
    height: 28px;
    background: #AB9FF2;
    /* Purple circle with letter usually, but keeping avatar placeholder or color */
    background: url('https://avatars.githubusercontent.com/u/85465335?s=200&v=4') no-repeat center center/cover;
    border-radius: 50%;
    border: 2px solid var(--bg-color);
}

.account-name {
    font-weight: 600;
    font-size: 16px;
    color: #E0E0E0;
}

.header-actions i {
    font-size: 24px;
    color: var(--text-secondary);
    cursor: pointer;
    transition: color 0.2s;
}

.header-actions i:hover {
    color: var(--text-primary);
}

/* Balance Section */
.balance-section {
    text-align: center;
    padding: 20px 0;
    margin-bottom: 20px;
    z-index: 20;
}

.total-balance {
    font-size: 42px;
    font-weight: 700;
    margin-bottom: 8px;
    letter-spacing: -0.5px;
    color: #FFFFFF;
}

/* Balance Change Pill */
.balance-change {
    font-size: 14px;
    font-weight: 600;
    display: inline-block;
    padding: 4px 10px;
    border-radius: 6px;
    background: rgba(39, 209, 127, 0.15);
}

.balance-change.positive {
    color: var(--success-green);
    background: rgba(39, 209, 127, 0.1);
}

.balance-change.negative {
    color: var(--danger-red);
    background: rgba(255, 92, 92, 0.1);
}

/* Actions Section */
.actions-section {
    display: flex;
    justify-content: center;
    gap: 12px;
    padding: 0 20px;
    margin-bottom: 30px;
    z-index: 20;
}

.pill-btn {
    flex: 1;
    background: var(--accent-purple);
    color: #1A2520;
    /* Dark text on light button */
    border: none;
    padding: 12px 0;
    border-radius: 20px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s, transform 0.1s;
    max-width: 105px;
}

.pill-btn:hover {
    background: var(--accent-purple-hover);
}

.pill-btn:active {
    transform: scale(0.98);
}

/* Tokens Section */
.tokens-section {
    flex: 1;
    padding: 0 16px;
    overflow-y: auto;
    padding-bottom: 100px;
    z-index: 20;
}

.token-item {
    display: flex;
    align-items: center;
    padding: 16px;
    margin-bottom: 8px;
    background: #222B27;
    /* Dark card background */
    border-radius: 16px;
    cursor: pointer;
    transition: background 0.2s;
}

.token-item:hover {
    background: #2A3530;
}

.token-icon {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    overflow: hidden;
    margin-right: 14px;
    background: #151A18;
    display: flex;
    justify-content: center;
    align-items: center;
}

.token-icon img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* Specific token icon backgrounds */
.token-item:nth-child(1) .token-icon {
    background: #14141A;
    /* Solana - dark background */
}

.token-item:nth-child(2) .token-icon {
    background: #FFFFFF;
    /* Ethereum - white background */
}

.token-item:nth-child(3) .token-icon {
    background: #F7931A;
    /* Bitcoin - orange background */
}

.token-item:nth-child(4) .token-icon {
    background: #8247E5;
    /* Polygon - purple background */
    padding: 10px;
    /* Add padding so the logo doesn't touch edges */
}

.token-item:nth-child(4) .token-icon svg {
    width: 100%;
    height: 100%;
}


.token-info {
    flex: 1;
}

.token-name {
    font-weight: 600;
    font-size: 15px;
    margin-bottom: 2px;
    color: #FFFFFF;
}

.token-price {
    font-size: 13px;
    color: var(--text-secondary);
}

.token-amount-sub {
    font-size: 13px;
    color: #889990;
    /* Muted green-grey */
}

.change.positive {
    color: var(--success-green);
}

.change.negative {
    color: var(--danger-red);
}

.token-balance {
    text-align: right;
}

.balance-usd {
    font-weight: 600;
    font-size: 15px;
    margin-bottom: 2px;
    color: #FFFFFF;
}

.balance-amount {
    font-size: 13px;
    color: var(--text-secondary);
}

.change {
    font-size: 13px;
}

.change.positive {
    color: var(--success-green);
}

.change.negative {
    color: var(--danger-red);
}


/* Bottom Navigation */
.bottom-nav {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 85px;
    background: rgba(13, 16, 15, 0.95);
    /* Matches bottom of gradient */
    backdrop-filter: blur(20px);
    display: flex;
    justify-content: space-around;
    align-items: flex-start;
    /* Align to top for the border */
    border-top: 1px solid rgba(255, 255, 255, 0.05);
    padding-top: 0;
    padding-bottom: 20px;
    z-index: 30;
}

.nav-item {
    color: var(--text-secondary);
    font-size: 26px;
    cursor: pointer;
    padding: 15px 20px;
    /* More padding for click area */
    transition: color 0.2s;
    position: relative;
    display: flex;
    justify-content: center;
}

.nav-item.active {
    color: var(--text-primary);
}

/* Active Tab Indicator (Gradient Line) */
.nav-item.active::before {
    content: '';
    position: absolute;
    top: -1px;
    /* Overlap the border */
    left: 0;
    width: 100%;
    height: 2px;
    background: linear-gradient(90deg, #AB9FF2 0%, #8E7CFF 100%);
    box-shadow: 0 2px 8px rgba(171, 159, 242, 0.5);
}

.nav-item:hover {
    color: var(--text-primary);
}

/* Scrollbar styling */
.tokens-section::-webkit-scrollbar {
    width: 4px;
}

.tokens-section::-webkit-scrollbar-track {
    background: transparent;
}

.tokens-section::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 4px;
}

/* Modal Styling */
.modal {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(5px);
    z-index: 1000;
    display: flex;
    justify-content: center;
    align-items: center;
    opacity: 1;
    transition: opacity 0.3s;
}

.modal.hidden {
    opacity: 0;
    pointer-events: none;
}

.modal-content {
    background: var(--card-bg);
    width: 90%;
    padding: 24px;
    border-radius: 20px;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.modal-header h2 {
    font-size: 20px;
    font-weight: 600;
}

.modal-header i {
    font-size: 24px;
    cursor: pointer;
    color: var(--text-secondary);
}

.input-group {
    margin-bottom: 16px;
}

.input-group label {
    display: block;
    font-size: 13px;
    color: var(--text-secondary);
    margin-bottom: 8px;
}

.input-group input,
.input-group select {
    width: 100%;
    background: #151A18;
    border: 1px solid rgba(255, 255, 255, 0.1);
    padding: 12px;
    border-radius: 12px;
    color: var(--text-primary);
    font-size: 16px;
    outline: none;
}

.input-group input:focus {
    border-color: var(--accent-purple);
}

.primary-btn {
    width: 100%;
    background: var(--accent-purple);
    color: white;
    border: none;
    padding: 14px;
    border-radius: 12px;
    font-weight: 600;
    font-size: 16px;
    cursor: pointer;
    margin-top: 10px;
}

.primary-btn:hover {
    filter: brightness(1.1);
}

.secondary-btn {
    background: rgba(171, 159, 242, 0.2);
    color: var(--accent-purple);
    border: 1px solid rgba(171, 159, 242, 0.3);
    padding: 12px;
    border-radius: 12px;
    font-size: 18px;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.secondary-btn:hover {
    background: rgba(171, 159, 242, 0.3);
    border-color: var(--accent-purple);
}

.secondary-btn:active {
    transform: scale(0.95);
}


/* Skeleton Loading Animation */
@keyframes shimmer {
    0% {
        background-position: -200% 0;
    }

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

.skeleton {
    color: transparent !important;
    background: linear-gradient(90deg, #222B27 25%, #2A3530 50%, #222B27 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
    border-radius: 8px;
    display: inline-block;
    min-width: 100px;
}