:root {
  --bg: #0b1018;
  --surface: #111826;
  --surface-2: #1a2230;
  --border: #2a3550;
  --text: #e6edf7;
  --muted: #8593a8;
  --up: #3fd07a;
  --down: #ff5b5b;
  --accent: #4d9fff;
  --gold: #ffb84c;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: 'Inter', -apple-system, Segoe UI, Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

.topbar {
  position: sticky;
  top: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  gap: 24px;
  padding: 12px 24px;
  background: rgba(11, 16, 24, 0.92);
  backdrop-filter: blur(6px);
  border-bottom: 1px solid var(--border);
}

.brand { display: flex; align-items: center; gap: 10px; font-size: 18px; }
.brand-logo { width: 26px; height: 26px; }
.topbar nav { display: flex; gap: 16px; }
.topbar nav a { color: var(--muted); font-weight: 500; }
.topbar nav a.active { color: var(--text); }
.topbar nav .nav-icon { width: 16px; height: 16px; vertical-align: -3px; margin-right: 5px; }
.topbar-right { margin-left: auto; display: flex; align-items: center; gap: 12px; }

.updated { color: var(--muted); font-size: 0.8rem; }

main { max-width: 1180px; margin: 0 auto; padding: 24px 20px; }

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 20px;
  margin-bottom: 24px;
}

.card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
  flex-wrap: wrap;
}
.card-head h1, .card-head h2 { margin: 0; }
.card-head h1 { font-size: 22px; }
.card-head h2 { font-size: 17px; }

.muted { color: var(--muted); font-size: 0.85rem; }
.mono { font-family: 'JetBrains Mono', monospace; }
.coin-icon {
  width: 13px;
  height: 13px;
  vertical-align: -2px;
  margin-right: 4px;
}
.coin-price { display: inline-flex; align-items: center; }
.country-flag {
  width: 20px;
  height: 14px;
  object-fit: cover;
  border-radius: 2px;
  border: 1px solid rgba(127, 127, 127, 0.35);
  vertical-align: -2px;
  margin-left: 4px;
}
.note { color: var(--muted); font-size: 0.78rem; margin-top: 8px; }

.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; font-size: 0.9rem; }
.table th, .table td { padding: 9px 12px; text-align: left; border-bottom: 1px solid var(--border); white-space: nowrap; }
.table th { color: var(--muted); font-weight: 600; font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.03em; }
.table th.num, .table td.num { text-align: right; }
.table tbody tr:hover { background: var(--surface-2); }
.loading { text-align: center; color: var(--muted); padding: 24px; }

.item-cell { display: flex; align-items: center; gap: 10px; }
.item-icon { width: 30px; height: 30px; border-radius: 50%; background: var(--surface-2); object-fit: contain; }
.item-link { font-weight: 600; color: var(--text); }
.item-link:hover { color: var(--accent); text-decoration: none; }

.up { color: var(--up); }
.down { color: var(--down); }
.flat { color: var(--muted); }

.badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 6px;
  font-size: 0.75rem;
  font-weight: 600;
}
.badge.buy { background: rgba(63, 208, 122, 0.15); color: var(--up); }
.badge.sell { background: rgba(255, 91, 91, 0.15); color: var(--down); }

.item-header {
  display: flex;
  align-items: center;
  gap: 20px;
  flex-wrap: wrap;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 20px;
  margin-bottom: 24px;
}
.item-icon-lg { width: 52px; height: 52px; border-radius: 10px; background: var(--surface-2); object-fit: contain; }
.item-header h1 { margin: 0; font-size: 24px; }
.stat { min-width: 110px; }
.stat .stat-label { color: var(--muted); font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.04em; }
.stat .stat-value { font-size: 1.15rem; font-weight: 700; font-family: 'JetBrains Mono', monospace; }

.breadcrumbs { color: var(--muted); margin-bottom: 16px; }

.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; }
@media (max-width: 900px) { .two-col { grid-template-columns: 1fr; } }

.select, .btn, input[type="number"] {
  background: var(--surface-2);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 8px 12px;
  font-size: 0.85rem;
}
.btn { cursor: pointer; font-weight: 600; }
.btn.primary { background: var(--accent); border-color: transparent; color: #0b1018; }
.btn.small { padding: 4px 10px; font-size: 0.75rem; }
.btn:hover { filter: brightness(1.1); }

#price-chart { max-height: 340px; }

/* Alerts panel */
.alerts-panel {
  position: fixed;
  top: 0;
  right: 0;
  height: 100%;
  width: 360px;
  max-width: 92vw;
  background: var(--surface);
  border-left: 1px solid var(--border);
  padding: 20px;
  z-index: 100;
  box-shadow: -12px 0 30px rgba(0,0,0,0.4);
  overflow-y: auto;
}
.alerts-panel.hidden { display: none; }
.alerts-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.alerts-form { display: flex; flex-direction: column; gap: 8px; margin-bottom: 16px; }
.alert-list { list-style: none; padding: 0; margin: 0; }
.alert-list li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  margin-bottom: 8px;
  background: var(--surface-2);
}
.alert-del { background: none; border: none; color: var(--down); cursor: pointer; font-size: 15px; }

/* Bonus page */
.bonus-main { cursor: pointer; }
.bonus-detail td.detail-cell { padding: 0; background: var(--surface-2); }
.detail-block { padding: 14px 18px 18px; }
.detail-block h4 { margin: 0 0 8px; font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.04em; color: var(--muted); }
.detail-block + .detail-block { border-top: 1px solid var(--border); }
.sub-table { font-size: 0.85rem; }
.sub-table th, .sub-table td { padding: 7px 10px; }
.sub-table tbody tr:hover { background: rgba(77, 159, 255, 0.06); }
.chev { font-size: 0.72rem; white-space: nowrap; }
