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

:root {
    --black: #000000;
    --white: #ffffff;
    --gray-100: #f5f5f5;
    --gray-200: #e5e5e5;
    --gray-300: #d4d4d4;
    --gray-400: #a3a3a3;
    --gray-500: #737373;
    --gray-600: #525252;
    --gray-700: #404040;
    --gray-800: #262626;
    --gray-900: #171717;
    --gray-950: #0a0a0a;
}

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

/* Navbar */
.navbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 2rem;
    border-bottom: 1px solid var(--gray-800);
}

.nav-brand {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.logo {
    width: 32px;
    height: 32px;
    border-radius: 4px;
}

.brand-text {
    font-family: 'JetBrains Mono', monospace;
    font-size: 1.125rem;
    font-weight: 600;
    letter-spacing: -0.02em;
}

.nav-links {
    display: flex;
    gap: 2rem;
}

.nav-link {
    color: var(--gray-500);
    text-decoration: none;
    font-size: 0.875rem;
    font-weight: 500;
    transition: color 0.15s;
}

.nav-link:hover,
.nav-link.active {
    color: var(--white);
}

.btn-connect {
    background: var(--white);
    color: var(--black);
    border: none;
    padding: 0.625rem 1.25rem;
    font-size: 0.875rem;
    font-weight: 600;
    cursor: pointer;
    transition: opacity 0.15s;
}

.btn-connect:hover {
    opacity: 0.9;
}

.btn-connect.connected {
    background: transparent;
    color: var(--white);
    border: 1px solid var(--gray-700);
}

/* Stats Bar */
.stats-bar {
    display: flex;
    justify-content: center;
    gap: 4rem;
    padding: 1rem 2rem;
    border-bottom: 1px solid var(--gray-800);
}

.stat {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.25rem;
}

.stat-label {
    font-size: 0.6875rem;
    color: var(--gray-500);
    text-transform: lowercase;
    letter-spacing: 0.02em;
}

.stat-value {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.9375rem;
    font-weight: 600;
}

/* Main */
.main {
    max-width: 900px;
    margin: 0 auto;
    padding: 2rem;
}

.view {
    display: none;
}

.view.active {
    display: block;
}

/* Tokens View */
.view-header {
    margin-bottom: 1.5rem;
}

.sort-tabs {
    display: flex;
    gap: 0.25rem;
}

.sort-tab {
    background: transparent;
    border: 1px solid var(--gray-800);
    color: var(--gray-500);
    padding: 0.5rem 1rem;
    font-size: 0.8125rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.15s;
}

.sort-tab:first-child {
    border-radius: 4px 0 0 4px;
}

.sort-tab:last-child {
    border-radius: 0 4px 4px 0;
}

.sort-tab:not(:first-child) {
    margin-left: -1px;
}

.sort-tab:hover {
    color: var(--white);
    border-color: var(--gray-600);
}

.sort-tab.active {
    background: var(--white);
    color: var(--black);
    border-color: var(--white);
}

.token-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.empty-state {
    text-align: center;
    padding: 4rem 2rem;
    color: var(--gray-500);
}

.empty-state p {
    margin-bottom: 1rem;
}

.btn-create-first {
    background: var(--white);
    color: var(--black);
    border: none;
    padding: 0.75rem 1.5rem;
    font-weight: 600;
    cursor: pointer;
}

.token-row {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem;
    border: 1px solid var(--gray-800);
    cursor: pointer;
    transition: border-color 0.15s;
}

.token-row:hover {
    border-color: var(--gray-600);
}

.token-ticker {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.9375rem;
    font-weight: 600;
    min-width: 80px;
}

.token-name {
    flex: 1;
    color: var(--gray-400);
    font-size: 0.875rem;
}

.token-mcap,
.token-volume {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.8125rem;
    color: var(--gray-400);
    min-width: 100px;
    text-align: right;
}

.token-price {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.875rem;
    font-weight: 600;
    min-width: 120px;
    text-align: right;
}

/* Create View */
.create-box {
    max-width: 500px;
    margin: 0 auto;
    border: 1px solid var(--gray-800);
    padding: 2rem;
}

.create-box h2 {
    font-size: 1.25rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
}

.create-desc {
    color: var(--gray-500);
    font-size: 0.875rem;
    margin-bottom: 2rem;
}

.form-row {
    display: flex;
    gap: 1rem;
}

.form-group {
    flex: 1;
    margin-bottom: 1.25rem;
}

.form-group.small {
    flex: 0 0 120px;
}

.form-group label {
    display: block;
    font-size: 0.75rem;
    color: var(--gray-500);
    margin-bottom: 0.5rem;
    text-transform: lowercase;
}

.form-group input,
.form-group textarea {
    width: 100%;
    background: var(--black);
    border: 1px solid var(--gray-800);
    color: var(--white);
    padding: 0.75rem;
    font-size: 0.9375rem;
    font-family: inherit;
    transition: border-color 0.15s;
}

.form-group input:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--white);
}

.form-group textarea {
    min-height: 80px;
    resize: vertical;
}

.form-info {
    border: 1px solid var(--gray-800);
    padding: 1rem;
    margin-bottom: 1.5rem;
}

.info-row {
    display: flex;
    justify-content: space-between;
    font-size: 0.8125rem;
    padding: 0.375rem 0;
}

.info-row span:first-child {
    color: var(--gray-500);
}

.info-row span:last-child {
    font-family: 'JetBrains Mono', monospace;
}

.btn-submit {
    width: 100%;
    background: var(--white);
    color: var(--black);
    border: none;
    padding: 0.875rem;
    font-size: 0.9375rem;
    font-weight: 600;
    cursor: pointer;
    transition: opacity 0.15s;
}

.btn-submit:hover {
    opacity: 0.9;
}

.btn-submit:disabled {
    background: var(--gray-800);
    color: var(--gray-500);
    cursor: not-allowed;
}

/* Insurance Fund View */
.fund-box {
    max-width: 600px;
    margin: 0 auto;
}

.fund-box h2 {
    font-size: 1.5rem;
    font-weight: 600;
    margin-bottom: 0.75rem;
}

.fund-desc {
    color: var(--gray-500);
    font-size: 0.9375rem;
    margin-bottom: 2.5rem;
    line-height: 1.6;
}

.fund-stats {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem;
    margin-bottom: 2rem;
}

.fund-stat {
    border: 1px solid var(--gray-800);
    padding: 1.5rem;
    text-align: center;
}

.fund-value {
    display: block;
    font-family: 'JetBrains Mono', monospace;
    font-size: 2rem;
    font-weight: 700;
    margin-bottom: 0.25rem;
}

.fund-label {
    font-size: 0.75rem;
    color: var(--gray-500);
    text-transform: lowercase;
}

.supply-bar {
    height: 8px;
    background: var(--gray-800);
    margin-bottom: 0.75rem;
}

.supply-fill {
    height: 100%;
    background: var(--white);
    transition: width 0.3s;
}

.supply-legend {
    display: flex;
    justify-content: center;
    gap: 2rem;
    font-size: 0.75rem;
    color: var(--gray-500);
    margin-bottom: 2.5rem;
}

.dot {
    display: inline-block;
    width: 8px;
    height: 8px;
    margin-right: 0.5rem;
}

.dot.fill {
    background: var(--white);
}

.dot.empty {
    background: var(--gray-800);
}

.mechanics {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1rem;
    margin-bottom: 2rem;
}

.mechanic {
    border: 1px solid var(--gray-800);
    padding: 1.25rem;
}

.mechanic h3 {
    font-size: 0.875rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
}

.mechanic p {
    font-size: 0.8125rem;
    color: var(--gray-500);
    line-height: 1.5;
}

.burn-address {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border: 1px solid var(--gray-800);
    padding: 1rem;
    font-size: 0.8125rem;
}

.burn-address span {
    color: var(--gray-500);
}

.burn-address code {
    font-family: 'JetBrains Mono', monospace;
    color: var(--white);
}

/* Modal */
.modal {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.9);
    display: none;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    z-index: 1000;
}

.modal.active {
    display: flex;
}

.modal-box {
    background: var(--black);
    border: 1px solid var(--gray-800);
    width: 100%;
    max-width: 400px;
    padding: 1.5rem;
    position: relative;
}

.modal-close {
    position: absolute;
    top: 1rem;
    right: 1rem;
    background: none;
    border: none;
    color: var(--gray-500);
    font-size: 1.5rem;
    cursor: pointer;
    line-height: 1;
}

.modal-close:hover {
    color: var(--white);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 1.25rem;
}

.token-info h3 {
    font-size: 1.125rem;
    font-weight: 600;
}

.token-info .ticker {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.8125rem;
    color: var(--gray-500);
}

.modal-header .token-price {
    font-family: 'JetBrains Mono', monospace;
    font-size: 1.125rem;
    font-weight: 600;
}

.modal-stats {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0.5rem;
    padding: 0.75rem;
    background: var(--gray-950);
    margin-bottom: 1.25rem;
}

.modal-stat {
    text-align: center;
}

.modal-stat .label {
    display: block;
    font-size: 0.625rem;
    color: var(--gray-600);
    text-transform: lowercase;
    margin-bottom: 0.125rem;
}

.modal-stat .value {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.8125rem;
    font-weight: 500;
}

.trade-tabs {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.trade-tab {
    flex: 1;
    padding: 0.625rem;
    background: transparent;
    border: 1px solid var(--gray-800);
    color: var(--gray-500);
    font-size: 0.875rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s;
}

.trade-tab:hover {
    border-color: var(--gray-600);
    color: var(--white);
}

.trade-tab.active {
    background: var(--white);
    border-color: var(--white);
    color: var(--black);
}

.balance-row {
    display: flex;
    justify-content: space-between;
    font-size: 0.75rem;
    color: var(--gray-500);
    margin-bottom: 0.5rem;
}

.input-group {
    display: flex;
    border: 1px solid var(--gray-800);
    margin-bottom: 0.5rem;
}

.input-group input {
    flex: 1;
    background: transparent;
    border: none;
    color: var(--white);
    padding: 0.875rem;
    font-family: 'JetBrains Mono', monospace;
    font-size: 1.125rem;
}

.input-group input:focus {
    outline: none;
}

.input-unit {
    display: flex;
    align-items: center;
    padding: 0 1rem;
    background: var(--gray-950);
    color: var(--gray-500);
    font-size: 0.8125rem;
    font-family: 'JetBrains Mono', monospace;
}

.quick-btns {
    display: flex;
    gap: 0.25rem;
    margin-bottom: 1rem;
}

.quick-btns button {
    flex: 1;
    padding: 0.5rem;
    background: var(--gray-950);
    border: 1px solid var(--gray-800);
    color: var(--gray-500);
    font-size: 0.75rem;
    cursor: pointer;
    transition: all 0.15s;
}

.quick-btns button:hover {
    border-color: var(--gray-600);
    color: var(--white);
}

.trade-summary {
    border: 1px solid var(--gray-800);
    padding: 0.75rem;
    margin-bottom: 1rem;
}

.summary-row {
    display: flex;
    justify-content: space-between;
    font-size: 0.8125rem;
    padding: 0.25rem 0;
}

.summary-row span:first-child {
    color: var(--gray-500);
}

.summary-row.fee {
    border-top: 1px solid var(--gray-800);
    margin-top: 0.5rem;
    padding-top: 0.5rem;
    color: var(--gray-400);
}

.btn-trade {
    width: 100%;
    padding: 0.875rem;
    background: var(--white);
    color: var(--black);
    border: none;
    font-size: 0.9375rem;
    font-weight: 600;
    cursor: pointer;
    transition: opacity 0.15s;
}

.btn-trade:hover {
    opacity: 0.9;
}

.btn-trade:disabled {
    background: var(--gray-800);
    color: var(--gray-500);
    cursor: not-allowed;
}

.curve-section {
    margin-top: 1.25rem;
    padding-top: 1.25rem;
    border-top: 1px solid var(--gray-800);
}

.curve-label {
    font-size: 0.6875rem;
    color: var(--gray-600);
    text-transform: lowercase;
}

.curve-bar {
    height: 4px;
    background: var(--gray-800);
    margin: 0.5rem 0;
}

.curve-fill {
    height: 100%;
    background: var(--white);
}

.curve-info {
    display: flex;
    justify-content: space-between;
    font-size: 0.75rem;
}

#curveRaised {
    font-family: 'JetBrains Mono', monospace;
}

#curveTarget {
    color: var(--gray-600);
}

/* Toast */
.toast {
    position: fixed;
    bottom: 2rem;
    left: 50%;
    transform: translateX(-50%) translateY(100px);
    background: var(--white);
    color: var(--black);
    padding: 0.875rem 1.5rem;
    font-size: 0.875rem;
    font-weight: 500;
    opacity: 0;
    transition: all 0.3s;
    z-index: 1001;
}

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

.toast.error {
    background: var(--gray-800);
    color: var(--white);
}

/* Responsive */
@media (max-width: 768px) {
    .navbar {
        flex-wrap: wrap;
        gap: 1rem;
    }
    
    .nav-links {
        order: 3;
        width: 100%;
        justify-content: center;
        gap: 1.5rem;
    }
    
    .stats-bar {
        gap: 2rem;
        flex-wrap: wrap;
    }
    
    .mechanics {
        grid-template-columns: 1fr;
    }
    
    .fund-stats {
        grid-template-columns: 1fr;
    }
    
    .form-row {
        flex-direction: column;
    }
    
    .form-group.small {
        flex: 1;
    }
    
    .token-row {
        flex-wrap: wrap;
    }
    
    .token-mcap,
    .token-volume {
        display: none;
    }
}
