:root {
    --bg-dark: #030712;
    --card-bg: rgba(20, 24, 34, 0.6);
    --gold: #00d4ff; /* Neon Cyan */
    --gold-glow: rgba(0, 212, 255, 0.4);
    --purple: #EC4899; /* Neon Pink */
    --purple-glow: rgba(236, 72, 153, 0.4);
    --text-white: #ffffff;
    --text-gray: #94a3b8;
    --border: rgba(255, 255, 255, 0.08);
    --safe-area-top: env(safe-area-inset-top, 0px);
    --safe-area-bottom: env(safe-area-inset-bottom, 0px);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

body {
    background-color: var(--bg-dark);
    color: var(--text-white);
    font-family: 'Outfit', sans-serif;
    line-height: 1.5;
    overflow-x: hidden;
    overscroll-behavior-y: none;
    /* Edge-to-edge support */
    padding-top: var(--safe-area-top);
    padding-bottom: var(--safe-area-bottom);
}

/* Hide scrollbars for native feel */
::-webkit-scrollbar {
    display: none;
}

/* Sticky Top Header */
.top-nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    background: rgba(3, 7, 18, 0.85);
    backdrop-filter: blur(12px);
    position: sticky;
    top: var(--safe-area-top);
    z-index: 100;
    border-bottom: 1px solid var(--border);
}

.brand-name {
    font-size: 1.4rem;
    font-weight: 800;
    color: var(--purple);
    letter-spacing: 1px;
}

.header-actions {
    display: flex;
    gap: 16px;
}

.icon-btn {
    background: none;
    border: none;
    color: var(--gold);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.2s;
}

.icon-btn:active {
    transform: scale(0.9);
}

/* Feed Container */
#feed-container {
    max-width: 600px;
    margin: 0 auto;
    padding: 0 0 80px 0; /* padding bottom for nav bar */
    min-height: 100vh;
}

/* Loader */
.loader {
    display: flex;
    justify-content: center;
    padding: 20px;
}

.spinner {
    width: 24px;
    height: 24px;
    border: 3px solid rgba(0, 212, 255, 0.2);
    border-top-color: var(--gold);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

/* Post Cards */
.post-card {
    background: var(--card-bg);
    border: 1px solid var(--border);
    margin: 16px;
    border-radius: 16px;
    padding: 16px;
    backdrop-filter: blur(10px);
}

.post-header {
    display: flex;
    align-items: center;
    margin-bottom: 12px;
}

.author-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--gold), var(--purple));
    margin-right: 12px;
    flex-shrink: 0;
}

.author-avatar img {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    object-fit: cover;
}

.author-info {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
}

.author-name {
    font-weight: 700;
    font-size: 0.95rem;
    color: #fff;
    display: flex;
    align-items: center;
    gap: 4px;
}

.author-handle {
    font-size: 0.8rem;
    color: var(--text-gray);
}

.post-time {
    font-size: 0.75rem;
    color: var(--text-gray);
}

.post-text {
    font-size: 0.95rem;
    margin-bottom: 12px;
    color: #e2e8f0;
}

.post-media-container {
    width: 100%;
    border-radius: 12px;
    overflow: hidden;
    margin-bottom: 12px;
    background: #111;
}

.post-image {
    width: 100%;
    max-height: 250px;
    object-fit: cover;
    display: block;
}

/* Signal Data Box */
.signal-data {
    background: rgba(0, 212, 255, 0.05);
    border: 1px solid rgba(0, 212, 255, 0.2);
    border-radius: 12px;
    padding: 12px;
    margin-bottom: 12px;
    text-align: center;
}

.signal-metrics {
    display: flex;
    justify-content: space-around;
    margin-bottom: 12px;
    font-size: 0.8rem;
    color: var(--text-gray);
}

.signal-metrics strong {
    color: #fff;
    font-size: 1rem;
    display: block;
}

.join-btn {
    width: 100%;
    background: transparent;
    border: 1px solid var(--purple);
    color: var(--purple);
    padding: 8px;
    border-radius: 20px;
    font-family: inherit;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s;
}

.join-btn:active {
    background: var(--purple);
    color: #fff;
}

/* Action Bar */
.post-actions {
    display: flex;
    justify-content: space-between;
    padding-top: 12px;
    border-top: 1px solid rgba(255, 255, 255, 0.05);
}

.action-btn {
    background: none;
    border: none;
    color: var(--text-gray);
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.85rem;
    cursor: pointer;
    transition: color 0.2s;
}

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

.like-btn.liked {
    color: var(--purple);
}
.like-btn.liked svg {
    fill: var(--purple);
    stroke: var(--purple);
}

/* Sticky Bottom Navigation */
.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    background: rgba(3, 7, 18, 0.95);
    backdrop-filter: blur(15px);
    border-top: 1px solid var(--border);
    display: flex;
    justify-content: space-around;
    padding: 12px 10px calc(12px + var(--safe-area-bottom));
    z-index: 100;
}

.nav-item {
    background: none;
    border: none;
    color: var(--text-gray);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    cursor: pointer;
    font-family: inherit;
    font-size: 0.7rem;
    transition: color 0.2s;
}

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

.nav-item svg {
    transition: transform 0.2s;
}

.nav-item.active svg {
    transform: translateY(-2px);
}

@media (min-width: 768px) {
    #feed-container, #markets-container {
        border-left: 1px solid var(--border);
        border-right: 1px solid var(--border);
        min-height: 100vh;
        max-width: 600px;
        margin: 0 auto;
    }
}

/* Market Card Styles */
#markets-container {
    max-width: 600px;
    margin: 0 auto;
    padding: 0 0 80px 0;
    min-height: 100vh;
}

.market-card {
    background: var(--card-bg);
    border: 1px solid var(--border);
    margin: 16px;
    border-radius: 16px;
    padding: 20px;
    backdrop-filter: blur(10px);
}

.market-title {
    font-size: 1.1rem;
    font-weight: 700;
    margin-bottom: 16px;
    color: #fff;
    line-height: 1.4;
}

.market-stats {
    display: flex;
    justify-content: space-between;
    margin-bottom: 16px;
    font-size: 0.85rem;
    color: var(--text-gray);
}

.market-stats span {
    display: flex;
    align-items: center;
    gap: 6px;
}

.market-stats strong {
    color: #fff;
}

.market-actions {
    display: flex;
    gap: 12px;
}

.btn-buy-yes, .btn-buy-no {
    flex: 1;
    padding: 12px;
    border-radius: 8px;
    font-weight: 700;
    font-size: 0.95rem;
    border: none;
    cursor: pointer;
    transition: transform 0.2s, opacity 0.2s;
    display: flex;
    justify-content: space-between;
    align-items: center;
    text-decoration: none;
}

.btn-buy-yes:active, .btn-buy-no:active {
    transform: scale(0.96);
}

.btn-buy-yes {
    background-color: rgba(34, 197, 94, 0.15);
    color: #22c55e;
    border: 1px solid rgba(34, 197, 94, 0.3);
}

.btn-buy-yes:hover {
    background-color: rgba(34, 197, 94, 0.25);
}

.btn-buy-no {
    background-color: rgba(239, 68, 68, 0.15);
    color: #ef4444;
    border: 1px solid rgba(239, 68, 68, 0.3);
}

.btn-buy-no:hover {
    background-color: rgba(239, 68, 68, 0.25);
}

/* Chat FAB & Overlay */
.chat-fab {
    position: fixed;
    bottom: 80px;
    right: 20px;
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--gold), var(--purple));
    color: #fff;
    border: none;
    box-shadow: 0 4px 12px rgba(0,0,0,0.5), 0 0 20px var(--purple-glow);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 99;
    transition: transform 0.2s;
}

.chat-fab:active {
    transform: scale(0.9);
}

.chat-overlay {
    position: fixed;
    top: var(--safe-area-top);
    left: 0;
    width: 100%;
    height: calc(100vh - var(--safe-area-top) - var(--safe-area-bottom) - 70px);
    background: rgba(3, 7, 18, 0.98);
    backdrop-filter: blur(20px);
    z-index: 105;
    display: flex;
    flex-direction: column;
    transform: translateY(100%);
    transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.chat-overlay:not(.hidden) {
    transform: translateY(0);
}

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

.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.chat-msg {
    display: flex;
    flex-direction: column;
}

.chat-msg-author {
    font-size: 0.75rem;
    color: var(--purple);
    font-weight: 700;
    margin-bottom: 2px;
}

.chat-msg-text {
    background: var(--card-bg);
    padding: 10px 14px;
    border-radius: 12px;
    border-top-left-radius: 2px;
    border: 1px solid var(--border);
    color: #fff;
    font-size: 0.9rem;
    align-self: flex-start;
    max-width: 85%;
    word-break: break-word;
}

.chat-msg.self .chat-msg-author {
    align-self: flex-end;
    color: var(--gold);
}

.chat-msg.self .chat-msg-text {
    align-self: flex-end;
    border-top-left-radius: 12px;
    border-top-right-radius: 2px;
    background: rgba(0, 212, 255, 0.1);
    border-color: rgba(0, 212, 255, 0.3);
}

.chat-input-area {
    display: flex;
    padding: 12px;
    border-top: 1px solid var(--border);
    gap: 8px;
    background: rgba(0,0,0,0.5);
}

.chat-input-area input {
    flex: 1;
    background: var(--card-bg);
    border: 1px solid var(--border);
    color: #fff;
    padding: 10px 16px;
    border-radius: 20px;
    font-family: inherit;
    outline: none;
}

.chat-input-area input:focus {
    border-color: var(--gold);
}

.chat-input-area button {
    background: var(--gold);
    color: #000;
    border: none;
    padding: 0 16px;
    border-radius: 20px;
    font-weight: 700;
    cursor: pointer;
}

/* Leaderboard */
.leaderboard-row {
    display: flex;
    align-items: center;
    background: var(--card-bg);
    margin: 12px 16px;
    padding: 16px;
    border-radius: 12px;
    border: 1px solid var(--border);
}

.rank-badge {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: #111;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    color: var(--text-gray);
    margin-right: 12px;
    border: 1px solid var(--border);
}

.leaderboard-row.top-1 .rank-badge {
    background: var(--gold);
    color: #000;
    border-color: var(--gold);
    box-shadow: 0 0 10px var(--gold-glow);
}

.leaderboard-row.top-2 .rank-badge {
    background: #e2e8f0;
    color: #000;
}

.leaderboard-row.top-3 .rank-badge {
    background: #b45309;
    color: #fff;
}

.lb-info {
    flex: 1;
}

.lb-name {
    font-weight: 700;
    color: #fff;
}

.lb-profit {
    color: #22c55e;
    font-weight: 800;
    font-size: 1.1rem;
}

