:root {
  --bg: #0b0c0f;
  --surface: #14161b;
  --surface-2: #1c1f27;
  --surface-3: #23262f;
  --text: #e8e9ec;
  --text-secondary: #9aa0a6;
  --accent: #E82127;
  --accent-hover: #ff2d33;
  --positive: #00c853;
  --negative: #ff1744;
  --border: rgba(255,255,255,0.06);
  --radius: 14px;
  --shadow: 0 10px 30px rgba(0,0,0,0.35);
}

* { box-sizing: border-box; margin: 0; }
html, body { height: 100%; }
body {
  font-family: 'Inter', system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

/* Header */
.site-header {
  position: sticky; top: 0; z-index: 50;
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 24px;
  background: rgba(11,12,15,0.9);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
}
.brand { display: flex; align-items: center; gap: 12px; }
.brand-mark {
  width: 36px; height: 36px; border-radius: 8px;
  background: var(--accent); color: #fff;
  display: grid; place-items: center; font-weight: 800; font-size: 18px;
}
.brand h1 { font-size: 20px; font-weight: 800; letter-spacing: -0.3px; }
.brand-sub { font-size: 12px; color: var(--text-secondary); margin-top: 2px; }
.last-updated { font-size: 12px; color: var(--text-secondary); }

/* Main */
main { width: 100%; max-width: 1200px; margin: 0 auto; padding: 24px; }

/* Panels */
.panel {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  margin-bottom: 20px; box-shadow: var(--shadow); overflow: hidden;
}
.panel-head {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; padding: 16px 20px; border-bottom: 1px solid var(--border);
  flex-wrap: wrap;
}
.panel-head h2 { font-size: 16px; font-weight: 700; margin: 0; }
.panel-sub { font-size: 12px; color: var(--text-secondary); }
.panel-body { padding: 20px; position: relative; }

/* Hero */
.hero .panel-body {
  background: linear-gradient(180deg, rgba(232,33,39,0.12), rgba(232,33,39,0.02));
}
.hero-price {
  font-size: clamp(40px, 5vw, 64px); font-weight: 800;
  letter-spacing: -1.5px; line-height: 1;
}
.hero-change {
  font-size: 18px; font-weight: 700; padding: 8px 12px;
  border-radius: 10px; background: var(--surface-3);
  display: inline-block; margin-top: 8px;
}
.hero-change.up { color: var(--positive); }
.hero-change.down { color: var(--negative); }
.hero-meta {
  margin-top: 12px; font-size: 13px; color: var(--text-secondary);
  display: flex; flex-wrap: wrap; gap: 8px 16px;
}

/* Chart */
.chart-panel .panel-body { padding: 16px 20px 20px; }
.chart-wrap { position: relative; height: 380px; }
.range-toggles { display: flex; gap: 6px; flex-wrap: wrap; }
.range-btn {
  background: var(--surface-2); color: var(--text-secondary);
  border: 1px solid var(--border); padding: 6px 14px;
  border-radius: 8px; font-size: 12px; font-weight: 700;
  cursor: pointer; transition: all .15s ease;
}
.range-btn:hover { color: var(--text); background: var(--surface-3); }
.range-btn.active { background: var(--accent); color: #fff; border-color: var(--accent); }

/* Stats grid */
.stats-grid {
  display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px;
}
@media (min-width: 720px) {
  .stats-grid { grid-template-columns: repeat(3, 1fr); }
}
.stats-grid > div {
  display: flex; justify-content: space-between; align-items: center;
  background: var(--surface-2); border: 1px solid var(--border);
  border-radius: 10px; padding: 12px 14px;
}
.stats-grid dt { font-size: 12px; color: var(--text-secondary); }
.stats-grid dd { font-size: 14px; font-weight: 700; margin: 0; }

/* Two column layout */
.two-col { display: grid; grid-template-columns: 1fr; gap: 20px; }
@media (min-width: 960px) {
  .two-col { grid-template-columns: 1fr 1fr; }
}

/* Feed lists (news + tweets) */
.feed-list { list-style: none; padding: 0; display: flex; flex-direction: column; gap: 12px; }
.feed-list li {
  background: var(--surface-2); border: 1px solid var(--border);
  border-radius: 12px; padding: 14px;
  transition: transform .15s ease, border-color .15s ease;
}
.feed-list li:hover { transform: translateY(-1px); border-color: rgba(232,33,39,0.35); }
.feed-list a { color: var(--text); text-decoration: none; font-weight: 600; font-size: 14px; }
.feed-list a:hover { color: var(--accent-hover); text-decoration: underline; }
.feed-list .meta { font-size: 12px; color: var(--text-secondary); margin-top: 6px; }

/* Tweets specific */
#tweets-list .tweet-header { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; }
#tweets-list .tweet-avatar {
  width: 34px; height: 34px; border-radius: 50%; background: var(--surface-3);
  display: grid; place-items: center; font-size: 16px; flex-shrink: 0;
}
#tweets-list .tweet-name { font-weight: 700; font-size: 13px; }
#tweets-list .tweet-handle { color: var(--text-secondary); font-size: 12px; }
#tweets-list .tweet-text { font-size: 13px; line-height: 1.5; }
#tweets-list .tweet-date { font-size: 11px; color: var(--text-secondary); margin-top: 8px; }

/* Table */
.table-wrap { overflow-x: auto; border-radius: 12px; border: 1px solid var(--border); }
.history-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.history-table thead th {
  background: var(--surface-2); color: var(--text-secondary); font-weight: 600;
  text-align: left; padding: 12px 14px; white-space: nowrap;
  border-bottom: 1px solid var(--border);
}
.history-table tbody tr:nth-child(even) { background: rgba(255,255,255,0.02); }
.history-table tbody td {
  padding: 12px 14px; border-bottom: 1px solid var(--border);
  color: var(--text); white-space: nowrap;
}
.history-table tbody tr:last-child td { border-bottom: none; }
.history-table .up { color: var(--positive); }
.history-table .down { color: var(--negative); }

/* Offline banner */
.offline-banner {
  padding: 16px; border-radius: 10px;
  background: rgba(232,33,39,0.08); border: 1px solid rgba(232,33,39,0.25);
  color: var(--text); font-size: 13px; text-align: center;
}

/* Skeletons */
.skeleton {
  background: linear-gradient(90deg, var(--surface-2) 25%, var(--surface-3) 50%, var(--surface-2) 75%);
  background-size: 200% 100%; animation: shimmer 1.6s infinite;
  border-radius: 10px;
}
.skeleton-hero { height: 120px; }
.skeleton-chart { height: 380px; }
.skeleton-stats { height: 200px; }
.skeleton-feed { height: 300px; }
.skeleton-table { height: 300px; }
@keyframes shimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* Footer */
.site-footer {
  text-align: center; padding: 24px; color: var(--text-secondary);
  font-size: 12px; border-top: 1px solid var(--border);
}

/* Scrollbar */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--surface-3); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: #2e3340; }

/* Utility */
[hidden] { display: none !important; }
