:root {
  --bg: #050711;
  --panel: #0c1224;
  --panel-2: #11182d;
  --line: rgba(255,255,255,.09);
  --text: #f4f7ff;
  --muted: #8b96b5;
  --green: #10d89b;
  --red: #ff4d6d;
  --blue: #5b8cff;
  --purple: #9b5cff;
  --yellow: #ffd166;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: Inter, Arial, sans-serif;
  background:
    radial-gradient(circle at 10% 5%, rgba(91,140,255,.20), transparent 32%),
    radial-gradient(circle at 90% 10%, rgba(155,92,255,.14), transparent 28%),
    var(--bg);
  color: var(--text);
}

button, input, select {
  font: inherit;
}

button {
  cursor: pointer;
  border: 0;
  border-radius: 14px;
  padding: 12px 15px;
  color: #fff;
  font-weight: 800;
  background: linear-gradient(135deg, var(--blue), var(--purple));
}

input, select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(255,255,255,.055);
  color: #fff;
  padding: 13px 14px;
  outline: none;
}

option { color: #111827; }

.top-header {
  height: 76px;
  padding: 0 28px;
  border-bottom: 1px solid var(--line);
  background: rgba(5,7,17,.82);
  backdrop-filter: blur(18px);
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 20;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-logo {
  width: 44px;
  height: 44px;
  border-radius: 15px;
  display: grid;
  place-items: center;
  font-weight: 900;
  background: linear-gradient(135deg, var(--blue), var(--purple));
}

.brand span {
  display: block;
  color: var(--muted);
  font-size: 12px;
}

.top-header nav {
  display: flex;
  gap: 8px;
}

.top-header nav a {
  color: var(--muted);
  text-decoration: none;
  padding: 10px 13px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 700;
}

.top-header nav a:hover {
  color: white;
  background: rgba(255,255,255,.06);
}

.app-shell {
  display: grid;
  grid-template-columns: 270px 1fr;
  min-height: calc(100vh - 76px);
}

.sidebar {
  border-right: 1px solid var(--line);
  padding: 24px 18px;
  background: rgba(5,7,17,.45);
}

.menu-title {
  color: var(--muted);
  font-size: 11px;
  font-weight: 900;
  letter-spacing: .12em;
  text-transform: uppercase;
  margin: 12px;
}

.sidebar a {
  display: block;
  padding: 13px 14px;
  margin: 7px 0;
  border-radius: 15px;
  color: #c8d2ef;
  cursor: pointer;
}

.sidebar a.active,
.sidebar a:hover {
  background: rgba(91,140,255,.12);
  color: white;
}

.sidebar-note {
  margin-top: 24px;
  padding: 16px;
  border-radius: 20px;
  border: 1px solid var(--line);
  background: rgba(255,255,255,.04);
}

.sidebar-note p {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
}

.main {
  padding: 28px;
  min-width: 0;
}

.hero {
  display: flex;
  justify-content: space-between;
  gap: 22px;
  align-items: flex-end;
  margin-bottom: 20px;
}

.hero h1 {
  margin: 0;
  font-size: clamp(32px, 4vw, 54px);
  line-height: .95;
  letter-spacing: -.06em;
}

.hero p {
  color: var(--muted);
  margin: 12px 0 0;
}

.search-box {
  min-width: min(420px, 100%);
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
  margin-bottom: 18px;
}

.stat-card {
  border: 1px solid var(--line);
  border-radius: 26px;
  background: rgba(12,18,36,.82);
  padding: 20px;
  box-shadow: 0 24px 70px rgba(0,0,0,.35);
}

.stat-card span {
  color: var(--muted);
  font-size: 13px;
}

.stat-card strong {
  display: block;
  margin-top: 10px;
  font-size: 30px;
}

.content-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.55fr) 360px;
  gap: 18px;
  align-items: start;
}

.market-panel,
.box {
  border: 1px solid var(--line);
  border-radius: 26px;
  background: rgba(12,18,36,.86);
  overflow: hidden;
  box-shadow: 0 24px 70px rgba(0,0,0,.35);
}

.panel-head {
  padding: 20px 22px 0;
}

.panel-head h2 {
  margin: 0;
}

.panel-head p {
  color: var(--muted);
  margin: 6px 0 0;
  font-size: 13px;
}

table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 12px;
}

th, td {
  padding: 16px 22px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  font-size: 14px;
}

th {
  color: var(--muted);
  text-transform: uppercase;
  font-size: 11px;
  letter-spacing: .08em;
}

tbody tr {
  cursor: pointer;
  transition: .16s ease;
}

tbody tr:hover {
  background: rgba(255,255,255,.045);
}

.coin-cell {
  display: flex;
  align-items: center;
  gap: 12px;
}

.coin-icon,
.coin-logo {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-weight: 900;
  background: linear-gradient(135deg, rgba(91,140,255,.35), rgba(155,92,255,.25));
}

.coin-cell small {
  display: block;
  color: var(--muted);
}

.up { color: var(--green); font-weight: 900; }
.down { color: var(--red); font-weight: 900; }

.empty {
  color: var(--muted);
  padding: 28px 22px;
}

.load-more-area {
  padding: 6px 22px 22px;
  text-align: center;
}

#loadMoreBtn {
  min-width: 220px;
  background: rgba(91,140,255,.16);
  border: 1px solid rgba(91,140,255,.25);
}

.right-panel {
  display: grid;
  gap: 18px;
}

.box {
  padding: 20px;
}

.box h3 {
  margin-top: 0;
}

.box input,
.box select {
  margin-bottom: 10px;
}

#feed {
  display: grid;
  gap: 10px;
}

.feed-item {
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 12px;
  background: rgba(255,255,255,.035);
}

.feed-item strong {
  display: block;
  margin-bottom: 4px;
}

.feed-item p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
}

.footer {
  border-top: 1px solid var(--line);
  background: rgba(5,7,17,.9);
  padding: 24px 28px;
}

.footer p {
  max-width: 1100px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.65;
}

/* Modal */
.coin-modal {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: none;
}

.coin-modal.show {
  display: block;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,.76);
  backdrop-filter: blur(16px);
}

.modal-window {
  position: absolute;
  inset: 5vh 5vw;
  border: 1px solid rgba(255,255,255,.12);
  border-radius: 30px;
  background:
    radial-gradient(circle at 10% 0%, rgba(91,140,255,.18), transparent 32%),
    #070b17;
  padding: 22px;
  overflow: auto;
  box-shadow: 0 40px 160px rgba(0,0,0,.75);
  animation: modalIn .24s ease;
}

@keyframes modalIn {
  from { opacity: 0; transform: translateY(18px) scale(.98); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.modal-close {
  position: absolute;
  right: 18px;
  top: 18px;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  font-size: 25px;
  background: rgba(255,255,255,.08);
  z-index: 3;
}

.modal-warning,
.legal-note {
  border: 1px solid rgba(255,209,102,.25);
  background: rgba(255,209,102,.075);
  color: #f7dc96;
  border-radius: 18px;
  padding: 13px 15px;
  font-size: 12px;
  line-height: 1.6;
}

.coin-header {
  display: grid;
  grid-template-columns: minmax(250px, 1.1fr) minmax(190px, .75fr) repeat(3, minmax(120px, .55fr));
  gap: 12px;
  margin: 16px 54px 16px 0;
}

.coin-title,
.price-main,
.head-stat {
  border: 1px solid var(--line);
  border-radius: 22px;
  background: rgba(255,255,255,.045);
  padding: 16px;
}

.coin-title {
  display: flex;
  align-items: center;
  gap: 14px;
}

.coin-title h2 {
  margin: 0;
  font-size: 36px;
  letter-spacing: -.06em;
}

.coin-title p,
.price-main span,
.head-stat span {
  color: var(--muted);
  font-size: 12px;
  margin: 0 0 7px;
}

.price-main strong {
  display: block;
  font-size: 32px;
  letter-spacing: -.05em;
}

.price-main small {
  display: block;
  margin-top: 8px;
}

.head-stat strong {
  font-size: 18px;
}

.coin-detail-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 330px;
  gap: 16px;
}

.chart-toolbar {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 12px;
}

.chart-toolbar h3 {
  margin: 0 0 5px;
}

.chart-toolbar p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
}

.range-buttons {
  display: flex;
  gap: 7px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.range-buttons button {
  background: rgba(255,255,255,.05);
  border: 1px solid var(--line);
  padding: 9px 12px;
  box-shadow: none;
}

.range-buttons button.active {
  background: rgba(91,140,255,.24);
}

.chart-box {
  position: relative;
  height: 560px;
  border: 1px solid var(--line);
  border-radius: 26px;
  overflow: hidden;
  background:
    linear-gradient(rgba(255,255,255,.045) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,.045) 1px, transparent 1px),
    #050711;
  background-size: 58px 58px;
}

#chartSvg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

.crosshair {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 1px;
  background: rgba(255,255,255,.35);
  display: none;
  pointer-events: none;
}

.chart-tooltip {
  position: absolute;
  display: none;
  pointer-events: none;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(8,13,24,.96);
  padding: 10px 12px;
  font-size: 12px;
  line-height: 1.45;
  box-shadow: 0 20px 60px rgba(0,0,0,.5);
}

.coin-side {
  display: grid;
  gap: 12px;
}

.side-stat,
.modal-alert-box,
.analysis-row > div {
  border: 1px solid var(--line);
  border-radius: 20px;
  background: rgba(255,255,255,.04);
  padding: 15px;
}

.side-stat span {
  color: var(--muted);
  font-size: 12px;
}

.side-stat strong {
  display: block;
  margin-top: 7px;
  font-size: 17px;
}

.modal-alert-box h3 {
  margin-top: 0;
}

.modal-alert-box input,
.modal-alert-box select {
  margin-bottom: 10px;
}

.analysis-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-top: 16px;
}

.analysis-row p {
  color: var(--muted);
  line-height: 1.65;
}

.toast {
  position: fixed;
  right: 24px;
  bottom: 24px;
  width: min(400px, calc(100vw - 48px));
  border: 1px solid rgba(16,216,155,.25);
  border-radius: 20px;
  background: rgba(8,13,24,.96);
  padding: 16px;
  transform: translateY(140%);
  transition: .28s ease;
  z-index: 80;
}

.toast.show {
  transform: translateY(0);
}

.toast p {
  color: var(--muted);
  margin-bottom: 0;
}

/* Responsive */
@media (max-width: 1180px) {
  .app-shell,
  .content-grid,
  .coin-detail-layout,
  .analysis-row {
    grid-template-columns: 1fr;
  }

  .sidebar {
    display: none;
  }

  .hero {
    flex-direction: column;
    align-items: stretch;
  }

  .stats-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .coin-header {
    grid-template-columns: 1fr 1fr;
    margin-right: 54px;
  }
}

@media (max-width: 720px) {
  .top-header {
    height: auto;
    padding: 14px 16px;
    flex-direction: column;
    align-items: stretch;
  }

  .top-header nav {
    flex-wrap: wrap;
  }

  .main {
    padding: 18px;
  }

  .stats-grid,
  .coin-header {
    grid-template-columns: 1fr;
  }

  th:nth-child(4),
  td:nth-child(4),
  th:nth-child(5),
  td:nth-child(5) {
    display: none;
  }

  th, td {
    padding: 13px 12px;
  }

  .modal-window {
    inset: 0;
    border-radius: 0;
  }

  .chart-box {
    height: 380px;
  }

  .chart-toolbar {
    flex-direction: column;
  }

  .range-buttons {
    justify-content: flex-start;
  }
}

.big-alert-popup {
  position: fixed;
  inset: 0;
  z-index: 999;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(0,0,0,.78);
  backdrop-filter: blur(18px);
}

.big-alert-popup.show {
  display: flex;
}

.big-alert-card {
  position: relative;
  width: min(520px, 100%);
  border-radius: 30px;
  padding: 34px;
  text-align: center;
  color: #fff;
  box-shadow: 0 40px 160px rgba(0,0,0,.75);
  animation: alertPop .28s ease;
}

.alert-up .big-alert-card {
  border: 1px solid rgba(16,216,155,.45);
  background:
    radial-gradient(circle at 50% 0%, rgba(16,216,155,.36), transparent 45%),
    #071b16;
}

.alert-down .big-alert-card {
  border: 1px solid rgba(255,77,109,.45);
  background:
    radial-gradient(circle at 50% 0%, rgba(255,77,109,.36), transparent 45%),
    #1c0710;
}

.big-alert-icon {
  width: 86px;
  height: 86px;
  margin: 0 auto 18px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 42px;
  font-weight: 900;
  background: rgba(255,255,255,.12);
}

.big-alert-card h2 {
  margin: 0;
  font-size: 34px;
  letter-spacing: -.04em;
}

.big-alert-card p {
  color: rgba(255,255,255,.78);
}

.big-alert-price {
  margin: 22px 0;
  font-size: 42px;
  font-weight: 900;
  letter-spacing: -.05em;
}

.big-alert-close {
  position: absolute;
  right: 18px;
  top: 18px;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: rgba(255,255,255,.12);
  font-size: 24px;
  padding: 0;
}

@keyframes alertPop {
  from {
    opacity: 0;
    transform: scale(.9) translateY(18px);
  }

  to {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

tr.flash-up {
  animation: rowFlashUp 8s ease forwards;
}

tr.flash-down {
  animation: rowFlashDown 8s ease forwards;
}

@keyframes rowFlashUp {
  0% {
    background: rgba(16, 216, 155, .34);
    box-shadow: inset 4px 0 0 var(--green);
  }
  100% {
    background: transparent;
    box-shadow: inset 0 0 0 transparent;
  }
}

@keyframes rowFlashDown {
  0% {
    background: rgba(255, 77, 109, .34);
    box-shadow: inset 4px 0 0 var(--red);
  }
  100% {
    background: transparent;
    box-shadow: inset 0 0 0 transparent;
  }
}
.price-pulse strong {
  transition: color .25s ease;
}