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

body {
    font-family: 'Rajdhani', sans-serif;
    background: #0a0a12;
    color: #c9d1d9;
    line-height: 1.6;
    padding: 2rem 1rem;
    overflow-x: hidden;
}

/* ── Neural network background ─────────────────────────────────────── */
.neural-bg {
    position: fixed;
    inset: 0;
    z-index: 0;
    pointer-events: none;
}

.neural-bg canvas {
    width: 100%;
    height: 100%;
}

/* ── Orbiting brain orb ────────────────────────────────────────────── */
.brain-orb {
    position: relative;
    width: 120px;
    height: 120px;
    margin: 0 auto 1.5rem;
}

.brain-orb .core {
    position: absolute;
    inset: 0;
    border-radius: 50%;
    background: radial-gradient(circle at 40% 35%, rgba(124, 77, 255, 0.5), rgba(0, 229, 255, 0.15) 60%, transparent 72%);
    animation: pulse-core 4s ease-in-out infinite;
}

.brain-orb .ring {
    position: absolute;
    inset: -10px;
    border-radius: 50%;
    border: 1px solid rgba(0, 229, 255, 0.2);
    animation: spin-ring 20s linear infinite;
}

.brain-orb .ring::before {
    content: '';
    position: absolute;
    top: -3px;
    left: 50%;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #00e5ff;
    box-shadow: 0 0 12px #00e5ff, 0 0 30px rgba(0, 229, 255, 0.4);
}

.brain-orb .ring-2 {
    inset: -25px;
    border-color: rgba(179, 136, 255, 0.15);
    animation-duration: 30s;
    animation-direction: reverse;
}

.brain-orb .ring-2::before {
    background: #b388ff;
    box-shadow: 0 0 12px #b388ff, 0 0 30px rgba(179, 136, 255, 0.4);
}

.brain-orb .ring-3 {
    inset: -40px;
    border-color: rgba(224, 64, 251, 0.1);
    animation-duration: 45s;
}

.brain-orb .ring-3::before {
    background: #e040fb;
    box-shadow: 0 0 10px #e040fb, 0 0 24px rgba(224, 64, 251, 0.3);
}

@keyframes pulse-core {
    0%, 100% { transform: scale(1); opacity: 0.8; }
    50%      { transform: scale(1.06); opacity: 1; }
}

@keyframes spin-ring {
    from { transform: rotate(0deg); }
    to   { transform: rotate(360deg); }
}

/* ── Container ─────────────────────────────────────────────────────── */
.container {
    position: relative;
    z-index: 1;
    max-width: 800px;
    margin: 0 auto;
}

h1.page-title {
    font-family: 'Orbitron', sans-serif;
    font-size: 1.6rem;
    font-weight: 900;
    letter-spacing: 0.12em;
    text-align: center;
    background: linear-gradient(135deg, #00e5ff 0%, #b388ff 50%, #e040fb 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    filter: drop-shadow(0 0 20px rgba(0, 229, 255, 0.2));
    margin-bottom: 0.25rem;
}

.subtitle {
    font-size: 0.9rem;
    color: #8a8aa0;
    text-align: center;
    letter-spacing: 0.04em;
    margin-bottom: 2rem;
}

.disclaimer {
    font-size: 0.75rem;
    color: #5a5a6e;
    text-align: center;
    letter-spacing: 0.03em;
    margin-bottom: 1rem;
    font-style: italic;
}

/* ── Title row + version badge ─────────────────────────────────────── */
.title-row {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.6rem;
    margin-bottom: 0.25rem;
}

.version-badge {
    font-family: 'Rajdhani', sans-serif;
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    color: #8a8aa0;
    background: rgba(138, 138, 160, 0.1);
    border: 1px solid rgba(138, 138, 160, 0.25);
    border-radius: 999px;
    padding: 0.15rem 0.55rem;
    flex-shrink: 0;
}

/* ── Back link ─────────────────────────────────────────────────────── */
.back-link {
    display: inline-block;
    font-family: 'Rajdhani', sans-serif;
    font-weight: 600;
    font-size: 0.9rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: #8a8aa0;
    text-decoration: none;
    padding: 0.4rem 0.8rem;
    border-radius: 4px;
    margin-bottom: 1.5rem;
    transition: color 0.2s, background 0.2s, box-shadow 0.2s;
}

.back-link:hover {
    color: #00e5ff;
    background: rgba(0, 229, 255, 0.06);
    box-shadow: inset 0 0 0 1px rgba(0, 229, 255, 0.15);
}

/* ── Shared section styling ────────────────────────────────────────── */
.info-section {
    margin-bottom: 1.5rem;
}

.section-header {
    font-family: 'Orbitron', sans-serif;
    font-size: 0.95rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    color: #00e5ff;
    margin-bottom: 0.75rem;
    padding-bottom: 0.4rem;
    border-bottom: 1px solid rgba(0, 229, 255, 0.1);
}

.section-timestamp {
    font-size: 0.7rem;
    color: #484f58;
    margin-top: 0.6rem;
    text-align: center;
}

/* ── Shared card component ─────────────────────────────────────────── */
.info-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0.75rem;
}

.card {
    background: rgba(15, 15, 30, 0.7);
    border: 1px solid rgba(0, 229, 255, 0.08);
    border-radius: 10px;
    padding: 1rem;
    text-align: center;
    transition: border-color 0.2s;
}

.card:hover {
    border-color: #58a6ff;
}

.card-icon {
    font-size: 1.75rem;
    margin-bottom: 0.35rem;
}

.card-name {
    font-size: 0.78rem;
    color: #8b949e;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    margin-bottom: 0.3rem;
}

.card-price {
    font-family: 'SF Mono', 'Cascadia Code', 'Fira Code', 'Consolas', monospace;
    font-size: 1.25rem;
    font-weight: 700;
    color: #e6edf3;
}

.card-change {
    font-size: 0.8rem;
    font-weight: 600;
    margin-top: 0.25rem;
}

.card-change.positive { color: #3fb950; }
.card-change.negative { color: #f85149; }

/* ── Sparklines ────────────────────────────────────────────────────── */
.sparkline {
    display: block;
    width: 100%;
    height: 40px;
    margin-top: 0.5rem;
}

/* ── Market Indices ────────────────────────────────────────────────── */
.indices-grid {
    grid-template-columns: repeat(3, 1fr);
}

.index-card {
    padding: 0.85rem 1rem;
}

.index-name {
    font-family: 'Orbitron', sans-serif;
    font-size: 0.72rem;
    font-weight: 700;
    color: #8b949e;
    letter-spacing: 0.06em;
    margin-bottom: 0.35rem;
}

.index-price {
    font-family: 'SF Mono', 'Cascadia Code', 'Fira Code', 'Consolas', monospace;
    font-size: 1.2rem;
    font-weight: 700;
    color: #e6edf3;
}

/* ── Fear & Greed ──────────────────────────────────────────────────── */
.fng-card {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 2rem;
    padding: 1.5rem;
}

.fng-gauge {
    position: relative;
    width: 120px;
    height: 80px;
    flex-shrink: 0;
}

.fng-svg {
    width: 100%;
    height: 100%;
}

.fng-value {
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    font-family: 'Orbitron', sans-serif;
    font-size: 1.8rem;
    font-weight: 900;
}

.fng-info {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}

.fng-label {
    font-family: 'Rajdhani', sans-serif;
    font-size: 1.3rem;
    font-weight: 600;
    color: #e6edf3;
    letter-spacing: 0.04em;
}

.fng-desc {
    font-size: 0.82rem;
    color: #8b949e;
    line-height: 1.5;
    max-width: 320px;
}

/* ── Trade Performance Stats ───────────────────────────────────────── */
.stats-section {
    margin-top: 1.5rem;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 0.75rem;
}

.stat-card {
    background: rgba(15, 15, 30, 0.7);
    border: 1px solid rgba(0, 229, 255, 0.08);
    border-radius: 10px;
    padding: 1rem;
    text-align: center;
}

.stat-label {
    font-size: 0.72rem;
    color: #8b949e;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    margin-bottom: 0.35rem;
}

.stat-value {
    font-family: 'SF Mono', 'Cascadia Code', 'Fira Code', 'Consolas', monospace;
    font-size: 1.2rem;
    font-weight: 700;
    color: #e6edf3;
}

.stat-value.positive { color: #3fb950; }
.stat-value.negative { color: #f85149; }

.stat-detail {
    font-size: 0.72rem;
    color: #484f58;
    margin-top: 0.25rem;
}

/* ── Metal card date (extends .card) ───────────────────────────────── */
.metal-card-date {
    font-size: 0.7rem;
    color: #484f58;
    margin-top: 0.35rem;
}

/* ── Info error / no-data messages ─────────────────────────────────── */
.info-error,
.info-no-data {
    grid-column: 1 / -1;
    text-align: center;
    color: #484f58;
    font-size: 0.82rem;
    padding: 1rem;
}

/* ── Report title ──────────────────────────────────────────────────── */
.report-title {
    font-family: 'Orbitron', sans-serif;
    font-size: 1.2rem;
    font-weight: 700;
    color: #e6edf3;
    text-align: center;
    letter-spacing: 0.05em;
    margin-bottom: 1.25rem;
    padding-bottom: 1rem;
    border-bottom: 2px solid rgba(0, 229, 255, 0.3);
}

/* ── Key-value pairs ───────────────────────────────────────────────── */
.kv-pair {
    margin-bottom: 0.35rem;
    font-size: 0.95rem;
}

.kv-label {
    color: #8b949e;
    font-weight: 500;
}

.kv-value {
    color: #c9d1d9;
}

.kv-value.path {
    font-family: 'SF Mono', 'Cascadia Code', 'Fira Code', 'Consolas', monospace;
    font-size: 0.82rem;
    color: #79c0ff;
}

/* ── Bot status badge ──────────────────────────────────────────────── */
.status-row {
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    gap: 0.6rem;
}

.status-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.25rem 0.85rem;
    border-radius: 999px;
    font-size: 0.85rem;
    font-weight: 700;
    letter-spacing: 0.04em;
}

.badge-stopped {
    background: rgba(248, 81, 73, 0.15);
    color: #f85149;
    border: 1px solid rgba(248, 81, 73, 0.3);
}

.badge-running {
    background: rgba(63, 185, 80, 0.15);
    color: #3fb950;
    border: 1px solid rgba(63, 185, 80, 0.3);
}

.badge-neutral {
    background: rgba(139, 148, 158, 0.15);
    color: #8b949e;
    border: 1px solid rgba(139, 148, 158, 0.3);
}

/* ── Metals section ────────────────────────────────────────────────── */
.metals-section {
    margin-bottom: 1.5rem;
}

.metal-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0.75rem;
}

/* ── Subsection headers ────────────────────────────────────────────── */
.subsection-title {
    font-family: 'Orbitron', sans-serif;
    font-size: 0.95rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    color: #00e5ff;
    margin-top: 1.25rem;
    margin-bottom: 0.75rem;
    padding-bottom: 0.4rem;
    border-bottom: 1px solid rgba(0, 229, 255, 0.1);
}

/* ── Movers list ───────────────────────────────────────────────────── */
.movers-list {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}

.mover-row {
    display: flex;
    align-items: baseline;
    gap: 0.6rem;
    padding: 0.5rem 0.75rem;
    background: rgba(255, 255, 255, 0.02);
    border-radius: 6px;
    font-size: 0.85rem;
}

.mover-pct {
    color: #484f58;
    font-family: 'SF Mono', monospace;
    font-size: 0.78rem;
    flex-shrink: 0;
}

.mover-dir {
    font-weight: 700;
    white-space: nowrap;
    flex-shrink: 0;
}

.mover-up   { color: #3fb950; }
.mover-down { color: #f85149; }

.mover-vol {
    color: #8b949e;
    font-size: 0.78rem;
    flex-shrink: 0;
}

.mover-desc {
    color: #c9d1d9;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.mover-raw {
    font-family: 'SF Mono', monospace;
    font-size: 0.82rem;
    color: #c9d1d9;
}

/* ── Generic data blocks ───────────────────────────────────────────── */
pre.data-block {
    background: #0d1117;
    border: 1px solid #21262d;
    border-radius: 6px;
    padding: 0.85rem 1rem;
    font-family: 'SF Mono', 'Cascadia Code', 'Fira Code', 'Consolas', monospace;
    font-size: 0.82rem;
    line-height: 1.7;
    color: #c9d1d9;
    overflow-x: auto;
    margin-bottom: 0.75rem;
}

.report-divider {
    border: none;
    border-top: 1px solid #21262d;
    margin: 1.25rem 0;
}

.plain-text {
    font-size: 0.9rem;
    color: #8b949e;
}

.footer {
    margin-top: 1.5rem;
    text-align: center;
    font-size: 0.75rem;
    color: #484f58;
}

.footer.changelog {
    font-size: 0.65rem;
    color: #30363d;
    margin-top: 0.25rem;
}

/* ── SPY chart ─────────────────────────────────────────────────────── */
.spy-section {
    margin-bottom: 1.5rem;
}

.chart-wrapper {
    background: rgba(15, 15, 30, 0.7);
    border: 1px solid rgba(0, 229, 255, 0.08);
    border-radius: 10px;
    padding: 1rem;
}

.chart-wrapper canvas {
    width: 100%;
    height: auto;
    display: block;
}

.spy-summary {
    display: flex;
    gap: 1.5rem;
    margin-top: 0.75rem;
    flex-wrap: wrap;
}

.spy-stat {
    font-size: 0.82rem;
    color: #8b949e;
}

.spy-stat strong {
    color: #e6edf3;
    font-family: 'SF Mono', 'Cascadia Code', 'Fira Code', 'Consolas', monospace;
}

.spy-stat.positive strong { color: #3fb950; }
.spy-stat.negative strong { color: #f85149; }

/* ── Analysis Section ───────────────────────────────────────────────── */
.analysis-section {
    margin-top: 1.5rem;
}

.analysis-card {
    display: block;
    text-align: left;
}

.analysis-body {
    display: flex;
    flex-direction: column;
    gap: 0.65rem;
}

.analysis-insight {
    font-size: 0.92rem;
    color: #c9d1d9;
    line-height: 1.6;
    margin: 0;
}

.analysis-insight strong {
    color: #e6edf3;
}

.analysis-insight strong.positive { color: #3fb950; }
.analysis-insight strong.negative { color: #f85149; }

.insight {
    font-weight: 600;
}

.insight.positive { color: #3fb950; }
.insight.negative { color: #f85149; }
.insight.warning  { color: #f0b429; }

/* ── Format Warning ─────────────────────────────────────────────────── */
.format-warning {
    background: rgba(240, 180, 41, 0.08);
    border: 1px solid rgba(240, 180, 41, 0.2);
    border-radius: 8px;
    padding: 0.65rem 1rem;
    margin-bottom: 1rem;
    font-size: 0.82rem;
    color: #f0b429;
}

/* ── Responsive ────────────────────────────────────────────────────── */
@media (max-width: 768px) {
    .info-grid,
    .metal-grid { grid-template-columns: repeat(2, 1fr); }
    .stats-grid { grid-template-columns: repeat(2, 1fr); }
    .fng-card { flex-direction: column; gap: 0.75rem; }
    .status-bar { flex-direction: column; align-items: flex-start; }
    .pos-header,
    .pos-row { grid-template-columns: 80px 100px 90px 1fr; font-size: 0.78rem; }
}

@media (max-width: 600px) {
    .info-grid,
    .metal-grid { grid-template-columns: 1fr; }
    .stats-grid { grid-template-columns: repeat(2, 1fr); }
    .mover-row  { flex-wrap: wrap; }
    .mover-desc { white-space: normal; }
    .spy-summary { gap: 0.75rem; }
    .status-left, .status-right { width: 100%; }
    .pos-header,
    .pos-row { grid-template-columns: 1fr; gap: 0.2rem; }
    .pos-header { display: none; }
    .pos-row { padding: 0.75rem 1rem; }
    .pos-symbol::before { content: 'Symbol: '; color: #8b949e; font-size: 0.72rem; }
    .pos-pnl { font-size: 1rem; font-weight: 700; }
}

/* ── Data Source Status Bar ──────────────────────────────────────────── */
.status-bar {
    background: rgba(15, 15, 30, 0.7);
    border: 1px solid rgba(0, 229, 255, 0.08);
    border-radius: 10px;
    padding: 0.75rem 1rem;
    margin-bottom: 1.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    flex-wrap: wrap;
}

.status-left,
.status-right {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.status-indicator {
    font-size: 0.8rem;
    font-weight: 600;
    letter-spacing: 0.04em;
}

.status-indicator.all-ok { color: #3fb950; }
.status-indicator.partial { color: #f0b429; }

.source-dot {
    font-size: 0.72rem;
    color: #8b949e;
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
}

.source-dot.online { color: #3fb950; }
.source-dot.offline { color: #f85149; }

.report-age {
    font-size: 0.8rem;
    color: #8b949e;
}

.report-age strong {
    color: #c9d1d9;
}

/* ── Position Breakdown ──────────────────────────────────────────────── */
.positions-section {
    margin-top: 1.5rem;
}

.positions-table {
    background: rgba(15, 15, 30, 0.7);
    border: 1px solid rgba(0, 229, 255, 0.08);
    border-radius: 10px;
    overflow: hidden;
}

.pos-header,
.pos-row {
    display: grid;
    grid-template-columns: 100px 140px 110px 1fr;
    gap: 0.5rem;
    padding: 0.6rem 1rem;
    font-size: 0.85rem;
    align-items: center;
}

.pos-header {
    background: rgba(0, 229, 255, 0.05);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: #8b949e;
    font-size: 0.72rem;
}

.pos-row:not(:last-child) {
    border-bottom: 1px solid rgba(255, 255, 255, 0.03);
}

.pos-symbol {
    font-family: 'Orbitron', sans-serif;
    font-weight: 700;
    font-size: 0.8rem;
    color: #e6edf3;
}

.pos-side {
    font-weight: 600;
}

.pos-side.long { color: #3fb950; }
.pos-side.short { color: #f85149; }

.pos-entry {
    font-family: 'SF Mono', monospace;
    color: #8b949e;
    font-size: 0.8rem;
}

.pos-pnl {
    font-family: 'SF Mono', monospace;
    font-weight: 700;
    text-align: right;
}

.pos-pnl.positive { color: #3fb950; }
.pos-pnl.negative { color: #f85149; }

.pos-total {
    background: rgba(0, 229, 255, 0.05);
    font-weight: 700;
    border-top: 1px solid rgba(0, 229, 255, 0.15);
}

/* ── Format Warning ─────────────────────────────────────────────────── */
.format-warning {
    background: rgba(240, 180, 41, 0.1);
    border: 1px solid rgba(240, 180, 41, 0.25);
    border-radius: 8px;
    padding: 0.75rem 1rem;
    margin-bottom: 1rem;
    font-size: 0.82rem;
    color: #f0b429;
}

/* ── Responsive ────────────────────────────────────────────────────── */
@media (max-width: 768px) {
    .info-grid,
    .metal-grid { grid-template-columns: repeat(2, 1fr); }
    .stats-grid { grid-template-columns: repeat(2, 1fr); }
    .fng-card { flex-direction: column; gap: 0.75rem; }
    .status-bar { flex-direction: column; align-items: flex-start; }
    .pos-header,
    .pos-row { grid-template-columns: 80px 1fr 1fr; }
    .pos-entry { display: none; }
}

@media (max-width: 600px) {
    .info-grid,
    .metal-grid { grid-template-columns: 1fr; }
    .stats-grid { grid-template-columns: repeat(2, 1fr); }
    .mover-row  { flex-wrap: wrap; }
    .mover-desc { white-space: normal; }
    .spy-summary { gap: 0.75rem; }
    .pos-header,
    .pos-row { grid-template-columns: 1fr 1fr; }
    .pos-side { order: 1; }
    .pos-pnl { text-align: left; }
    .source-dot { font-size: 0.65rem; }
    .status-left,
    .status-right { width: 100%; }
}
