:root {
    --bg: #050810;
    --bg-sidebar: #0a0e1a;
    --bg-card: rgba(15, 22, 38, 0.8);
    --bg-input: rgba(20, 28, 46, 0.6);
    --border: rgba(34, 158, 217, 0.12);
    --border-hover: rgba(255, 215, 0, 0.30);
    --ton-blue: #229ED9;
    --ton-blue-deep: #0088CC;
    --star-gold: #FFD700;
    --star-orange: #FFA500;
    --star-bright: #FFE680;
    --gold: #FFD700;
    --red: #b91c1c;
    --green: #22c55e;
    --text: #e8eef7;
    --text-secondary: #9bafc7;
    --text-muted: #5a6f8c;
    --font-display: 'Orbitron', sans-serif;
    --font-heading: 'Rajdhani', sans-serif;
    --font-body: 'Inter', sans-serif;
    --font-mono: 'JetBrains Mono', monospace;
}

*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }
body { font-family: var(--font-body); background: var(--bg); color: var(--text); display: flex; height: 100vh; overflow: hidden; }
a { text-decoration: none; color: inherit; }
.accent { background: linear-gradient(135deg, var(--star-gold), var(--star-orange)); -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text; }
.positive { color: var(--green) !important; }
.negative { color: var(--red) !important; }
.golden-text { color: var(--star-gold); }
.crimson-text { color: #ef4444; }

.sidebar {
    width: 260px; height: 100vh; background: var(--bg-sidebar);
    border-right: 1px solid var(--border);
    display: flex; flex-direction: column; flex-shrink: 0;
    transition: transform 0.3s ease; z-index: 100;
}
.sidebar-header { padding: 20px; border-bottom: 1px solid var(--border); }
.sidebar-logo { display: flex; align-items: center; gap: 10px; }
.sidebar-logo-img { filter: drop-shadow(0 0 6px rgba(255, 215, 0, 0.4)); }
.sidebar-logo-text { font-family: var(--font-display); font-size: 16px; font-weight: 800; letter-spacing: 1.5px; }

.sidebar-nav { padding: 16px 12px; flex: 1; }
.nav-item {
    display: flex; align-items: center; gap: 12px;
    padding: 12px 16px; border-radius: 12px;
    font-family: var(--font-heading); font-size: 15px; font-weight: 500;
    color: var(--text-muted); transition: all 0.3s ease; margin-bottom: 4px;
}
.nav-item:hover { color: var(--text); background: rgba(34, 158, 217, 0.06); }
.nav-item.active { color: var(--star-gold); background: rgba(255, 215, 0, 0.08); border: 1px solid rgba(255, 215, 0, 0.20); }
.nav-item svg { flex-shrink: 0; }

.sidebar-personas { padding: 16px 20px; border-top: 1px solid var(--border); }
.personas-label { font-size: 11px; font-weight: 700; color: var(--text-muted); letter-spacing: 2px; text-transform: uppercase; margin-bottom: 10px; display: block; }
.persona-toggle { display: flex; gap: 8px; }
.persona-btn {
    flex: 1; display: flex; align-items: center; justify-content: center; gap: 6px;
    padding: 10px; border-radius: 10px; border: 1px solid var(--border);
    background: transparent; color: var(--text-muted);
    font-family: var(--font-heading); font-size: 13px; font-weight: 600;
    cursor: pointer; transition: all 0.3s ease;
}
.persona-btn.nova.active { border-color: rgba(255, 215, 0, 0.5); color: var(--star-gold); background: rgba(255, 215, 0, 0.10); }
.persona-btn.pulsar.active { border-color: rgba(239, 68, 68, 0.5); color: #ef4444; background: rgba(239, 68, 68, 0.10); }
.persona-dot { width: 8px; height: 8px; border-radius: 50%; }
.golden-dot { background: var(--star-gold); }
.crimson-dot { background: #ef4444; }

.sidebar-footer { padding: 16px 20px; border-top: 1px solid var(--border); }
.token-price { display: flex; align-items: center; gap: 10px; padding: 10px; border-radius: 10px; background: rgba(34, 158, 217, 0.06); margin-bottom: 12px; }
.token-icon { flex-shrink: 0; }
.token-symbol { display: block; font-family: var(--font-heading); font-size: 13px; font-weight: 700; }
.token-val { font-size: 12px; color: var(--text-muted); }
.token-change { font-size: 12px; font-weight: 700; margin-left: auto; }
.back-to-site { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--text-muted); transition: color 0.3s; }
.back-to-site:hover { color: var(--star-gold); }

.mobile-sidebar-toggle { display: none; position: fixed; top: 16px; left: 16px; z-index: 200; background: var(--bg-card); border: 1px solid var(--border); border-radius: 10px; padding: 10px; color: var(--text); cursor: pointer; }

.main-content { flex: 1; display: flex; flex-direction: column; overflow: hidden; }

.dapp-header {
    display: flex; align-items: center; justify-content: space-between;
    padding: 16px 24px; border-bottom: 1px solid var(--border);
    background: rgba(8, 12, 22, 0.9); backdrop-filter: blur(12px); flex-shrink: 0;
}
.header-left { flex: 1; max-width: 500px; }
.search-box {
    display: flex; align-items: center; gap: 10px;
    padding: 10px 16px; border-radius: 12px;
    background: var(--bg-input); border: 1px solid var(--border);
    transition: border-color 0.3s;
}
.search-box:focus-within { border-color: var(--star-gold); }
.search-box svg { color: var(--text-muted); flex-shrink: 0; }
.search-box input { background: none; border: none; outline: none; color: var(--text); font-size: 14px; width: 100%; font-family: var(--font-body); }
.search-box input::placeholder { color: var(--text-muted); }
.header-right { display: flex; align-items: center; gap: 12px; }
.header-chain { display: flex; align-items: center; gap: 6px; font-size: 13px; color: var(--text-secondary); padding: 8px 14px; border-radius: 8px; background: rgba(34, 158, 217, 0.08); border: 1px solid rgba(34, 158, 217, 0.20); }
.chain-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--ton-blue); animation: chainPulse 2s infinite; }
@keyframes chainPulse { 0%,100% { box-shadow: 0 0 0 0 rgba(34, 158, 217, 0.5); } 50% { box-shadow: 0 0 0 6px rgba(34, 158, 217, 0); } }
.connect-wallet-btn {
    display: flex; align-items: center; gap: 8px;
    padding: 10px 20px; border-radius: 12px;
    background: linear-gradient(135deg, var(--star-gold), var(--star-orange));
    border: none; color: #1a1500; font-family: var(--font-heading);
    font-size: 14px; font-weight: 700; cursor: pointer; transition: all 0.3s;
}
.connect-wallet-btn:hover { box-shadow: 0 0 30px rgba(255, 215, 0, 0.4); transform: translateY(-1px); }

.panel { display: none; flex: 1; overflow: hidden; }
.panel.active { display: flex; }

.chat-container { flex: 1; display: flex; flex-direction: column; overflow: hidden; }
.chat-messages { flex: 1; overflow-y: auto; padding: 24px; }
.chat-welcome { text-align: center; padding: 60px 20px; max-width: 600px; margin: 0 auto; }
.welcome-avatar { margin: 0 auto 20px; width: 80px; height: 80px; }
.welcome-avatar svg { width: 100%; height: 100%; filter: drop-shadow(0 0 30px rgba(255, 215, 0, 0.3)); }
.chat-welcome h2 { font-family: var(--font-heading); font-size: 24px; margin-bottom: 8px; }
.chat-welcome p { color: var(--text-secondary); font-size: 14px; margin-bottom: 24px; }
.welcome-chips { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; }
.chip {
    padding: 8px 16px; border-radius: 20px; border: 1px solid var(--border);
    background: var(--bg-card); color: var(--text-secondary);
    font-size: 13px; cursor: pointer; transition: all 0.3s; font-family: var(--font-body);
}
.chip:hover { border-color: var(--star-gold); color: var(--star-gold); background: rgba(255, 215, 0, 0.06); }

.message { display: flex; gap: 12px; margin-bottom: 20px; max-width: 800px; animation: msgIn 0.3s ease; }
@keyframes msgIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }
.message.user { flex-direction: row-reverse; }
.msg-avatar { width: 36px; height: 36px; border-radius: 50%; flex-shrink: 0; }
.msg-avatar svg { width: 100%; height: 100%; }
.msg-avatar.user-avatar {
    background: linear-gradient(135deg, var(--ton-blue), var(--ton-blue-deep));
    display: flex; align-items: center; justify-content: center;
    font-size: 12px; font-weight: 700; color: white;
}
.msg-bubble { padding: 14px 18px; border-radius: 16px; font-size: 14px; line-height: 1.7; max-width: 600px; }
.message.ai .msg-bubble { background: var(--bg-card); border: 1px solid var(--border); }
.message.user .msg-bubble { background: linear-gradient(135deg, rgba(34, 158, 217, 0.18), rgba(0, 136, 204, 0.10)); border: 1px solid rgba(34, 158, 217, 0.30); }
.msg-persona-tag { font-size: 11px; font-weight: 700; letter-spacing: 1px; margin-bottom: 6px; display: block; }
.msg-code { background: rgba(0,0,0,0.3); padding: 10px 14px; border-radius: 8px; font-family: var(--font-mono); font-size: 12px; margin: 8px 0; overflow-x: auto; }

.typing-indicator { display: flex; gap: 4px; padding: 8px 0; }
.typing-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--star-gold); animation: typingBounce 1.4s ease-in-out infinite; }
.typing-dot:nth-child(2) { animation-delay: 0.2s; }
.typing-dot:nth-child(3) { animation-delay: 0.4s; }
@keyframes typingBounce { 0%,60%,100% { transform: translateY(0); } 30% { transform: translateY(-8px); } }

.chat-input-area { padding: 16px 24px; border-top: 1px solid var(--border); }
.chat-input-box {
    display: flex; align-items: center; gap: 12px;
    padding: 14px 20px; border-radius: 16px;
    background: var(--bg-input); border: 1px solid var(--border);
    transition: border-color 0.3s;
}
.chat-input-box:focus-within { border-color: var(--star-gold); }
#chatInput { flex: 1; background: none; border: none; outline: none; color: var(--text); font-size: 15px; font-family: var(--font-body); }
#chatInput::placeholder { color: var(--text-muted); }
.send-btn {
    width: 40px; height: 40px; border-radius: 12px;
    background: linear-gradient(135deg, var(--star-gold), var(--star-orange));
    border: none; color: #1a1500; cursor: pointer; display: flex;
    align-items: center; justify-content: center; transition: all 0.3s; flex-shrink: 0;
}
.send-btn:hover { box-shadow: 0 0 20px rgba(255, 215, 0, 0.5); transform: scale(1.05); }
.chat-disclaimer { display: block; text-align: center; font-size: 11px; color: var(--text-muted); margin-top: 8px; }

.info-panel {
    width: 300px; border-left: 1px solid var(--border);
    overflow-y: auto; padding: 20px; flex-shrink: 0;
}
.info-card { margin-bottom: 20px; padding: 16px; border-radius: 14px; background: var(--bg-card); border: 1px solid var(--border); }
.info-title { font-family: var(--font-heading); font-size: 14px; font-weight: 700; color: var(--text-muted); letter-spacing: 1px; text-transform: uppercase; margin-bottom: 12px; }

.active-persona { display: flex; align-items: center; gap: 12px; }
.persona-card-img { width: 48px; height: 48px; border-radius: 50%; flex-shrink: 0; }
.persona-card-img svg { width: 100%; height: 100%; }
.persona-card-name { display: block; font-family: var(--font-heading); font-size: 16px; font-weight: 700; }
.persona-card-desc { font-size: 12px; color: var(--text-muted); }

.stats-list .stat-row { display: flex; justify-content: space-between; padding: 8px 0; border-bottom: 1px solid rgba(34, 158, 217, 0.06); }
.stats-list .stat-label { font-size: 13px; color: var(--text-muted); }
.stats-list .stat-value { font-size: 13px; font-weight: 600; font-family: var(--font-mono); }

.trending-item { display: flex; align-items: center; gap: 10px; padding: 8px 0; }
.trending-rank { font-family: var(--font-mono); font-size: 12px; color: var(--text-muted); width: 20px; }
.trending-name { font-weight: 600; font-size: 13px; flex: 1; }
.trending-change { font-size: 12px; font-weight: 700; font-family: var(--font-mono); }

.signal-item { display: flex; align-items: center; gap: 8px; padding: 8px 0; }
.signal-badge { font-size: 10px; font-weight: 800; padding: 3px 8px; border-radius: 6px; letter-spacing: 0.5px; }
.signal-badge.buy { background: rgba(34, 197, 94, 0.10); color: var(--green); border: 1px solid rgba(34, 197, 94, 0.25); }
.signal-badge.warn { background: rgba(239, 68, 68, 0.10); color: #ef4444; border: 1px solid rgba(239, 68, 68, 0.25); }
.signal-token { font-size: 13px; font-weight: 600; flex: 1; }
.signal-time { font-size: 11px; color: var(--text-muted); }

.dashboard-grid { padding: 24px; display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 20px; overflow-y: auto; }
.dash-card { background: var(--bg-card); border: 1px solid var(--border); border-radius: 16px; padding: 24px; }
.dash-card.wide { grid-column: 1 / -1; }
.dash-card h3 { font-family: var(--font-heading); font-size: 18px; margin-bottom: 16px; }
.dash-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 16px; }
.dash-stat { text-align: center; padding: 16px; border-radius: 12px; background: rgba(34, 158, 217, 0.05); border: 1px solid var(--border); }
.dash-stat-label { display: block; font-size: 12px; color: var(--text-muted); margin-bottom: 6px; }
.dash-stat-value { font-family: var(--font-display); font-size: 20px; font-weight: 700; background: linear-gradient(135deg, var(--star-gold), var(--star-orange)); -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text; }

.portfolio-empty { text-align: center; padding: 30px; color: var(--text-muted); }
.portfolio-empty p { font-size: 14px; margin: 12px 0; }
.btn-connect-sm { padding: 10px 24px; border-radius: 10px; background: linear-gradient(135deg, var(--star-gold), var(--star-orange)); border: none; color: #1a1500; font-family: var(--font-heading); font-weight: 700; cursor: pointer; }

.portfolio-loaded { padding: 4px 0; }
.portfolio-balance {
    display: flex; justify-content: space-between; align-items: center;
    padding: 14px 16px; border-radius: 12px;
    background: rgba(255, 215, 0, 0.06); border: 1px solid rgba(255, 215, 0, 0.20);
    margin-bottom: 14px;
}
.pb-label { font-size: 12px; color: var(--text-muted); text-transform: uppercase; letter-spacing: 1px; }
.pb-value { font-family: var(--font-mono); font-size: 18px; font-weight: 700; color: var(--star-gold); }
.portfolio-jettons { display: flex; flex-direction: column; gap: 6px; max-height: 200px; overflow-y: auto; }
.jetton-row {
    display: flex; justify-content: space-between; align-items: center;
    padding: 8px 14px; border-radius: 8px;
    background: rgba(34, 158, 217, 0.05); border: 1px solid var(--border);
    font-size: 13px;
}
.jr-symbol { font-weight: 600; color: var(--text); }
.jr-amount { font-family: var(--font-mono); color: var(--text-secondary); }

.insights-list .insight { display: flex; gap: 10px; padding: 10px 0; border-bottom: 1px solid rgba(34, 158, 217, 0.06); font-size: 13px; color: var(--text-secondary); }
.insight-icon { font-size: 16px; flex-shrink: 0; }

.signals-full { padding: 24px; overflow-y: auto; height: 100%; }
.signals-full h2 { font-family: var(--font-heading); font-size: 24px; margin-bottom: 4px; }
.panel-subtitle { color: var(--text-muted); font-size: 14px; margin-bottom: 24px; }
.signals-table { width: 100%; }
.signal-header-row, .signal-row { display: grid; grid-template-columns: 140px 1fr 100px 100px 100px; padding: 12px 16px; gap: 12px; align-items: center; }
.signal-header-row { font-size: 12px; color: var(--text-muted); font-weight: 700; text-transform: uppercase; letter-spacing: 1px; border-bottom: 1px solid var(--border); }
.signal-row { border-bottom: 1px solid rgba(34, 158, 217, 0.06); font-size: 14px; transition: background 0.2s; }
.signal-row:hover { background: rgba(34, 158, 217, 0.06); }
.confidence { font-family: var(--font-mono); font-weight: 700; }
.confidence.high { color: var(--green); }
.confidence.mid { color: var(--star-gold); }

.analytics-content { padding: 24px; overflow-y: auto; height: 100%; }
.analytics-content h2 { font-family: var(--font-heading); font-size: 24px; margin-bottom: 4px; }
.analytics-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.analytics-card { background: var(--bg-card); border: 1px solid var(--border); border-radius: 14px; padding: 20px; }
.analytics-card h4 { font-family: var(--font-heading); font-size: 16px; margin-bottom: 14px; color: var(--text-secondary); }
.gainer { display: flex; justify-content: space-between; padding: 8px 0; font-size: 14px; border-bottom: 1px solid rgba(34, 158, 217, 0.06); }
.flow-bar { display: flex; border-radius: 8px; overflow: hidden; height: 32px; margin-bottom: 8px; }
.flow-in { background: rgba(34, 197, 94, 0.20); color: var(--green); display: flex; align-items: center; justify-content: center; font-size: 12px; font-weight: 700; }
.flow-out { background: rgba(239, 68, 68, 0.20); color: #ef4444; display: flex; align-items: center; justify-content: center; font-size: 12px; font-weight: 700; }
.flow-note { font-size: 12px; color: var(--green); }
.safety-check .check-item { padding: 8px 0; font-size: 14px; display: flex; gap: 8px; }
.check-item.safe { color: var(--green); }
.check-item.warn { color: #ef4444; }

.whale-content { padding: 24px; overflow-y: auto; height: 100%; }
.whale-content h2 { font-family: var(--font-heading); font-size: 24px; margin-bottom: 4px; }
.whale-header-row, .whale-row { display: grid; grid-template-columns: 140px 80px 100px 120px 100px; padding: 12px 16px; gap: 12px; align-items: center; }
.whale-header-row { font-size: 12px; color: var(--text-muted); font-weight: 700; text-transform: uppercase; letter-spacing: 1px; border-bottom: 1px solid var(--border); }
.whale-row { border-bottom: 1px solid rgba(34, 158, 217, 0.06); font-size: 14px; transition: background 0.2s; }
.whale-row:hover { background: rgba(34, 158, 217, 0.06); }
.whale-addr { font-family: var(--font-mono); font-size: 13px; color: var(--star-gold); }
.whale-action { font-weight: 700; font-size: 12px; }
.buy-action { color: var(--green); }
.sell-action { color: #ef4444; }

::-webkit-scrollbar { width: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(34, 158, 217, 0.25); border-radius: 3px; }
::selection { background: rgba(255, 215, 0, 0.3); color: #1a1500; }

@media (max-width: 1100px) {
    .info-panel { display: none; }
}
@media (max-width: 768px) {
    .sidebar { position: fixed; left: 0; top: 0; transform: translateX(-100%); }
    .sidebar.open { transform: translateX(0); }
    .mobile-sidebar-toggle { display: block; }
    .main-content { width: 100%; }
    .dapp-header { padding: 16px 16px 16px 60px; }
    .header-chain { display: none; }
    .signal-header-row, .signal-row { grid-template-columns: 100px 1fr 80px; }
    .signal-header-row span:nth-child(3), .signal-header-row span:nth-child(5),
    .signal-row span:nth-child(3), .signal-row span:nth-child(5) { display: none; }
    .whale-header-row, .whale-row { grid-template-columns: 100px 60px 1fr 80px; }
    .whale-header-row span:nth-child(5), .whale-row span:nth-child(5) { display: none; }
    .analytics-grid { grid-template-columns: 1fr; }
}
