:root {
  color-scheme: dark;
  --bg: #09070f;
  --ink: #fff7d6;
  --muted: #a79fcb;
  --panel: #171126;
  --panel-2: #24183b;
  --line: #000;
  --shadow: #000;
  --pink: #ff4fd8;
  --cyan: #32f2ff;
  --green: #6dff79;
  --red: #ff5c6d;
  --yellow: #ffe55c;
  --orange: #ff9f3f;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-width: 320px;
  background:
    linear-gradient(rgba(255, 255, 255, 0.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.035) 1px, transparent 1px),
    radial-gradient(circle at 20% 10%, rgba(255, 79, 216, 0.18), transparent 28%),
    radial-gradient(circle at 80% 0%, rgba(50, 242, 255, 0.14), transparent 30%),
    var(--bg);
  background-size: 16px 16px, 16px 16px, auto, auto, auto;
  color: var(--ink);
  font-family: "Courier New", ui-monospace, SFMono-Regular, Consolas, monospace;
  image-rendering: pixelated;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background: repeating-linear-gradient(
    to bottom,
    rgba(255, 255, 255, 0.045),
    rgba(255, 255, 255, 0.045) 1px,
    transparent 1px,
    transparent 4px
  );
  mix-blend-mode: overlay;
  opacity: 0.45;
}

body.modal-open {
  overflow: hidden;
}

button,
input,
select {
  font: inherit;
}

.shell {
  width: min(1440px, 100%);
  margin: 0 auto;
  padding: 28px;
}

.topbar {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 18px;
  border: 4px solid var(--line);
  background: linear-gradient(135deg, #211238, #10192e 55%, #27153c);
  padding: 20px;
  box-shadow: 8px 8px 0 var(--shadow), inset 0 0 0 3px rgba(255, 255, 255, 0.08);
}

.eyebrow,
.label {
  margin: 0 0 8px;
  color: var(--yellow);
  font-size: 0.74rem;
  font-weight: 900;
  letter-spacing: 0;
  text-transform: uppercase;
  text-shadow: 2px 2px 0 var(--line);
}

h1,
h2,
p {
  margin-top: 0;
}

.hero-countdown {
  margin-bottom: 10px;
  color: var(--ink);
  font-size: clamp(2.6rem, 6vw, 6.6rem);
  line-height: 0.88;
  letter-spacing: 0;
  text-transform: uppercase;
  text-shadow: 4px 0 0 var(--pink), -4px 0 0 var(--cyan), 0 5px 0 var(--line);
}

.hero-countdown span {
  display: block;
  white-space: nowrap;
}

h2 {
  margin-bottom: 0;
  font-size: 1rem;
  text-transform: uppercase;
}

.subtitle {
  max-width: 780px;
  margin-bottom: 0;
  color: #eee7ff;
  font-size: 1rem;
  line-height: 1.45;
}

.status-panel {
  display: grid;
  justify-items: end;
  gap: 10px;
  min-width: 230px;
}

.tabbar {
  display: flex;
  gap: 4px;
  margin-top: 16px;
  border: 4px solid var(--line);
  background: var(--line);
  box-shadow: 6px 6px 0 #000;
}

.tab-button {
  flex: 1;
  border: 0;
  background: var(--panel-2);
  color: var(--muted);
  padding: 14px 18px;
  text-align: center;
}

.tab-button.active {
  background: var(--yellow);
  color: var(--line);
}

.tab-panel {
  display: none;
}

.tab-panel.active {
  display: block;
}

.status-dot {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  color: var(--yellow);
  font-weight: 900;
  text-transform: uppercase;
}

.status-dot::before {
  content: "";
  width: 12px;
  height: 12px;
  background: currentColor;
  box-shadow: 0 0 0 3px var(--line), 0 0 18px currentColor;
}

.status-dot.live {
  color: var(--green);
}

.status-dot.error {
  color: var(--red);
}

button {
  min-height: 42px;
  border: 3px solid var(--line);
  border-radius: 0;
  background: var(--yellow);
  color: #130b1f;
  padding: 0 14px;
  box-shadow: 4px 4px 0 var(--shadow);
  cursor: pointer;
  font-weight: 900;
  text-transform: uppercase;
}

button:hover {
  transform: translate(2px, 2px);
  box-shadow: 2px 2px 0 var(--shadow);
}

.retro-link {
  display: inline-flex;
  align-items: center;
  min-height: 42px;
  border: 3px solid var(--line);
  background: var(--cyan);
  color: #061018;
  padding: 0 12px;
  box-shadow: 4px 4px 0 var(--shadow);
  font-size: 0.82rem;
  font-weight: 900;
  text-decoration: none;
  text-transform: uppercase;
}

.retro-link:hover {
  transform: translate(2px, 2px);
  box-shadow: 2px 2px 0 var(--shadow);
}

.telegram-link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 42px;
  border: 3px solid var(--line);
  background: #29a9eb;
  color: #061018;
  padding: 0 12px;
  box-shadow: 4px 4px 0 var(--shadow);
  font-size: 0.82rem;
  font-weight: 900;
  text-decoration: none;
  text-transform: uppercase;
}

.telegram-link svg {
  width: 18px;
  height: 18px;
  fill: currentColor;
  flex: 0 0 auto;
}

.telegram-link:hover {
  transform: translate(2px, 2px);
  box-shadow: 2px 2px 0 var(--shadow);
}

label {
  display: grid;
  gap: 7px;
  color: var(--yellow);
  font-size: 0.76rem;
  font-weight: 900;
  text-transform: uppercase;
  text-shadow: 2px 2px 0 var(--line);
}

input,
select {
  width: 100%;
  min-height: 42px;
  border: 3px solid var(--line);
  border-radius: 0;
  background: #090714;
  color: var(--ink);
  padding: 0 10px;
  box-shadow: inset 3px 3px 0 rgba(255, 255, 255, 0.06);
}

input[type="checkbox"] {
  width: 22px;
  min-height: 22px;
  accent-color: var(--green);
  box-shadow: none;
}

.button-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.leaderboard,
.competitor-grid,
.panel-grid {
  display: grid;
  gap: 16px;
}

.leaderboard {
  grid-template-columns: minmax(0, 2fr) minmax(170px, 0.8fr) minmax(190px, 0.8fr);
  margin-bottom: 16px;
}

.leader-card,
.leader-metric,
.competitor-card,
.panel {
  border: 4px solid var(--line);
  border-radius: 0;
  background: var(--panel);
  box-shadow: 7px 7px 0 var(--shadow);
}

.leader-card,
.leader-metric {
  padding: 18px;
}

.leader-card {
  background: linear-gradient(135deg, rgba(255, 79, 216, 0.22), var(--panel) 55%);
}

.leader-name,
.leader-metric > div {
  color: var(--cyan);
  font-size: clamp(1.25rem, 2.8vw, 2.45rem);
  font-weight: 900;
  line-height: 1;
  text-transform: uppercase;
  text-shadow: 3px 3px 0 var(--line);
}

.competitor-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  margin-bottom: 16px;
}

.copy-panel {
  margin-bottom: 0;
}

.copy-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(320px, 0.95fr);
  gap: 4px;
  background: var(--line);
  overflow-x: hidden;
}

.copy-form,
.copy-status {
  display: grid;
  align-content: start;
  gap: 14px;
  min-width: 0;
  max-width: 100%;
  background: #120d20;
  padding: 18px;
  overflow-wrap: anywhere;
}

.copy-form {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.copy-alerts-label,
.copy-alerts {
  grid-column: 1 / -1;
}

.checkline {
  display: flex;
  align-items: center;
  gap: 10px;
}

.checkline span {
  color: var(--ink);
  line-height: 1.35;
  text-shadow: none;
}

.copy-value,
.copy-summary,
.copy-candidate,
.copy-alerts,
.wallet-positions {
  border: 3px solid var(--line);
  background: #090714;
  color: var(--ink);
  padding: 12px;
  box-shadow: 4px 4px 0 var(--shadow);
}

.copy-summary {
  display: grid;
  gap: 6px;
}

.copy-summary strong {
  color: var(--green);
  font-size: 1.1rem;
  text-shadow: 2px 2px 0 var(--line);
}

.copy-summary span {
  color: #eee7ff;
}

.copy-candidate {
  display: grid;
  gap: 7px;
}

.copy-candidate strong {
  color: var(--green);
  font-size: 1.1rem;
  text-shadow: 2px 2px 0 var(--line);
}

.copy-candidate span {
  color: #eee7ff;
}

.copy-alerts {
  display: grid;
  gap: 10px;
}

.copy-alert {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: start;
  min-width: 0;
  border-bottom: 2px solid rgba(255, 255, 255, 0.12);
  padding: 12px;
  background: rgba(255, 255, 255, 0.03);
}

.copy-alert-main {
  display: grid;
  gap: 9px;
  min-width: 0;
}

.copy-alert:last-child {
  border-bottom: 0;
}

.copy-alert-title {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 12px;
  align-items: baseline;
  justify-content: space-between;
}

.copy-alert strong,
.copy-alert-title strong {
  text-shadow: 2px 2px 0 var(--line);
}

.copy-alert.open strong {
  color: var(--green);
}

.copy-alert.close strong {
  color: var(--red);
}

.copy-alert p,
.copy-alert span {
  color: #eee7ff;
  font-size: 0.84rem;
  line-height: 1.35;
  overflow-wrap: anywhere;
}

.copy-alert p {
  margin: 0;
}

.copy-decision-grid {
  display: grid;
  grid-template-columns: minmax(88px, 0.85fr) minmax(0, 1fr);
  gap: 6px 10px;
  border: 2px solid rgba(255, 225, 76, 0.2);
  background: #090714;
  padding: 10px;
}

.copy-decision-grid span {
  color: var(--muted);
  text-transform: uppercase;
  font-size: 0.68rem;
}

.copy-decision-grid strong {
  color: var(--ink);
  text-align: right;
  font-size: 0.78rem;
  text-shadow: none;
}

.copy-condition {
  color: #eee7ff;
  font-weight: 900;
}

.copy-alert .risk-warning {
  color: var(--red);
  font-weight: 900;
}

.copy-alert > button {
  min-width: 92px;
  padding-inline: 10px;
  white-space: nowrap;
}

.copy-alert button:disabled {
  cursor: not-allowed;
  filter: grayscale(0.75);
  opacity: 0.65;
  transform: none;
}

.onchain-panel {
  margin-top: 16px;
}

.leaderboard-note {
  border-bottom: 4px solid var(--line);
  background: #120d20;
  color: #eee7ff;
  padding: 14px 18px;
  font-size: 0.86rem;
  line-height: 1.45;
}

.wallet-leaderboard {
  display: grid;
  gap: 4px;
  background: var(--line);
}

.leaderboard-summary {
  background: #120d20;
  color: var(--cyan);
  padding: 12px 18px;
  font-size: 0.82rem;
  line-height: 1.45;
}

.wallet-rank {
  display: grid;
  grid-template-columns: 64px minmax(0, 1fr) minmax(130px, auto) minmax(130px, auto) auto;
  gap: 12px;
  align-items: center;
  min-width: 0;
  background: #120d20;
  padding: 14px 18px;
}

.chart-panel {
  margin-top: 16px;
}

.challenge-chart {
  display: grid;
  gap: 4px;
  background: var(--line);
}

.chart-summary {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 4px;
  background: var(--line);
}

.chart-summary div {
  display: grid;
  gap: 6px;
  background: #120d20;
  padding: 14px 18px;
}

.chart-summary span {
  color: var(--muted);
  font-size: 0.76rem;
  text-transform: uppercase;
}

.chart-summary strong {
  color: var(--cyan);
  font-size: 1.15rem;
}

.pnl-chart {
  display: block;
  width: 100%;
  min-height: 300px;
  background: #120d20;
}

.chart-grid {
  stroke: rgba(255, 255, 255, 0.12);
  stroke-width: 1;
}

.chart-zero {
  stroke: var(--yellow);
  stroke-dasharray: 6 6;
  stroke-width: 2;
}

.chart-label,
.chart-name {
  fill: #eee7ff;
  font-family: var(--font);
  font-size: 13px;
}

.bets-grid {
  display: grid;
  grid-template-columns: minmax(260px, 340px) minmax(0, 1fr);
  gap: 4px;
  background: var(--line);
}

.bet-slip,
.bet-totals {
  display: grid;
  gap: 12px;
  background: #120d20;
  padding: 18px;
}

.bet-rules {
  display: grid;
  gap: 8px;
  border: 3px solid var(--line);
  background: #090613;
  padding: 12px;
  color: #eee7ff;
  font-size: 0.78rem;
  line-height: 1.35;
}

.bet-rules strong {
  color: var(--yellow);
}

.bet-slip label {
  display: grid;
  gap: 8px;
  color: var(--yellow);
  font-size: 0.76rem;
  text-transform: uppercase;
}

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

.bet-total-card {
  display: grid;
  gap: 6px;
}

.bet-total-card strong {
  color: var(--green);
  font-size: 1.15rem;
}

.rank-number {
  color: var(--yellow);
  font-size: 1.25rem;
  font-weight: 900;
  text-shadow: 2px 2px 0 var(--line);
}

.rank-wallet,
.rank-metric {
  display: grid;
  gap: 4px;
  min-width: 0;
}

.rank-wallet strong {
  color: var(--green);
  text-shadow: 2px 2px 0 var(--line);
}

.rank-metric {
  color: var(--ink);
  font-weight: 900;
  text-align: right;
}

.rank-wallet span,
.rank-metric span {
  color: #eee7ff;
  font-size: 0.84rem;
  font-weight: 400;
  overflow-wrap: anywhere;
}

.negative-rank .rank-wallet strong {
  color: var(--red);
}

.wallet-positions {
  display: grid;
  gap: 10px;
}

.wallet-position {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  min-width: 0;
  border-bottom: 2px solid rgba(255, 255, 255, 0.12);
  padding-bottom: 10px;
}

.wallet-position:last-child {
  border-bottom: 0;
  padding-bottom: 0;
}

.wallet-position div {
  display: grid;
  gap: 5px;
  min-width: 0;
}

.wallet-position strong {
  color: var(--cyan);
  text-shadow: 2px 2px 0 var(--line);
}

.wallet-position span {
  color: #eee7ff;
  font-size: 0.82rem;
}

.wallet-position span.positive,
.wallet-position .positive {
  color: var(--green);
}

.wallet-position span.negative,
.wallet-position .negative {
  color: var(--red);
}

.wallet-position button {
  min-height: 34px;
  padding: 0 10px;
}

.copy-note {
  margin: 0;
  color: var(--muted);
  font-size: 0.82rem;
  line-height: 1.45;
}

.copy-explainer {
  display: grid;
  gap: 10px;
  border: 3px solid var(--line);
  background: #090714;
  padding: 12px;
  box-shadow: 4px 4px 0 var(--shadow);
}

.copy-explainer p {
  margin: 0;
  color: #eee7ff;
  font-size: 0.85rem;
  line-height: 1.45;
}

.modal[hidden] {
  display: none;
}

.modal {
  position: fixed;
  inset: 0;
  z-index: 10;
  display: grid;
  align-items: start;
  justify-items: center;
  padding: 8px 14px 18px;
  overflow: hidden;
  overscroll-behavior: contain;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background:
    repeating-linear-gradient(
      to bottom,
      rgba(255, 255, 255, 0.045),
      rgba(255, 255, 255, 0.045) 1px,
      transparent 1px,
      transparent 4px
    ),
    rgba(2, 1, 6, 0.78);
}

.modal-card {
  position: relative;
  z-index: 1;
  width: min(1180px, 100%);
  height: calc(100dvh - 26px);
  max-height: calc(100vh - 26px);
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  max-width: calc(100vw - 28px);
  overscroll-behavior: contain;
  scrollbar-color: var(--cyan) #090714;
  scrollbar-width: thin;
}

.modal-card > .panel-heading {
  flex: 0 0 auto;
}

.modal-card > .copy-grid {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  overscroll-behavior: contain;
  scrollbar-color: var(--cyan) #090714;
  scrollbar-width: thin;
}

.modal::-webkit-scrollbar,
.modal-card::-webkit-scrollbar,
.modal-card > .copy-grid::-webkit-scrollbar {
  width: 14px;
}

.modal::-webkit-scrollbar-track,
.modal-card::-webkit-scrollbar-track,
.modal-card > .copy-grid::-webkit-scrollbar-track {
  background: #090714;
  border-left: 3px solid var(--line);
}

.modal::-webkit-scrollbar-thumb,
.modal-card::-webkit-scrollbar-thumb,
.modal-card > .copy-grid::-webkit-scrollbar-thumb {
  border: 3px solid var(--line);
  background: var(--cyan);
}

.competitor-card {
  overflow: hidden;
}

.competitor-card:nth-child(1) .nick {
  color: var(--cyan);
}

.competitor-card:nth-child(2) .nick {
  color: var(--pink);
}

.competitor-top {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  padding: 18px;
  border-bottom: 4px solid var(--line);
  background:
    linear-gradient(90deg, rgba(50, 242, 255, 0.1), rgba(255, 79, 216, 0.08)),
    var(--panel-2);
}

.name-row {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 10px;
}

.avatar {
  display: block;
  width: 64px;
  height: 64px;
  border: 4px solid var(--line);
  background: #05030a;
  box-shadow: 4px 4px 0 var(--shadow);
  object-fit: cover;
  image-rendering: pixelated;
}

.nick {
  margin: 5px 0;
  font-size: 0.82rem;
  font-weight: 900;
  text-transform: uppercase;
  text-shadow: 2px 2px 0 var(--line);
}

.wallet {
  max-width: 340px;
  overflow: hidden;
  color: var(--muted);
  font-size: 0.78rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.pnl {
  text-align: right;
}

.pnl-value {
  font-size: clamp(1.8rem, 3vw, 3.35rem);
  font-weight: 900;
  line-height: 1;
  text-shadow: 3px 3px 0 var(--line);
}

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

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

.metrics {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 4px;
  background: var(--line);
  border-bottom: 4px solid var(--line);
}

.metric {
  min-width: 0;
  background: #120d20;
  padding: 14px;
}

.metric strong {
  display: block;
  overflow: hidden;
  color: var(--ink);
  font-size: 1rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sparkline {
  display: block;
  width: 100%;
  height: 78px;
  padding: 12px 16px 16px;
  background:
    linear-gradient(rgba(255, 255, 255, 0.06) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.06) 1px, transparent 1px),
    #0b0813;
  background-size: 12px 12px;
}

.panel-grid {
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.15fr);
  margin-bottom: 16px;
}

.panel {
  overflow: hidden;
}

.panel-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 18px;
  border-bottom: 4px solid var(--line);
  background: var(--panel-2);
}

.table-wrap {
  overflow-x: auto;
}

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

th,
td {
  padding: 13px 16px;
  border-bottom: 3px solid var(--line);
  text-align: left;
  vertical-align: top;
}

th {
  background: #0d0918;
  color: var(--yellow);
  font-size: 0.72rem;
  font-weight: 900;
  letter-spacing: 0;
  text-transform: uppercase;
}

td {
  color: #f0eaff;
  font-size: 0.88rem;
}

tr:nth-child(even) td {
  background: rgba(255, 255, 255, 0.035);
}

tr:last-child td {
  border-bottom: 0;
}

.pill {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  border: 3px solid var(--line);
  border-radius: 0;
  background: var(--cyan);
  color: #061018;
  padding: 0 8px;
  box-shadow: 3px 3px 0 var(--shadow);
  font-size: 0.74rem;
  font-weight: 900;
  text-transform: uppercase;
}

.muted {
  color: var(--muted);
}

.empty,
.error-box {
  padding: 18px;
  color: var(--muted);
}

.error-box {
  color: #ffd6da;
}

footer {
  padding: 18px 0 4px;
  color: var(--muted);
  font-size: 0.85rem;
}

@media (max-width: 980px) {
  .topbar,
  .competitor-top {
    display: grid;
  }

  .status-panel,
  .pnl {
    justify-items: start;
    text-align: left;
  }

  .leaderboard,
  .competitor-grid,
  .panel-grid,
  .bets-grid,
  .bet-totals,
  .chart-summary,
  .copy-grid {
    grid-template-columns: 1fr;
  }

  .wallet-rank {
    grid-template-columns: 48px minmax(0, 1fr);
  }

  .wallet-rank .retro-link,
  .rank-metric {
    grid-column: 2;
    text-align: left;
  }

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

@media (max-width: 720px) {
  .copy-form {
    grid-template-columns: 1fr;
  }

  .copy-alert,
  .wallet-position {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 560px) {
  .shell {
    padding: 14px 10px;
  }

  .topbar {
    padding: 14px;
  }

  .leader-card,
  .leader-metric,
  .competitor-top,
  .panel-heading {
    padding: 14px;
  }

  .metrics {
    grid-template-columns: 1fr;
  }

  table {
    min-width: 650px;
  }
}
