/* Splash page (/ and each locale's /), loaded after site.css.

   The first screen is dark. Behind the copy sits a frozen replica of the 2018 BitMEX trading
   terminal, drawn by splash.js twice: as a faint blueprint (outlines only) and as the real
   terminal, visible only through a lens parked behind the top-right corner of the copy. The
   terminal's palette is BitMEX's own 2018-19 dark theme; it is scoped to .term so it never
   leaks into the page's tokens. Below the fold: the all-time leaderboard, then a thank-you row.

   --splash-css lets leaderboard.js tell that this stylesheet applied: the board is decorative and
   only shows when both the script and the stylesheet run. */

:root {
  --splash-css: 1;
}

/* --- hero -------------------------------------------------------------------------------- */

/* The copy sets the hero's height (at least one screen), so a long locale or a short phone never
   pushes it under the terminal's top bar. */
.hero {
  position: relative;
  overflow: hidden;
}

.mark-defs {
  position: absolute;
}

.hero > header {
  position: absolute;
  top: 22px;
  right: 28px;
  z-index: 5;
}

.hero .header-login {
  display: inline-block;
  padding: 8px 14px;
  border-radius: 4px;
  background: rgba(8, 8, 8, 0.9);
}

/* --- the copy ---------------------------------------------------------------------------- */

.msg {
  position: relative;
  z-index: 4;
  min-height: max(100vh, 640px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 96px 24px 64px;
  pointer-events: none;
}

/* site.css lays every <main> out as a ruled two-column row; the splash's is a single card. */
main.card {
  display: block;
  flex: none;
  margin: 0;
  padding: 0;
  border: 0;
  position: relative;
  isolation: isolate;
  width: 100%;
  max-width: 580px;
  pointer-events: auto;
  color: #fff;
}

/* A soft pool of darkness behind the copy, so the lens fades out under it. No visible box. */
main.card::before {
  content: '';
  position: absolute;
  inset: -110px -170px;
  width: auto;
  height: auto;
  z-index: -1;
  background: radial-gradient(closest-side, rgba(7, 10, 12, 0.97) 62%, rgba(7, 10, 12, 0));
}

.card .logo {
  margin-bottom: 44px;
}

.card .logo img {
  height: 22px;
}

.card h1 {
  font-size: clamp(40px, 5.4vw, 60px);
  line-height: 1.1;
  letter-spacing: -0.035em;
  margin: 0 0 28px;
}

.card p {
  font-size: 16px;
  line-height: 1.7;
  color: #a6adba;
  margin: 0 0 14px;
  max-width: none;
}

.card .closure-date {
  font-size: 14px;
  line-height: 1.6;
}

.card .funds-note {
  margin-top: 22px;
  padding-top: 20px;
  border-top: 1px solid #22252b;
  color: #cfcfcf;
  font-size: 15px;
}

.card .cta {
  min-height: 52px;
  margin-top: 26px;
  padding: 0 24px;
}

.card .banner[data-maintenance-notice] {
  margin-top: 22px;
}

/* On the splash the anti-scam notice is fine print under the CTA; content pages box it. */
.card .banner:not([data-maintenance-notice]) {
  display: block;
  max-width: none;
  margin: 28px 0 0;
  padding: 0;
  border: 0;
  background: none;
  font-size: 13px;
  line-height: 1.6;
  color: var(--text-dim);
}

.card .banner:not([data-maintenance-notice]) a {
  color: #cbd0d7;
  border-bottom-color: var(--link-line);
}

.card .banner:not([data-maintenance-notice]) a:hover {
  color: #fff;
  border-bottom-color: #fff;
}

.card .banner-warning,
.card .banner-help {
  display: block;
}

.card .banner-help {
  margin-top: 8px;
}

/* --- the terminal ------------------------------------------------------------------------ */

/* BitMEX's 2018-19 dark-theme palette, from that era's production stylesheet. */
.term {
  --logoBlue: #5b69b1;
  --navBg: #132026;
  --navText: #96a9b0;
  --bgBase: #061117;
  --widget: #0b181e;
  --widgetBorder: #303f45;
  --tabHead: #132026;
  --inner: #1f2e35;
  --text: #cadfe6;
  --link: #9bd0f6;
  --muted: #73868c;
  --green: #52b370;
  --red: #e8704f;
  --green100: #19422c;
  --red100: #5a2f3b;
  --og-sans: 'Open Sans', 'Helvetica Neue', Helvetica, Arial, sans-serif;
  /* blueprint layer: one cool slate hue at three strengths */
  --bpBg: #070a0c;
  --bpl: rgba(150, 186, 200, 0.13);
  --bpt: rgba(150, 186, 200, 0.075);
  --bpr: rgba(150, 186, 200, 0.045);

  position: absolute;
  inset: 0;
  display: grid;
  grid-template-rows: 40px 50px 1fr;
  background: var(--bgBase);
  color: var(--text);
  font: 12px/1.4 var(--og-sans);
  user-select: none;
  /* Each layer is its own stacking context, so the blueprint's floating trollbox can never
     paint over the real terminal shown in the lens. */
  isolation: isolate;
}

/* site.css styles p, h3, table and friends for prose; inside the terminal none of that applies. */
.term *,
.term *::before {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

.term p,
.term li {
  font-size: inherit;
  line-height: inherit;
  max-width: none;
}

.term td,
.term th {
  border-bottom: 0;
}

/* The real terminal: only visible through the lens (mask written inline by splash.js, so moving
   it never restyles the terminal's descendants). Shown as a near-monochrome phosphor image with
   faint scanlines; colour returns only while the mouse is held still. */
.term.real {
  -webkit-mask-image: linear-gradient(transparent, transparent);
  mask-image: linear-gradient(transparent, transparent);
  filter: grayscale(1) contrast(1.08) brightness(1.04);
  transition: opacity 0.6s;
}

.term.real::after {
  content: '';
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 5;
  background: repeating-linear-gradient(to bottom, rgba(0, 0, 0, 0.22) 0 1px, transparent 1px 3px);
}

.term.real.off,
.ring.off {
  opacity: 0;
}

.term.real.slow,
.ring.slow {
  transition: opacity 2.8s ease-in-out;
}

.ring {
  display: block;
  position: absolute;
  left: 0;
  top: 0;
  border-radius: 50%;
  pointer-events: none;
  box-shadow: 0 0 0 1px rgba(202, 223, 230, 0.16);
  transition: opacity 0.6s;
  will-change: transform;
}

/* The blueprint: the same DOM, cloned; only paint changes, never box metrics. !important is
   deliberate: it has to beat every scoped .term rule below. */
.bp,
.bp * {
  color: transparent !important;
  background: transparent !important;
  box-shadow: none !important;
  border-color: var(--bpl) !important;
  opacity: 1 !important;
}

.term.bp {
  background: var(--bpBg) !important;
}

.bp .nav {
  box-shadow: inset 0 -1px var(--bpl) !important;
}

.bp .btns span,
.bp .inst div.on {
  box-shadow: inset 0 0 0 1px var(--bpl) !important;
}

.bp .otabs span.on,
.bp .tabs span.on {
  box-shadow: inset 0 -1px var(--bpl) !important;
}

.bp td {
  box-shadow: inset 0 -1px var(--bpr) !important;
}

.bp tr.ask,
.bp tr.bid {
  background: linear-gradient(to left, var(--bpl) var(--d), transparent var(--d)) 0 100% / 100% 1px
    no-repeat !important;
}

/* Text becomes a single drafting stroke at its x-height: the layout is there, the numbers are not. */
.bp bp-t {
  background: linear-gradient(var(--bpt), var(--bpt)) 0 58% / 100% 1px no-repeat !important;
  -webkit-box-decoration-break: clone;
  box-decoration-break: clone;
}

.bp svg * {
  fill: none !important;
  stroke: var(--bpl) !important;
  stroke-width: 1px !important;
  vector-effect: non-scaling-stroke;
}

.bp line[stroke='#132026'],
.bp line[stroke='#0f1d23'],
.bp rect[opacity] {
  stroke: var(--bpr) !important;
}

.bp .w.troll {
  background: var(--bpBg) !important;
}

.term .num { font-variant-numeric: tabular-nums; }
.term .g { color: var(--green); }
.term .r { color: var(--red); }
.term .m { color: var(--muted); }

.term .nav {
  background: var(--navBg);
  display: flex;
  align-items: center;
  gap: 26px;
  padding: 0 14px;
  color: var(--navText);
  box-shadow: 0 0 2px #000;
  white-space: nowrap;
  overflow: hidden;
}

.term .brand {
  display: flex;
  align-items: center;
  gap: 7px;
  color: #fff;
  font: 700 19px var(--og-sans);
  letter-spacing: -0.3px;
}

.term .brand svg { width: 24px; height: 24px; }
.term .nav > span { color: var(--navText); font-size: 15px; }
.term .nav > span.on { color: #fff; font-weight: 700; }
.term .nav .bal { margin-left: auto; font-size: 11px; line-height: 14px; text-align: right; }
.term .nav .bal b { opacity: 0.8; text-transform: uppercase; padding-right: 4px; }

.term .inst {
  background: var(--widget);
  border-bottom: 1px solid var(--widgetBorder);
  display: flex;
  align-items: stretch;
  overflow: hidden;
  white-space: nowrap;
}

.term .inst div {
  padding: 6px 16px;
  border-right: 1px solid var(--inner);
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.term .inst div b { font-size: 13px; color: #fff; }
.term .inst div span { font-size: 11px; }
.term .inst div.on { background: var(--tabHead); box-shadow: inset 0 -3px var(--logoBlue); }

.term .main { display: grid; grid-template-columns: 232px 1fr; gap: 6px; padding: 6px; min-height: 0; }
.term .col { display: flex; flex-direction: column; gap: 6px; min-height: 0; }

.term .w {
  background: var(--widget);
  border: 1px solid var(--widgetBorder);
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow: hidden;
}

.term .w h3 {
  background: var(--tabHead);
  border-bottom: 1px solid var(--widgetBorder);
  font: 600 12px var(--og-sans);
  color: var(--text);
  padding: 5px 8px;
  display: flex;
  justify-content: space-between;
}

.term .w h3 i { font-style: normal; font-weight: 400; color: var(--muted); }
.term .body { padding: 8px; overflow: hidden; flex: 1; }

.term .otabs { display: flex; border-bottom: 1px solid var(--inner); margin: -8px -8px 8px; }
.term .otabs span { flex: 1; text-align: center; padding: 6px 0; color: var(--link); }
.term .otabs span.on { color: #fff; font-weight: 600; box-shadow: inset 0 -2px var(--logoBlue); }
.term .field { margin-bottom: 8px; }
.term .field label { display: block; color: var(--muted); font-size: 11px; margin-bottom: 2px; }
.term .field div { border: 1px solid var(--widgetBorder); padding: 5px 7px; background: #061117; color: #73868c; }
.term .btns { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; margin: 10px 0; }

.term .btns span {
  color: #fff;
  text-align: center;
  padding: 8px 0;
  font-weight: 600;
  font-size: 13px;
  opacity: 0.45;
  border-radius: 2px;
}

.term .btns .b { background: var(--green); }
.term .btns .s { background: var(--red); }
.term .kv { display: flex; justify-content: space-between; padding: 2px 0; border-bottom: 1px dotted var(--inner); }

.term .centre { display: grid; grid-template-rows: 1fr 250px 130px; gap: 6px; min-height: 0; }
.term .mid { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 6px; min-height: 0; }
.term .chart svg { width: 100%; height: 100%; display: block; }
.term table { width: 100%; border-collapse: collapse; font-size: 12px; line-height: 1.4; }
.term td, .term th { padding: 1px 6px; text-align: right; white-space: nowrap; }
.term td { color: var(--text); }
.term th { font-weight: 600; color: var(--muted); font-size: 11px; border-bottom: 1px solid var(--inner); }
.term td:first-child, .term th:first-child { text-align: left; }
.term tr.ask { background: linear-gradient(to left, var(--red100) var(--d), transparent var(--d)); }
.term tr.bid { background: linear-gradient(to left, var(--green100) var(--d), transparent var(--d)); }
.term .spread td { background: #132026; font-weight: 700; font-size: 13px; padding: 3px 6px; }
.term .tabs { display: flex; background: var(--tabHead); border-bottom: 1px solid var(--widgetBorder); }
.term .tabs span { padding: 5px 10px; color: var(--link); border-right: 1px solid var(--inner); }
.term .tabs span.on { background: var(--widget); color: #fff; font-weight: 600; margin-bottom: -1px; }

/* The trollbox was never a panel: a chat window docked to the bottom edge, floating over the
   terminal. */
.term .w.troll {
  position: absolute;
  right: clamp(20px, 4vw, 96px);
  bottom: 0;
  z-index: 3;
  width: 250px;
  height: 340px;
  border-bottom: 0;
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.5), 0 -4px 18px rgba(0, 0, 0, 0.55);
}

.term .troll > h3 .tb-ctl { display: flex; gap: 12px; align-items: center; }
.term .troll .body { display: flex; flex-direction: column; justify-content: flex-end; gap: 3px; }
.term .troll p { line-height: 1.35; overflow-wrap: break-word; }
.term .troll p b { color: var(--link); font-weight: 600; }
.term .troll p.sys { color: var(--muted); font-style: italic; }
.term .troll .input { border-top: 1px solid var(--inner); padding: 6px 8px; color: #73868c; }

/* --- below the fold ---------------------------------------------------------------------- */

.leaderboard,
.thanks {
  position: relative;
  display: grid;
  grid-template-columns: var(--cols);
  column-gap: var(--col-gap);
  margin-top: 120px;
  padding: 36px 0 96px;
  border-top: 1px solid var(--rule);
}

.leaderboard::before,
.thanks::before {
  content: '';
  position: absolute;
  left: 0;
  top: -6px;
  width: 1px;
  height: 11px;
  background: var(--tick);
}

.leaderboard[hidden] {
  display: none;
}

.leaderboard:not([hidden]) + .thanks {
  margin-top: 0;
}

.lb-head {
  grid-column: 1;
  align-self: start;
  position: sticky;
  top: 32px;
}

.lb-head h2 {
  font-size: 20px;
  line-height: 1.3;
  letter-spacing: -0.01em;
  margin: 0;
}

.lb-head blockquote {
  margin: 12px 0 0;
  font-size: 15px;
  line-height: 1.6;
  font-style: italic;
  color: var(--text-soft);
}

.lb-body {
  grid-column: 2;
  min-width: 0;
}

.lb-controls {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px 20px;
  margin-bottom: 18px;
}

.lb-controls[hidden] {
  display: none;
}

.lb-toggles {
  display: flex;
  flex-wrap: wrap;
  gap: 20px;
}

.lb-toggles label {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 13px;
  color: var(--text-soft);
  cursor: pointer;
}

.lb-toggles input[type='checkbox'] {
  appearance: none;
  width: 13px;
  height: 13px;
  margin: 0;
  border: 1px solid #4a525b;
  border-radius: 2px;
}

.lb-toggles input[type='checkbox']:checked {
  background: var(--text);
  border-color: var(--text);
  box-shadow: inset 0 0 0 2px var(--bg);
}

#lb-search {
  margin-left: auto;
  width: 200px;
  max-width: 100%;
  padding: 6px 0;
  border: 0;
  border-bottom: 1px solid #2c333a;
  border-radius: 0;
  background: transparent;
  color: var(--text);
  font: 14px var(--sans);
}

#lb-search::placeholder {
  color: var(--text-dim);
}

#lb-search:focus-visible {
  outline: none;
  border-bottom-color: var(--text);
}

/* Fixed layout and column widths, so filtering never reflows the table. */
.leaderboard table {
  width: 100%;
  table-layout: fixed;
  font: 14px/1.5 var(--sans);
}

.leaderboard .lb-c-rank { width: 56px; }
.leaderboard .lb-c-pnl { width: 150px; }
.leaderboard .lb-c-day { width: 96px; }

.leaderboard th,
.leaderboard td {
  padding: 11px 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.leaderboard th {
  padding-top: 0;
  font-size: 12px;
  font-weight: 500;
  color: var(--text-dim);
}

.leaderboard td {
  color: var(--text-soft);
}

.leaderboard th .lb-short {
  display: none;
}

.leaderboard td:nth-child(3),
.leaderboard th:nth-child(3),
.leaderboard td:nth-child(4),
.leaderboard th:nth-child(4) {
  text-align: right;
}

.leaderboard td:first-child,
.leaderboard td:nth-child(4) {
  color: var(--text-dim);
}

.leaderboard tr.named td:nth-child(2),
.leaderboard tr:not(.private) td:nth-child(3) {
  color: var(--text);
}

.leaderboard tr.private td {
  color: var(--text-dim);
}

.leaderboard tr.private td:nth-child(2) {
  font-style: italic;
}

.leaderboard .lb-pseudonym {
  margin-left: 2px;
  color: var(--text-dim);
}

.leaderboard .lb-empty {
  margin: 22px 0 0;
  font-size: 14px;
  color: var(--text-dim);
}

.leaderboard .lb-pager {
  display: flex;
  flex-wrap: wrap;
  gap: 2px;
  margin-top: 16px;
}

.leaderboard .lb-pager button,
.leaderboard .lb-pager .lb-gap {
  min-width: 26px;
  padding: 4px;
  border: 0;
  background: none;
  color: var(--text-dim);
  font: 13px var(--sans);
  font-variant-numeric: tabular-nums;
  text-align: center;
}

.leaderboard .lb-pager button {
  cursor: pointer;
}

.leaderboard .lb-pager button:hover,
.leaderboard .lb-pager button[aria-current='page'] {
  color: var(--text);
}

.leaderboard .lb-pager button[aria-current='page'] {
  box-shadow: inset 0 -1px var(--text);
}

.leaderboard .lb-note {
  margin: 16px 0 0;
  font-size: 12px;
  color: var(--text-dim);
}

.thanks > div {
  grid-column: 2;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 24px;
}

.thanks p {
  margin: 0;
  max-width: none;
  font-size: clamp(24px, 3vw, 32px);
  line-height: 1.2;
  font-weight: 600;
  letter-spacing: -0.02em;
  color: var(--text);
}

.thanks .cta {
  margin-top: 0;
}

/* Beside the button the heading has about 360px; a longer one wraps there rather than pushing
   the button onto its own line. */
@media (min-width: 861px) {
  .thanks > div {
    flex-wrap: nowrap;
  }

  .thanks p {
    flex: 1 1 auto;
    min-width: 0;
    text-wrap: balance;
  }

  .thanks .cta {
    flex: none;
  }
}

/* --- easter egg: spam Buy / Sell in the terminal --------------------------------------------
   Notification styles from BitMEX's 2018-19 production stylesheet (.notifications / .error). */

.notifications {
  position: fixed;
  bottom: 0;
  right: 10px;
  z-index: 20;
  width: 30%;
  max-width: 400px;
  font: 13px/1.42857 'Open Sans', 'Helvetica Neue', Helvetica, Arial, sans-serif;
  pointer-events: none;
}

.notifications .notification {
  position: relative;
  background: #faded6;
  border: 1px solid #b93b18;
  margin: 0 0 10px 18px;
  padding: 5px 10px;
  min-height: 80px;
  box-shadow: 2px 2px 4px -1px #000;
  color: #8c2c12;
  opacity: 0;
  transform: translateY(12px);
  transition: opacity 0.25s, transform 0.25s;
}

.notifications .notification.on {
  opacity: 1;
  transform: none;
  pointer-events: auto;
}

.notifications .notification h4 {
  font-size: 16px;
  font-weight: 700;
  line-height: 1.2;
  margin: 5px 0;
  color: #8c2c12;
}

.notifications .notification h4 svg {
  position: relative;
  top: 1px;
  margin-right: 4px;
  fill: currentColor;
}

.notifications .notification .date {
  float: right;
  margin: 3px 22px 0 8px;
  font-size: 11px;
  line-height: 1.4;
  opacity: 0.75;
  font-variant-numeric: tabular-nums;
}

.notifications .notification p {
  margin: 0;
  max-width: none;
  font-size: 13px;
  line-height: 1.42857;
  color: #8c2c12;
}

.notifications .notification .close {
  position: absolute;
  top: 4px;
  right: 8px;
  background: none;
  border: 0;
  font-size: 21px;
  font-weight: 700;
  line-height: 1;
  color: #000;
  opacity: 0.3;
  cursor: pointer;
}

.notifications .notification .close:hover { opacity: 0.6; }
.notifications .notification.item-1 { border-top-width: 4px; margin-left: 6px; }
.notifications .notification.item-2 { border-top-width: 2px; margin-left: 12px; }
.notifications .notification.item-3 { border-top-width: 1.3333333333px; margin-left: 18px; }

.notifications .notification.collapse {
  min-height: 0;
  margin-top: 0;
  margin-bottom: 0;
  padding-top: 0;
  padding-bottom: 0;
  border-width: 0;
  overflow: hidden;
  transition: height 0.32s ease, margin 0.32s ease, padding 0.32s ease, border-width 0.32s ease,
    opacity 0.2s;
}

/* --- responsive -------------------------------------------------------------------------- */

@media (max-width: 1000px) {
  .term .main { grid-template-columns: 1fr; }
  .term .main > .col:first-child,
  .term .troll { display: none; }
  .term .centre { grid-template-rows: 1fr 250px 0; }
  .term .mid { grid-template-columns: 1fr 1fr; }
  .term .mid .depth { display: none; }
}

@media (max-width: 860px) {
  .leaderboard,
  .thanks {
    grid-template-columns: 1fr;
    margin-top: 72px;
    padding-bottom: 64px;
  }

  .lb-head,
  .lb-body,
  .thanks > div {
    grid-column: 1;
  }

  .lb-head {
    position: static;
    margin-bottom: 24px;
  }

  #lb-search {
    margin-left: 0;
    width: 100%;
  }

  .leaderboard .lb-c-day,
  .leaderboard th:nth-child(4),
  .leaderboard td:nth-child(4) {
    display: none;
  }

  .leaderboard .lb-c-rank { width: 42px; }
  .leaderboard .lb-c-pnl { width: 110px; }
  .leaderboard th .lb-long { display: none; }
  .leaderboard th .lb-short { display: inline; }

  /* Wrap rather than clip, so a long name stays readable at any width. */
  .leaderboard td:nth-child(2) {
    white-space: normal;
    overflow-wrap: anywhere;
  }
}

@media (max-width: 768px) {
  .notifications { width: 60%; }
}

/* A phone starts the copy just under the terminal's top bar, its logo centred in the ticker row
   so the old mark and Log In stay clear above it, and spaces it tighter so the withdraw button
   lands on the first screen even on a 667px-tall iPhone SE. */
@media (max-width: 640px) {
  .msg { align-items: flex-start; padding: 54px 20px 48px; }
  .card .logo { margin-bottom: 40px; }
  .card h1 { font-size: 40px; margin-bottom: 20px; }
  .card p { font-size: 15px; line-height: 1.6; }
  .card .funds-note { margin-top: 18px; padding-top: 16px; }
  .card .cta { margin-top: 22px; }
  .card .banner:not([data-maintenance-notice]) { margin-top: 22px; }
  main.card::before { inset: -60px -40px; }
  .hero > header { top: 14px; right: 14px; }
}

@media (max-width: 480px) {
  .notifications { width: auto; left: 10px; }
}

@media (prefers-reduced-motion: reduce) {
  .notifications .notification { transition: none; transform: none; }
}
