* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --bg-0: #000000;
    --bg-1: #0c0c0c;
    --bg-2: #141414;
    --bg-3: #1f1f1f;
    --border: #2a2a2a;
    --border-light: #3a3a3a;
    --text-0: #ffffff;
    --text-1: #b0b0b0;
    --text-2: #707070;
    
    /* Solana Colors */
    --sol-purple: #9945ff;
    --sol-cyan: #14f195;
    --sol-blue: #00d4ff;
    --sol-pink: #f638dc;
    --sol-gradient: linear-gradient(135deg, #9945ff 0%, #14f195 50%, #00d4ff 100%);
    --sol-gradient-2: linear-gradient(135deg, #9945ff, #f638dc);
    
    --long: #14f195;
    --long-dim: rgba(20, 241, 149, 0.1);
    --long-glow: rgba(20, 241, 149, 0.3);
    --short: #f638dc;
    --short-dim: rgba(246, 56, 220, 0.1);
    --short-glow: rgba(246, 56, 220, 0.3);
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--bg-0);
    color: var(--text-0);
    line-height: 1.5;
    min-height: 100vh;
}

/* Gradient background effect */
body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 60vh;
    background: radial-gradient(ellipse 80% 50% at 50% -20%, rgba(153, 69, 255, 0.15), transparent),
                radial-gradient(ellipse 60% 40% at 80% 20%, rgba(20, 241, 149, 0.08), transparent),
                radial-gradient(ellipse 50% 30% at 20% 30%, rgba(0, 212, 255, 0.06), transparent);
    pointer-events: none;
    z-index: -1;
}

/* Header */
.header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 32px;
    height: 72px;
    background: rgba(12, 12, 12, 0.8);
    backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 100;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 20px;
}

.logo {
    display: flex;
    align-items: center;
    gap: 12px;
    text-decoration: none;
    color: var(--text-0);
}

.logo-icon {
    width: 28px;
    height: 28px;
    color: var(--sol-cyan);
    filter: drop-shadow(0 0 8px var(--sol-cyan));
}

.logo span {
    font-size: 20px;
    font-weight: 700;
    letter-spacing: -0.02em;
    background: var(--sol-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.network-badge {
    padding: 6px 12px;
    background: linear-gradient(135deg, rgba(153, 69, 255, 0.2), rgba(20, 241, 149, 0.2));
    border: 1px solid rgba(153, 69, 255, 0.3);
    color: var(--sol-cyan);
    font-size: 12px;
    font-weight: 600;
    border-radius: 6px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.nav {
    display: flex;
    gap: 8px;
}

.nav-link {
    padding: 10px 18px;
    color: var(--text-1);
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
    border-radius: 8px;
    transition: all 0.2s;
}

.nav-link:hover {
    color: var(--text-0);
    background: var(--bg-2);
}

.nav-link.active {
    color: var(--sol-cyan);
    background: rgba(20, 241, 149, 0.1);
}

.connect-btn {
    padding: 12px 24px;
    background: var(--sol-gradient);
    color: #000;
    border: none;
    border-radius: 10px;
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s;
}

.connect-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 30px rgba(153, 69, 255, 0.3), 0 8px 30px rgba(20, 241, 149, 0.2);
}

.connect-btn.connected {
    background: var(--bg-2);
    color: var(--text-0);
    border: 1px solid var(--border);
}

/* Main */
.main {
    max-width: 1100px;
    margin: 0 auto;
    padding: 32px;
}

/* Trading Container */
.trading-container {
    display: grid;
    grid-template-columns: 1fr 380px;
    gap: 24px;
    margin-bottom: 32px;
}

/* Price Section */
.price-section {
    background: linear-gradient(180deg, var(--bg-1) 0%, var(--bg-0) 100%);
    border: 1px solid var(--border);
    border-radius: 16px;
    overflow: hidden;
    position: relative;
}

.price-section::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 1px;
    background: var(--sol-gradient);
    opacity: 0.5;
}

.asset-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 24px;
    border-bottom: 1px solid var(--border);
}

.asset-selector {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 10px 14px;
    margin: -10px -14px;
    border-radius: 12px;
    cursor: pointer;
    transition: background 0.2s;
}

.asset-selector:hover {
    background: var(--bg-2);
}

.asset-icon {
    width: 40px;
    height: 40px;
}

.asset-info {
    display: flex;
    flex-direction: column;
}

.asset-name {
    font-size: 18px;
    font-weight: 700;
}

.asset-type {
    font-size: 12px;
    color: var(--sol-purple);
    font-weight: 500;
}

.dropdown-icon {
    width: 18px;
    height: 18px;
    color: var(--text-2);
}

.price-display {
    text-align: right;
}

.current-price {
    display: block;
    font-size: 32px;
    font-weight: 700;
    font-family: 'JetBrains Mono', monospace;
    letter-spacing: -0.02em;
}

.price-change {
    font-size: 15px;
    font-weight: 600;
}

.price-change.positive { color: var(--long); }
.price-change.negative { color: var(--short); }

/* Asset Dropdown */
.asset-dropdown {
    position: absolute;
    top: 90px;
    left: 24px;
    background: var(--bg-2);
    border: 1px solid var(--border-light);
    border-radius: 12px;
    padding: 8px;
    z-index: 100;
    display: none;
    min-width: 280px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.5);
}

.asset-dropdown.show {
    display: block;
}

.dropdown-item {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 14px;
    border-radius: 10px;
    cursor: pointer;
    transition: background 0.15s;
}

.dropdown-item:hover {
    background: var(--bg-3);
}

.dropdown-item img {
    width: 32px;
    height: 32px;
}

.dropdown-name {
    flex: 1;
    font-weight: 600;
}

.dropdown-price {
    font-family: 'JetBrains Mono', monospace;
    font-size: 14px;
    color: var(--text-1);
}

/* Price Chart */
.price-chart {
    height: 300px;
    padding: 24px;
    position: relative;
}

#chart-canvas {
    width: 100%;
    height: 100%;
}

/* Trade Panel */
.trade-panel {
    background: linear-gradient(180deg, var(--bg-1) 0%, var(--bg-0) 100%);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 28px;
    position: relative;
}

.trade-panel::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 1px;
    background: var(--sol-gradient);
    opacity: 0.5;
}

.panel-section {
    margin-bottom: 28px;
}

.section-label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-1);
    margin-bottom: 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.duration-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 10px;
}

.duration-btn {
    padding: 12px;
    background: var(--bg-2);
    border: 1px solid var(--border);
    border-radius: 10px;
    color: var(--text-1);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.duration-btn:hover {
    border-color: var(--sol-purple);
    color: var(--text-0);
}

.duration-btn.active {
    background: linear-gradient(135deg, rgba(153, 69, 255, 0.2), rgba(20, 241, 149, 0.1));
    border-color: var(--sol-purple);
    color: var(--sol-cyan);
}

.amount-input-wrapper {
    display: flex;
    background: var(--bg-2);
    border: 1px solid var(--border);
    border-radius: 12px;
    overflow: hidden;
    transition: border-color 0.2s;
}

.amount-input-wrapper:focus-within {
    border-color: var(--sol-purple);
    box-shadow: 0 0 0 3px rgba(153, 69, 255, 0.1);
}

.amount-input {
    flex: 1;
    padding: 16px 18px;
    background: transparent;
    border: none;
    color: var(--text-0);
    font-size: 18px;
    font-family: 'JetBrains Mono', monospace;
    outline: none;
}

.amount-input::placeholder {
    color: var(--text-2);
}

.amount-currency {
    padding: 16px 18px;
    background: var(--bg-0);
    color: var(--text-1);
    font-size: 14px;
    font-weight: 600;
}

.quick-amounts {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 10px;
    margin-top: 12px;
}

.quick-btn {
    padding: 10px;
    background: transparent;
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--text-1);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.quick-btn:hover {
    border-color: var(--sol-cyan);
    color: var(--sol-cyan);
}

.balance-display {
    display: flex;
    justify-content: space-between;
    padding: 16px 18px;
    background: var(--bg-2);
    border-radius: 10px;
}

.balance-label {
    font-size: 14px;
    color: var(--text-2);
}

.balance-value {
    font-size: 15px;
    font-weight: 600;
    font-family: 'JetBrains Mono', monospace;
}

.payout-info {
    padding: 18px;
    background: linear-gradient(135deg, rgba(153, 69, 255, 0.08), rgba(20, 241, 149, 0.05));
    border: 1px solid rgba(153, 69, 255, 0.2);
    border-radius: 12px;
    margin-bottom: 24px;
}

.payout-row {
    display: flex;
    justify-content: space-between;
    font-size: 14px;
}

.payout-row span:first-child {
    color: var(--text-1);
}

.payout-row.sub {
    margin-top: 10px;
    font-size: 13px;
}

.payout-row.sub span {
    color: var(--text-2);
}

.payout-amount {
    font-weight: 700;
    font-family: 'JetBrains Mono', monospace;
    color: var(--sol-cyan);
}

.action-buttons {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px;
}

.action-btn {
    padding: 20px;
    border: none;
    border-radius: 14px;
    cursor: pointer;
    transition: all 0.2s;
    text-align: center;
    position: relative;
    overflow: hidden;
}

.action-btn.long {
    background: linear-gradient(135deg, #14f195, #00d4aa);
    color: #000;
}

.action-btn.long:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 30px var(--long-glow);
}

.action-btn.short {
    background: linear-gradient(135deg, #f638dc, #9945ff);
    color: #fff;
}

.action-btn.short:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 30px var(--short-glow);
}

.action-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

.btn-label {
    display: block;
    font-size: 18px;
    font-weight: 700;
}

.btn-desc {
    display: block;
    font-size: 12px;
    opacity: 0.7;
    margin-top: 4px;
    font-weight: 500;
}

/* Positions & History */
.positions-section,
.history-section {
    background: var(--bg-1);
    border: 1px solid var(--border);
    border-radius: 16px;
    margin-bottom: 24px;
    overflow: hidden;
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 18px 24px;
    border-bottom: 1px solid var(--border);
    background: linear-gradient(90deg, rgba(153, 69, 255, 0.05), transparent);
}

.section-header h3 {
    font-size: 15px;
    font-weight: 600;
}

.position-count {
    padding: 4px 10px;
    background: var(--sol-gradient);
    color: #000;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 700;
}

.positions-list,
.history-list {
    padding: 20px 24px;
}

.empty-positions,
.empty-history {
    padding: 40px;
    text-align: center;
    color: var(--text-2);
    font-size: 14px;
}

/* Position Card */
.position-card {
    display: grid;
    grid-template-columns: 1fr auto auto auto auto;
    align-items: center;
    gap: 24px;
    padding: 18px;
    background: var(--bg-2);
    border: 1px solid var(--border);
    border-radius: 12px;
    margin-bottom: 10px;
}

.position-asset {
    font-weight: 600;
}

.position-direction {
    padding: 6px 14px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
}

.position-direction.long {
    background: var(--long-dim);
    color: var(--long);
}

.position-direction.short {
    background: var(--short-dim);
    color: var(--short);
}

.position-size,
.position-entry {
    font-size: 14px;
    font-family: 'JetBrains Mono', monospace;
}

.position-timer {
    font-size: 15px;
    font-family: 'JetBrains Mono', monospace;
    font-weight: 600;
    color: var(--sol-cyan);
}

/* History Item */
.history-item {
    display: grid;
    grid-template-columns: 1fr auto auto auto;
    align-items: center;
    gap: 24px;
    padding: 16px 18px;
    background: var(--bg-2);
    border-radius: 10px;
    margin-bottom: 10px;
}

.history-asset {
    font-weight: 600;
}

.history-asset span {
    display: block;
    font-size: 12px;
    color: var(--text-2);
    font-weight: 400;
    margin-top: 2px;
}

.history-direction {
    padding: 5px 12px;
    border-radius: 5px;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
}

.history-direction.long {
    background: var(--long-dim);
    color: var(--long);
}

.history-direction.short {
    background: var(--short-dim);
    color: var(--short);
}

.history-size {
    font-size: 14px;
    font-family: 'JetBrains Mono', monospace;
}

.history-pnl {
    font-size: 14px;
    font-weight: 700;
    font-family: 'JetBrains Mono', monospace;
}

.history-pnl.positive { color: var(--long); }
.history-pnl.negative { color: var(--short); }

/* Modal */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(8px);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

.modal-overlay.show {
    display: flex;
}

.modal {
    background: var(--bg-1);
    border: 1px solid var(--border);
    border-radius: 20px;
    padding: 36px;
    width: 100%;
    max-width: 400px;
    text-align: center;
    position: relative;
}

.modal::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 2px;
    background: var(--sol-gradient);
    border-radius: 20px 20px 0 0;
}

.modal-icon {
    width: 64px;
    height: 64px;
    margin: 0 auto 20px;
    background: var(--long-dim);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-icon svg {
    width: 32px;
    height: 32px;
    color: var(--long);
}

.modal-icon.loss {
    background: var(--short-dim);
}

.modal-icon.loss svg {
    color: var(--short);
}

.modal-title {
    font-size: 24px;
    font-weight: 700;
    margin-bottom: 6px;
}

.modal-subtitle {
    font-size: 14px;
    color: var(--text-1);
    margin-bottom: 28px;
}

.modal-details {
    background: var(--bg-2);
    border-radius: 12px;
    padding: 18px;
    margin-bottom: 28px;
}

.detail-row {
    display: flex;
    justify-content: space-between;
    padding: 10px 0;
    font-size: 14px;
}

.detail-row span:first-child {
    color: var(--text-2);
}

.detail-row.result {
    border-top: 1px solid var(--border);
    margin-top: 10px;
    padding-top: 18px;
    font-size: 16px;
    font-weight: 700;
}

.positive { color: var(--long); }
.negative { color: var(--short); }

.modal-btn {
    width: 100%;
    padding: 16px;
    background: var(--sol-gradient);
    color: #000;
    border: none;
    border-radius: 12px;
    font-size: 15px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s;
}

.modal-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 30px rgba(153, 69, 255, 0.3);
}

/* Toast */
.toast-container {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 2000;
}

.toast {
    padding: 14px 22px;
    background: var(--bg-2);
    border: 1px solid var(--border);
    border-radius: 10px;
    font-size: 14px;
    margin-bottom: 10px;
    animation: slideIn 0.2s ease;
}

@keyframes slideIn {
    from { opacity: 0; transform: translateX(20px); }
    to { opacity: 1; transform: translateX(0); }
}

.toast.success { 
    border-color: var(--long); 
    background: linear-gradient(135deg, rgba(20, 241, 149, 0.1), var(--bg-2));
}
.toast.error { 
    border-color: var(--short); 
    background: linear-gradient(135deg, rgba(246, 56, 220, 0.1), var(--bg-2));
}

/* Responsive */
@media (max-width: 900px) {
    .trading-container {
        grid-template-columns: 1fr;
    }
    
    .price-chart {
        height: 220px;
    }
}

@media (max-width: 600px) {
    .header {
        padding: 0 16px;
    }
    
    .nav {
        display: none;
    }
    
    .main {
        padding: 16px;
    }
    
    .position-card {
        grid-template-columns: 1fr 1fr;
        gap: 12px;
    }
}
