:root {
  color-scheme: dark;
  --bg: #050816;
  --panel: rgba(21, 31, 72, 0.72);
  --panel-strong: rgba(30, 43, 92, 0.9);
  --line: rgba(255, 255, 255, 0.16);
  --text: #f5f7fb;
  --muted: #b4bee0;
  --green: #35f7a8;
  --red: #ff3f6e;
  --blue: #44b7ff;
  --violet: #c66bff;
  --amber: #ffd84d;
  --shadow: 0 24px 90px rgba(0, 0, 0, 0.38);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  min-width: 320px;
  margin: 0;
  background:
    radial-gradient(circle at 10% 0%, rgba(68, 183, 255, 0.34), transparent 31%),
    radial-gradient(circle at 88% 10%, rgba(53, 247, 168, 0.25), transparent 28%),
    radial-gradient(circle at 58% 42%, rgba(198, 107, 255, 0.18), transparent 34%),
    linear-gradient(180deg, #050816 0%, #09143a 45%, #050816 100%);
  color: var(--text);
  font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  letter-spacing: 0;
}

button,
input,
select {
  font: inherit;
}

.app-shell {
  width: min(1540px, calc(100% - 36px));
  margin: 0 auto;
  padding: 24px 0 60px;
}

.topbar {
  position: sticky;
  top: 14px;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: 24px;
  background: rgba(9, 16, 45, 0.78);
  box-shadow: 0 18px 70px rgba(28, 104, 255, 0.16);
  backdrop-filter: blur(24px);
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--text);
  text-decoration: none;
}

.brand-mark {
  width: 42px;
  height: 42px;
  border-radius: 14px;
  background:
    linear-gradient(135deg, rgba(53, 247, 168, 0.96), rgba(68, 183, 255, 0.98), rgba(198, 107, 255, 0.92)),
    #10182d;
  box-shadow: 0 0 42px rgba(53, 247, 168, 0.38);
}

.brand strong,
.brand small {
  display: block;
}

.brand strong {
  font-size: 1rem;
}

.brand small,
.eyebrow {
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.nav-tabs {
  display: flex;
  gap: 6px;
  padding: 5px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.04);
}

.nav-tabs a {
  min-height: 38px;
  padding: 10px 14px;
  border-radius: 14px;
  color: #cbd3ea;
  text-decoration: none;
  transition: 180ms ease;
}

.nav-tabs a:hover {
  background: rgba(255, 255, 255, 0.08);
  color: var(--text);
}

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) 420px;
  gap: 28px;
  align-items: end;
  min-height: 420px;
  padding: 76px 0 34px;
}

.hero-copy h1 {
  max-width: 860px;
  margin: 10px 0 18px;
  font-size: clamp(2.4rem, 6vw, 6rem);
  line-height: 0.96;
  letter-spacing: 0;
}

.hero-copy p:not(.eyebrow) {
  max-width: 680px;
  margin: 0;
  color: #b9c2d9;
  font-size: 1.06rem;
  line-height: 1.8;
}

.hero-panel,
.metric-card,
.workspace,
.chart-card,
.table-wrap,
.drawer {
  border: 1px solid var(--line);
  background:
    linear-gradient(180deg, rgba(31, 45, 101, 0.84), rgba(9, 16, 44, 0.76)),
    linear-gradient(135deg, rgba(53, 247, 168, 0.08), rgba(68, 183, 255, 0.1), rgba(198, 107, 255, 0.08));
  box-shadow: var(--shadow);
  backdrop-filter: blur(26px);
}

.hero-panel {
  display: grid;
  gap: 14px;
  padding: 22px;
  border-radius: 24px;
}

.hero-panel label {
  color: var(--muted);
  font-size: 0.83rem;
  font-weight: 700;
}

select,
input {
  width: 100%;
  min-height: 46px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 16px;
  outline: none;
  background: rgba(255, 255, 255, 0.095);
  color: var(--text);
  padding: 0 14px;
}

select:focus,
input:focus,
button:focus-visible {
  outline: 2px solid rgba(119, 242, 195, 0.65);
  outline-offset: 3px;
}

option {
  color: #10162b;
}

.strategy-pulse {
  display: flex;
  gap: 12px;
  align-items: center;
  min-height: 54px;
  color: #cfd6ea;
  line-height: 1.5;
}

.strategy-pulse span {
  flex: 0 0 auto;
  width: 12px;
  height: 12px;
  border-radius: 999px;
  background: var(--green);
  box-shadow: 0 0 0 7px rgba(53, 247, 168, 0.18), 0 0 30px rgba(53, 247, 168, 0.65);
}

.metrics-grid {
  display: grid;
  grid-template-columns: repeat(6, minmax(150px, 1fr));
  gap: 14px;
}

.metric-card {
  position: relative;
  overflow: hidden;
  min-height: 124px;
  padding: 18px;
  border-radius: 24px;
  transition: transform 180ms ease, border-color 180ms ease;
}

.metric-card::after {
  position: absolute;
  inset: auto -30px -50px auto;
  width: 120px;
  height: 120px;
  border-radius: 999px;
  background: linear-gradient(135deg, rgba(68, 183, 255, 0.18), rgba(198, 107, 255, 0.14));
  content: "";
}

.metric-card:hover {
  transform: translateY(-4px);
  border-color: rgba(255, 255, 255, 0.18);
}

.metric-card span {
  display: block;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 700;
}

.metric-card strong {
  display: block;
  margin-top: 14px;
  font-size: clamp(1.28rem, 2vw, 1.75rem);
  letter-spacing: 0;
}

.metric-card.positive strong {
  color: var(--green);
}

.metric-card.negative strong {
  color: var(--red);
}

.workspace,
.charts,
.comparison {
  margin-top: 26px;
}

.workspace {
  padding: 22px;
  border-radius: 24px;
}

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

.section-heading h2 {
  margin: 6px 0 0;
  font-size: clamp(1.35rem, 2.4vw, 2.2rem);
  letter-spacing: 0;
}

.toolbar {
  display: grid;
  grid-template-columns: minmax(210px, 1fr) 190px 150px 150px 150px;
  gap: 10px;
  width: min(920px, 100%);
}

.day-map {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(92px, 1fr));
  gap: 14px;
  align-items: center;
  min-height: 360px;
}

.day-card {
  position: relative;
  display: grid;
  place-items: center;
  justify-self: center;
  width: var(--size);
  height: var(--size);
  min-width: 82px;
  max-width: 138px;
  min-height: 82px;
  max-height: 138px;
  padding: 14px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.11);
  color: var(--text);
  cursor: pointer;
  text-shadow: 0 1px 12px rgba(0, 0, 0, 0.28);
  transition: transform 220ms ease, filter 220ms ease, box-shadow 220ms ease, z-index 0ms linear;
}

.day-card.win {
  border-color: rgba(38, 255, 166, 0.78);
  background:
    radial-gradient(circle at 35% 25%, rgba(182, 255, 221, 0.46), rgba(38, 255, 166, 0.33) 34%, rgba(10, 214, 128, 0.18) 66%),
    rgba(9, 35, 31, 0.9);
  box-shadow:
    0 0 20px rgba(38, 255, 166, 0.62),
    0 0 54px rgba(38, 255, 166, 0.38),
    inset 0 0 34px rgba(38, 255, 166, 0.22);
}

.day-card.loss {
  border-color: rgba(255, 54, 97, 0.82);
  background:
    radial-gradient(circle at 35% 25%, rgba(255, 183, 195, 0.48), rgba(255, 54, 97, 0.36) 34%, rgba(231, 26, 68, 0.2) 66%),
    rgba(42, 10, 24, 0.92);
  box-shadow:
    0 0 20px rgba(255, 54, 97, 0.66),
    0 0 54px rgba(255, 54, 97, 0.42),
    inset 0 0 34px rgba(255, 54, 97, 0.24);
}

.day-card.flat {
  border-color: rgba(255, 224, 77, 0.78);
  background:
    radial-gradient(circle at 35% 25%, rgba(255, 245, 173, 0.42), rgba(255, 224, 77, 0.3) 36%, rgba(255, 178, 36, 0.16) 66%),
    rgba(38, 30, 10, 0.9);
  box-shadow:
    0 0 18px rgba(255, 224, 77, 0.54),
    0 0 44px rgba(255, 178, 36, 0.32),
    inset 0 0 30px rgba(255, 224, 77, 0.2);
}

.day-card span,
.day-card strong {
  display: block;
  pointer-events: none;
  text-align: center;
}

.day-card span {
  color: #a9b2cc;
  font-size: 0.72rem;
  font-weight: 700;
}

.day-card strong {
  max-width: 100%;
  margin-top: 5px;
  overflow-wrap: anywhere;
  font-size: clamp(0.72rem, 1vw, 0.95rem);
}

.day-card.win strong {
  color: #b6ffdd;
}

.day-card.loss strong {
  color: #ffc0cc;
}

.day-card.flat strong {
  color: #fff0a6;
}

.day-card em {
  position: absolute;
  left: 50%;
  bottom: calc(100% + 14px);
  z-index: 5;
  width: 230px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: rgba(8, 13, 30, 0.96);
  box-shadow: 0 20px 70px rgba(0, 0, 0, 0.5);
  color: #dbe1f0;
  font-size: 0.78rem;
  font-style: normal;
  line-height: 1.7;
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, 8px);
  transition: 180ms ease;
}

body:has(.day-card:hover) .day-card:not(:hover) {
  filter: blur(2px) brightness(0.46);
}

body:has(.day-card:hover)::after {
  position: fixed;
  inset: 0;
  z-index: 1;
  background: rgba(0, 0, 0, 0.42);
  pointer-events: none;
  content: "";
}

.day-card:hover {
  z-index: 3;
  transform: scale(1.18);
  filter: saturate(1.25) brightness(1.12);
}

.day-card:hover em {
  opacity: 1;
  transform: translate(-50%, 0);
}

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

.chart-card {
  min-height: 340px;
  padding: 18px;
  border-radius: 24px;
}

.chart-card-wide {
  grid-column: 1 / -1;
  min-height: 390px;
}

.chart-card h3 {
  margin: 0 0 14px;
  font-size: 1rem;
}

canvas {
  width: 100% !important;
  height: 280px !important;
}

.chart-card-wide canvas {
  height: 320px !important;
}

.table-wrap {
  overflow-x: auto;
  border-radius: 24px;
}

table {
  width: 100%;
  min-width: 880px;
  border-collapse: collapse;
}

th,
td {
  padding: 18px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  text-align: left;
}

th {
  color: var(--muted);
  font-size: 0.78rem;
  text-transform: uppercase;
}

.top-row {
  background: rgba(119, 242, 195, 0.08);
}

.rank {
  display: inline-flex;
  margin-right: 8px;
  padding: 4px 8px;
  border-radius: 999px;
  background: rgba(119, 242, 195, 0.14);
  color: var(--green);
  font-size: 0.7rem;
  font-weight: 800;
}

.drawer {
  position: fixed;
  top: 16px;
  right: 16px;
  z-index: 60;
  width: min(520px, calc(100vw - 32px));
  height: calc(100vh - 32px);
  overflow-y: auto;
  padding: 26px;
  border-radius: 24px;
  opacity: 0;
  transform: translateX(calc(100% + 24px));
  transition: 260ms ease;
}

.drawer.open {
  opacity: 1;
  transform: translateX(0);
}

.drawer-close {
  position: sticky;
  top: 0;
  float: right;
  width: 42px;
  height: 42px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  color: var(--text);
  cursor: pointer;
  font-size: 1.5rem;
}

.drawer h2 {
  margin: 10px 0 16px;
  font-size: 2rem;
  letter-spacing: 0;
}

.drawer-metrics {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 24px;
}

.drawer-metrics span,
.trade-list article {
  border: 1px solid rgba(255, 255, 255, 0.09);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.055);
}

.drawer-metrics span {
  padding: 14px;
  color: #e6ebf8;
  font-weight: 800;
}

.trade-list {
  display: grid;
  gap: 12px;
}

.trade-list article {
  padding: 16px;
}

.trade-list strong {
  display: block;
  margin-bottom: 12px;
}

dl {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin: 0 0 12px;
}

dt {
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 800;
  text-transform: uppercase;
}

dd {
  margin: 4px 0 0;
}

.trade-explain {
  display: grid;
  gap: 10px;
}

.trade-explain section {
  padding: 12px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.045);
}

.trade-explain h4 {
  margin: 0 0 6px;
  color: var(--amber);
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.trade-list p {
  margin: 0;
  color: #b9c2d9;
  line-height: 1.7;
}

.skeleton {
  position: relative;
  overflow: hidden;
  border-radius: 24px;
  background:
    linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.08), transparent),
    rgba(255, 255, 255, 0.035);
  background-size: 240px 100%, 100% 100%;
  animation: shimmer 1.1s linear infinite;
}

@keyframes shimmer {
  from {
    background-position: -240px 0, 0 0;
  }
  to {
    background-position: calc(100% + 240px) 0, 0 0;
  }
}

@media (max-width: 1180px) {
  .hero {
    grid-template-columns: 1fr;
    min-height: auto;
  }

  .metrics-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

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

  .toolbar {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    width: 100%;
  }
}

@media (max-width: 760px) {
  .app-shell {
    width: min(100% - 24px, 1540px);
    padding-top: 12px;
  }

  .topbar {
    position: static;
    top: auto;
  }

  .topbar,
  .nav-tabs {
    align-items: stretch;
    flex-direction: column;
  }

  .nav-tabs a {
    text-align: center;
  }

  .hero {
    padding-top: 42px;
  }

  .metrics-grid,
  .chart-grid,
  .toolbar,
  .drawer-metrics,
  dl {
    grid-template-columns: 1fr;
  }

  .metric-card {
    min-height: 108px;
  }

  .workspace {
    padding: 16px;
  }

  .day-map {
    grid-template-columns: repeat(auto-fit, minmax(86px, 1fr));
    gap: 10px;
  }

  .day-card {
    width: min(var(--size), 112px);
    height: min(var(--size), 112px);
  }

  .day-card em {
    display: none;
  }

  .drawer {
    inset: 0;
    width: 100vw;
    height: 100vh;
    border-radius: 0;
    transform: translateY(100%);
  }

  .drawer.open {
    transform: translateY(0);
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
  }
}
