:root {
  --bg: #050608;
  --panel: #101419;
  --panel-2: #151b22;
  --line: #27313b;
  --line-strong: #3a4654;
  --text: #eef3f8;
  --muted: #9aa8b5;
  --gold: #f5c84b;
  --cyan: #55d6ff;
  --green: #3ce38a;
  --red: #ff5f63;
  --ink: #07090c;
  --shadow: 0 24px 80px rgba(0, 0, 0, 0.42);
  color-scheme: dark;
  font-family: "IBM Plex Sans", "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  background: var(--bg);
  scroll-behavior: smooth;
}

body {
  min-width: 320px;
  margin: 0;
  background:
    linear-gradient(180deg, rgba(6, 12, 16, 0.35), rgba(5, 6, 8, 0) 420px),
    repeating-linear-gradient(90deg, rgba(255, 255, 255, 0.025) 0 1px, transparent 1px 72px),
    var(--bg);
  color: var(--text);
}

button,
input {
  font: inherit;
}

a {
  color: inherit;
  text-decoration: none;
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  min-height: 72px;
  padding: 14px clamp(18px, 4vw, 56px);
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(5, 6, 8, 0.82);
  backdrop-filter: blur(18px);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.brand-mark {
  display: grid;
  width: 40px;
  height: 40px;
  place-items: center;
  border: 1px solid rgba(245, 200, 75, 0.45);
  background: linear-gradient(135deg, #f5c84b, #55d6ff);
  color: var(--ink);
  font-family: "Space Grotesk", "IBM Plex Sans", sans-serif;
  font-weight: 700;
}

.brand strong,
h1,
h2,
h3 {
  font-family: "Space Grotesk", "IBM Plex Sans", sans-serif;
  letter-spacing: 0;
}

.brand strong {
  display: block;
  line-height: 1;
}

.brand small {
  display: block;
  color: var(--muted);
  font-size: 0.75rem;
  margin-top: 3px;
}

.top-nav {
  display: flex;
  align-items: center;
  gap: 6px;
}

.top-nav a,
.segmented,
.filter-button {
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(255, 255, 255, 0.035);
  color: var(--muted);
  cursor: pointer;
  transition: border-color 160ms ease, color 160ms ease, background 160ms ease;
}

.top-nav a {
  padding: 8px 12px;
  font-size: 0.92rem;
}

.top-nav a:hover,
.segmented:hover,
.filter-button:hover,
.segmented.active,
.filter-button.active {
  border-color: rgba(245, 200, 75, 0.55);
  background: rgba(245, 200, 75, 0.12);
  color: var(--text);
}

main {
  width: min(1520px, calc(100% - clamp(28px, 6vw, 96px)));
  margin: 0 auto;
}

.dashboard-shell {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(260px, 420px);
  gap: clamp(24px, 5vw, 72px);
  align-items: end;
  min-height: calc(100vh - 72px);
  padding: clamp(38px, 8vw, 96px) 0 clamp(26px, 5vw, 58px);
}

.eyebrow {
  margin: 0 0 10px;
  color: var(--gold);
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1 {
  max-width: 880px;
  margin: 0;
  font-size: clamp(3.2rem, 9vw, 8.8rem);
  line-height: 0.9;
}

.lede {
  max-width: 720px;
  margin: 22px 0 0;
  color: #c8d2dc;
  font-size: clamp(1.05rem, 2vw, 1.35rem);
  line-height: 1.5;
}

.metric-strip {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  max-width: 720px;
  margin: 34px 0 0;
}

.metric-strip div,
.market-tape,
.plot-panel,
.chart-picker,
.chart-card,
.library-toolbar {
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.055), rgba(255, 255, 255, 0.025));
  box-shadow: var(--shadow);
}

.metric-strip div {
  padding: 16px;
}

.metric-strip dt {
  color: var(--muted);
  font-size: 0.74rem;
  font-family: "IBM Plex Mono", monospace;
  text-transform: uppercase;
}

.metric-strip dd {
  margin: 6px 0 0;
  font-family: "Space Grotesk", "IBM Plex Sans", sans-serif;
  font-size: clamp(1.45rem, 4vw, 2.6rem);
  font-weight: 700;
}

.market-tape {
  align-self: stretch;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  min-height: 260px;
  padding: 24px;
  background:
    linear-gradient(135deg, rgba(245, 200, 75, 0.22), rgba(85, 214, 255, 0.08) 52%, rgba(60, 227, 138, 0.09)),
    var(--panel);
}

.market-tape span {
  color: var(--muted);
  font-family: "IBM Plex Mono", monospace;
  font-weight: 600;
}

.market-tape strong {
  display: block;
  margin-top: 16px;
  color: var(--gold);
  font-family: "Space Grotesk", "IBM Plex Sans", sans-serif;
  font-size: clamp(2.4rem, 7vw, 5.2rem);
  line-height: 0.95;
}

.market-tape small {
  margin-top: 18px;
  color: #c8d2dc;
  font-size: 0.95rem;
}

.interactive-section,
.library-section,
.route-section {
  padding: 42px 0 72px;
}

.landing-shell {
  min-height: calc(82vh - 72px);
}

.route-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.route-card {
  position: relative;
  display: grid;
  min-height: 320px;
  align-content: end;
  gap: 18px;
  overflow: hidden;
  padding: clamp(22px, 4vw, 34px);
  border: 1px solid rgba(255, 255, 255, 0.12);
  background:
    radial-gradient(circle at 22% 18%, rgba(255, 255, 255, 0.16), transparent 30%),
    linear-gradient(135deg, rgba(255, 255, 255, 0.07), rgba(255, 255, 255, 0.025));
  box-shadow: var(--shadow);
}

.route-card::before {
  content: "";
  position: absolute;
  inset: -25%;
  background: radial-gradient(circle, rgba(255, 255, 255, 0.18), transparent 48%);
  opacity: 0.35;
  transform: translate3d(-20%, -15%, 0);
}

.route-card span,
.route-card strong,
.route-card small {
  position: relative;
}

.route-card span {
  color: var(--gold);
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
}

.route-card strong {
  max-width: 720px;
  font-family: "Space Grotesk", "IBM Plex Sans", sans-serif;
  font-size: clamp(1.8rem, 4vw, 3.7rem);
  line-height: 0.98;
}

.route-card small {
  color: #c8d2dc;
  font-size: 0.95rem;
}

.route-card-bitcoin {
  background:
    radial-gradient(circle at 78% 18%, rgba(245, 200, 75, 0.34), transparent 26%),
    linear-gradient(135deg, rgba(245, 200, 75, 0.18), rgba(85, 214, 255, 0.06) 62%, rgba(255, 255, 255, 0.03));
}

.route-card-stocks {
  background:
    radial-gradient(circle at 78% 18%, rgba(85, 214, 255, 0.32), transparent 26%),
    linear-gradient(135deg, rgba(85, 214, 255, 0.14), rgba(60, 227, 138, 0.07) 60%, rgba(255, 255, 255, 0.03));
}

.section-heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 18px;
}

.section-heading h2 {
  margin: 0;
  font-size: clamp(2rem, 4vw, 4rem);
}

.interactive-layout {
  display: grid;
  grid-template-columns: minmax(260px, 300px) minmax(0, 1fr);
  gap: 16px;
  align-items: start;
}

.chart-picker,
.plot-panel {
  height: clamp(500px, calc(100vh - 176px), 640px);
  min-height: 0;
}

.chart-picker {
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr);
  padding: 10px;
  overflow: hidden;
  background: rgba(10, 14, 18, 0.92);
}

.interactive-search {
  padding: 4px 4px 10px;
}

.interactive-count {
  margin: 0 4px 10px;
  color: var(--muted);
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.72rem;
  text-transform: uppercase;
}

.interactive-list {
  display: grid;
  align-content: start;
  gap: 8px;
  min-height: 0;
  overflow-y: auto;
  padding-right: 4px;
  scrollbar-color: rgba(85, 214, 255, 0.48) transparent;
}

.interactive-button {
  width: 100%;
  min-height: 66px;
  padding: 12px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--text);
  cursor: pointer;
  text-align: left;
}

.interactive-button:hover,
.interactive-button.active {
  border-color: rgba(85, 214, 255, 0.38);
  background: rgba(85, 214, 255, 0.08);
}

.interactive-button strong {
  display: block;
  font-size: 0.98rem;
}

.interactive-button span {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-size: 0.82rem;
  line-height: 1.3;
}

.plot-panel {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  padding: 14px;
  overflow: hidden;
  background: rgba(9, 12, 16, 0.92);
}

.plot-header {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 8px;
}

.plot-header h3 {
  margin: 0;
  font-size: clamp(1.2rem, 2.4vw, 1.9rem);
}

.plot-header p:last-child {
  max-width: 820px;
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 0.94rem;
  line-height: 1.38;
}

.plot-actions {
  display: flex;
  align-items: start;
  gap: 6px;
  flex-shrink: 0;
}

.segmented {
  padding: 8px 12px;
}

.plot {
  width: 100%;
  height: 100%;
  min-height: 0;
}

.library-toolbar {
  display: grid;
  grid-template-columns: minmax(220px, 360px) minmax(0, 1fr);
  gap: 14px;
  align-items: start;
  padding: 14px;
  margin-bottom: 18px;
  background: rgba(9, 12, 16, 0.82);
}

.search-box {
  display: grid;
  gap: 8px;
}

.search-box span {
  color: var(--muted);
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
}

.search-box input {
  width: 100%;
  min-height: 44px;
  border: 1px solid var(--line);
  background: #070a0e;
  color: var(--text);
  padding: 0 12px;
  outline: none;
}

.search-box input:focus {
  border-color: var(--cyan);
}

.filter-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.filter-button {
  min-height: 36px;
  padding: 8px 11px;
  font-size: 0.88rem;
}

.chart-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
}

.empty-state {
  grid-column: 1 / -1;
  margin: 0;
  padding: 28px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(255, 255, 255, 0.035);
  color: var(--muted);
}

.chart-card {
  display: grid;
  grid-template-rows: auto 1fr;
  overflow: hidden;
  background: rgba(10, 14, 18, 0.78);
}

.chart-card button {
  display: block;
  width: 100%;
  padding: 0;
  border: 0;
  background: transparent;
  cursor: zoom-in;
}

.chart-card img {
  display: block;
  width: 100%;
  aspect-ratio: 16 / 10;
  object-fit: cover;
  background: #080b0f;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.chart-card .chart-card-placeholder {
  display: grid;
  width: 100%;
  aspect-ratio: 16 / 10;
  place-items: center;
  gap: 6px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  background:
    radial-gradient(circle at 70% 24%, rgba(85, 214, 255, 0.25), transparent 28%),
    linear-gradient(135deg, rgba(245, 200, 75, 0.13), rgba(85, 214, 255, 0.06));
  color: var(--text);
  cursor: pointer;
}

.chart-card-placeholder strong {
  color: var(--gold);
  font-family: "Space Grotesk", "IBM Plex Sans", sans-serif;
  font-size: 1.4rem;
}

.chart-card-placeholder span {
  color: var(--muted);
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.78rem;
  text-transform: uppercase;
}

.chart-card-body {
  padding: 14px;
}

.card-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 8px;
  color: var(--muted);
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.72rem;
  text-transform: uppercase;
}

.badge {
  color: var(--cyan);
}

.chart-card h3 {
  margin: 0;
  font-size: 1.06rem;
}

.chart-card p {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 0.92rem;
  line-height: 1.4;
}

.image-dialog {
  width: min(94vw, 1500px);
  max-height: 92vh;
  padding: 0;
  border: 1px solid var(--line-strong);
  background: #050608;
  color: var(--text);
  box-shadow: var(--shadow);
}

.image-dialog::backdrop {
  background: rgba(0, 0, 0, 0.78);
}

.dialog-close {
  position: absolute;
  top: 10px;
  right: 10px;
  z-index: 2;
  width: 38px;
  height: 38px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  background: rgba(0, 0, 0, 0.74);
  color: var(--text);
  cursor: pointer;
}

.image-dialog figure {
  margin: 0;
}

.image-dialog img {
  display: block;
  width: 100%;
  max-height: 78vh;
  object-fit: contain;
  background: #000;
}

.image-dialog figcaption {
  display: grid;
  gap: 6px;
  padding: 14px 18px 18px;
}

.image-dialog figcaption span {
  color: var(--muted);
}

@media (max-width: 980px) {
  .dashboard-shell,
  .interactive-layout,
  .library-toolbar,
  .route-grid {
    grid-template-columns: 1fr;
  }

  .dashboard-shell {
    min-height: auto;
    padding-top: 52px;
  }

  .chart-picker,
  .plot-panel {
    height: auto;
    min-height: unset;
  }

  .interactive-list {
    grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  }

  .plot {
    height: 480px;
    min-height: 420px;
  }
}

@media (max-width: 680px) {
  .site-header {
    position: static;
    align-items: flex-start;
    flex-direction: column;
  }

  .top-nav {
    width: 100%;
    overflow-x: auto;
  }

  main {
    width: min(100% - 28px, 1520px);
  }

  h1 {
    font-size: clamp(3rem, 18vw, 5.2rem);
  }

  .metric-strip {
    grid-template-columns: 1fr;
  }

  .market-tape {
    min-height: 190px;
  }

  .plot-header {
    flex-direction: column;
  }

  .plot-actions {
    align-self: stretch;
  }

  .segmented {
    flex: 1;
  }

  .plot {
    height: 430px;
    min-height: 380px;
  }
}
