/* The pit: a hidden trading minigame (js/pit.js). The $ button sits bottom right, over the status bar's edge. */
.pit-btn {
  position: fixed; z-index: 55; right: clamp(12px, 2vw, 22px); bottom: calc(42px + env(safe-area-inset-bottom, 0px));
  width: 34px; height: 34px; display: grid; place-items: center; padding: 0 0 2px;
  font: 22px/1 var(--display); color: var(--fg); background: var(--bg-raise); border: 1px solid var(--faint); border-radius: 4px;
  cursor: pointer; opacity: .55; transition: opacity .2s, color .2s, border-color .2s, transform .15s;
}
.pit-btn:hover, .pit-btn:focus-visible { opacity: 1; color: var(--hot); border-color: var(--fg); transform: translateY(-1px); }
.pit-open .pit-btn, .booting .pit-btn { display: none; }

.pit { position: fixed; inset: 0; z-index: 82; display: grid; place-items: center; padding: 16px; background: color-mix(in srgb, var(--shade, rgba(0,0,0,.6)) 100%, transparent); backdrop-filter: blur(2px); }
.pit[hidden] { display: none; }
.pit-box { width: min(1280px, 100%); max-height: calc(100vh - 32px); overflow: auto; background: var(--bg-raise); color: var(--text); border: 1px solid var(--fg);
  box-shadow: 0 30px 80px var(--shade, rgba(0,0,0,.6)), 0 0 24px var(--glow, transparent); padding: 14px 18px 18px; text-shadow: none; }
.pit-head { display: flex; align-items: baseline; gap: 18px; flex-wrap: wrap; border-bottom: 1px dashed var(--faint); padding-bottom: 8px; margin-bottom: 12px; }
.pit-head h2 { margin: 0; font: 26px/1 var(--display); color: var(--hot); font-weight: normal; }
.pit-stats { display: flex; gap: 18px; flex-wrap: wrap; font: 15px var(--display); color: var(--dim); font-variant-numeric: tabular-nums; }
.pit-stats b { font-weight: normal; }
.pit-clock { color: var(--hot); min-width: 6ch; }
.pit-x { margin-left: auto; font: 16px var(--display); color: var(--dim); background: none; border: 0; cursor: pointer; }
.pit-x:hover { color: var(--hot); }
.pit-lead { font-family: var(--body); font-size: 14px; line-height: 1.6; max-width: 62ch; margin: 4px 0 16px; }
.pit-len { display: flex; gap: 10px; flex-wrap: wrap; margin: 6px 0 14px; }
.pit-len button { display: grid; gap: 2px; min-width: 120px; padding: 10px 16px; text-align: left; cursor: pointer; font: 14px var(--display); color: var(--dim); background: var(--bg); border: 1px solid var(--faint); }
.pit-len button b { font-weight: normal; font-size: 24px; color: var(--hot); }
.pit-len button:hover, .pit-len button:focus-visible { border-color: var(--fg); color: var(--text); }
.pt-rv { color: var(--hot); }
.pit-keys { color: var(--dim); font-size: 13px; font-family: var(--body); }
.pit kbd { display: inline-block; min-width: 1.5em; text-align: center; padding: 0 3px; margin: 0 1px; border: 1px solid var(--faint); font: 12px var(--body); color: var(--hot); }

/* the play screen: watchlist | chart | ticket, then positions, equity and the log */
.pt-big b { font-size: 18px; }
.pt-main { display: grid; grid-template-columns: 190px minmax(0, 1fr) 250px; gap: 10px; }
.pt-watch { display: grid; gap: 6px; align-content: start; }
.pt-w { display: grid; gap: 3px; text-align: left; padding: 7px 9px; cursor: pointer; background: var(--bg); border: 1px solid var(--faint); color: var(--text); font: 12px var(--body); position: relative; }
.pt-w:hover { border-color: var(--dim); }
.pt-w.on { border-color: var(--fg); box-shadow: inset 3px 0 var(--fg); }
.pt-wn { font: 18px var(--display); color: var(--hot); } .pt-wn i { font-style: normal; color: var(--dim); font-size: 13px; }
.pt-wp { font-variant-numeric: tabular-nums; }
.pt-w canvas { display: block; width: 100%; height: 34px; }
.pt-badge { font-size: 11.5px; } .pt-badge b { font-weight: 500; }
.pt-w kbd { position: absolute; top: 6px; right: 6px; font-size: 9.5px; opacity: .7; }
.pt-chart { border: 1px solid var(--faint); background: var(--bg); min-width: 0; display: flex; flex-direction: column; }
.pt-chart-h { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 14px; padding: 6px 10px; border-bottom: 1px solid var(--faint); font: 12px var(--body); font-variant-numeric: tabular-nums; }
.pt-chart-h b { font: 20px var(--display); font-weight: normal; color: var(--hot); } .pt-chart-h b i { font-style: normal; color: var(--dim); font-size: 14px; }
.pt-lp { font: 20px var(--display); }
.pt-ohlc { margin-left: auto; }
.pt-cwrap { flex: 1 1 auto; min-height: 400px; }
.pt-chart canvas { position: absolute; inset: 0; display: block; width: 100%; height: 100%; cursor: crosshair; }
.pt-ticket { border: 1px solid var(--faint); background: var(--bg); padding: 10px; display: grid; gap: 8px; align-content: start; }
.pt-lbl { margin: 2px 0 0; font: 13px var(--display); color: var(--dim); display: flex; justify-content: space-between; gap: 8px; }
.pt-lbl span { font: 11.5px var(--body); text-align: right; }
.pt-chips { display: flex; gap: 3px; }
.pt-chips button { flex: 1; font: 15px var(--display); padding: 3px 0; cursor: pointer; color: var(--dim); background: none; border: 1px solid var(--faint); display: grid; justify-items: center; }
.pt-chips[data-levs] { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); }
.pt-chips button kbd { font-size: 9px; border: 0; opacity: .6; padding: 0; margin: 0; min-width: 0; }
.pt-chips button:hover { color: var(--hot); border-color: var(--dim); }
.pt-chips button[aria-pressed="true"] { color: var(--bg); background: var(--fg); border-color: var(--fg); }
.pt-chips button[aria-pressed="true"] kbd { color: var(--bg); }
.pt-go { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; margin-top: 4px; }
.pt-go button, .pt-close { font: 18px var(--display); padding: 8px 6px; cursor: pointer; border: 1px solid; display: flex; justify-content: center; align-items: center; gap: 8px; }
.pt-go kbd, .pt-close kbd { font-size: 10px; }
.pt-long { color: var(--bg); background: var(--fg); border-color: var(--fg); }
.pt-short { color: var(--bg); background: var(--danger); border-color: var(--danger); }
.pt-long kbd, .pt-short kbd { color: var(--bg); border-color: currentColor; }
.pt-go button:hover:not(:disabled) { filter: brightness(1.12); }
.pt-go button:disabled, .pt-close:disabled { opacity: .35; cursor: not-allowed; }
.pt-close { color: var(--hot); background: none; border-color: var(--dim); font-size: 15px; padding: 5px; }
.pt-pos { display: grid; grid-template-columns: 1fr 1fr; gap: 4px 10px; margin: 4px 0 0; font: 12px var(--body); font-variant-numeric: tabular-nums; border-top: 1px dashed var(--faint); padding-top: 8px; }
.pt-pos dt { color: var(--dim); font-size: 11px; } .pt-pos dd { margin: 0; color: var(--text); }
.pt-upnl { grid-column: 1 / -1; padding: 6px 8px; border: 1px solid currentColor; }
.pt-upnl dt { color: inherit; opacity: .8; } .pt-upnl dd { font: 28px/1.1 var(--display); color: inherit; } .pt-upnl dd span { font: 12px var(--body); opacity: .85; display: block; }
.pt-none { grid-column: 1 / -1; margin: 0; }
.pt-low { display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr) minmax(0, 1fr); gap: 10px; margin-top: 10px; align-items: start; }
.pt-poss { min-width: 0; overflow-x: auto; }
.pt-tbl { width: 100%; border-collapse: collapse; font: 12px var(--body); font-variant-numeric: tabular-nums; }
.pt-tbl th { text-align: left; font-weight: normal; color: var(--dim); padding: 2px 5px 4px; border-bottom: 1px solid var(--faint); }
.pt-tbl td { padding: 4px 5px; border-bottom: 1px dashed var(--faint); white-space: nowrap; }
.pt-tbl .r { text-align: right; } .pt-tbl b { font-weight: 500; color: inherit; }
.pt-tbl button { font: 13px var(--display); color: var(--hot); background: none; border: 1px solid var(--dim); padding: 0 6px; cursor: pointer; }
.pt-tbl button:hover { border-color: var(--fg); }
.pt-eqw canvas { display: block; width: 100%; height: 110px; }
.pit-cap { margin: 0 0 4px; font: 13px var(--display); color: var(--dim); text-transform: uppercase; letter-spacing: .1em; }
.pit-log { list-style: none; margin: 0; padding: 0; font-family: var(--body); font-size: 12px; line-height: 1.55; height: 12.5em; overflow: hidden; }
.pit-log li { color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pit-log li:first-child { animation: arrive .3s ease-out; }
.pit-log b { color: var(--hot); font-weight: 500; }
.pit-log .l-news { color: var(--dim); } .pit-log .l-news b { color: var(--fg); }
.pit-log .l-buy { color: var(--fg); } .pit-log .l-sell { color: var(--danger); }
.pit-log .l-liq, .pit-log .l-warn { color: var(--danger); } .pit-log .l-liq b { color: var(--danger); }
.pit .up { color: var(--fg); } .pit .down { color: var(--danger); } .pit .dim { color: var(--dim); }

.pit-final { margin: 6px 0 2px; font: 54px/1 var(--display); }
.pit-final span { font-size: 26px; margin-left: 10px; }
.pit-verdict { margin: 0 0 14px; font-family: var(--body); font-size: 14px; }
.pit-verdict b { color: var(--hot); font-weight: 500; }
.pit-cmp { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin: 0 0 14px; }
.pit-cmp div { border: 1px solid var(--faint); background: var(--bg); padding: 6px 10px; }
.pit-cmp dt { color: var(--dim); font-size: 14px; } .pit-cmp dd { margin: 0; font: 24px var(--display); }
.pit-reveal { font-family: var(--body); font-size: 14px; line-height: 1.6; max-width: 70ch; margin: 0 0 12px; }
.pit-reveal b { color: var(--hot); font-weight: 500; }

/* daily challenge */
.pit-daily { display: grid; gap: 2px; width: 100%; max-width: 640px; margin: 0 0 16px; padding: 10px 14px; text-align: left; cursor: pointer; background: var(--bg); border: 1px solid var(--fg); color: var(--text); font: 13px var(--body); box-shadow: inset 4px 0 var(--fg); }
.pit-daily b { font: 22px var(--display); font-weight: normal; color: var(--hot); }
.pit-daily .pit-dbest { color: var(--fg); }
.pit-daily:hover, .pit-daily:focus-visible { background: color-mix(in srgb, var(--fg) 10%, var(--bg)); }
/* the chart's order menu */
.pt-cwrap { position: relative; }
.pt-menu { position: absolute; z-index: 3; display: grid; gap: 2px; min-width: 210px; padding: 4px; background: var(--bg-raise); border: 1px solid var(--fg); box-shadow: 0 10px 24px var(--shade, rgba(0,0,0,.5)); }
.pt-menu[hidden] { display: none; }
.pt-menu button { font: 13px var(--body); text-align: left; padding: 5px 8px; cursor: pointer; color: var(--hot); background: none; border: 0; }
.pt-menu button:hover:not(:disabled), .pt-menu button:focus-visible { background: color-mix(in srgb, var(--fg) 16%, transparent); }
.pt-menu button[data-om="sl"] { color: var(--danger); } .pt-menu button[data-om="tp"] { color: var(--fg); }

.pit-tag { color: var(--bg); background: var(--dim); padding: 0 6px; }

/* custom size */
.pt-custom { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 3px; }
.pt-custom input, .pt-custom select { font: 14px var(--body); color: var(--text); background: var(--bg-raise); border: 1px solid var(--faint); padding: 4px 6px; min-width: 0; font-variant-numeric: tabular-nums; }
.pt-custom input:focus-visible, .pt-custom select:focus-visible { outline: 1px solid var(--fg); outline-offset: 0; border-color: var(--fg); }

/* the setup screen and the leaderboard */
.pit-setup { display: grid; grid-template-columns: minmax(0, 1fr) minmax(260px, 360px); gap: 24px; align-items: start; }
.pit-lb { border: 1px solid var(--faint); background: var(--bg); padding: 10px 12px; }
.pit-lbtabs { display: flex; gap: 4px; margin: 2px 0 8px; }
.pit-lbtabs button { font: 15px var(--display); padding: 2px 12px; cursor: pointer; color: var(--dim); background: none; border: 1px solid var(--faint); }
.pit-lbtabs button:hover { color: var(--hot); border-color: var(--dim); }
.pit-lbtabs button[aria-selected="true"] { color: var(--bg); background: var(--fg); border-color: var(--fg); }
.pit-board { list-style: none; margin: 0; padding: 0; font: 13px var(--body); font-variant-numeric: tabular-nums; min-height: 4em; }
.pit-board li { display: grid; grid-template-columns: 2.2em minmax(0, 1fr) auto 3.6em; gap: 8px; padding: 3px 4px; border-bottom: 1px dashed var(--faint); }
.pit-board li:nth-child(-n+3) .rk { color: var(--hot); }
.pit-board li.me { background: color-mix(in srgb, var(--fg) 14%, transparent); }
.pit-board .rk { color: var(--dim); text-align: right; }
.pit-board .nm { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--text); }
.pit-board .dim { text-align: right; }
.pit-board .pit-empty { display: block; border: 0; padding: 8px 4px; }
.pit-lbnote { margin: 8px 0 0; font: 12px/1.5 var(--body); color: var(--dim); }
.pit-lbnote b { color: var(--hot); font-weight: 500; }
.pit-endgrid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(260px, 360px); gap: 24px; align-items: start; }
.pit-submit { margin: 0 0 12px; }
.pit-submit div { display: flex; gap: 4px; }
.pit-submit input { flex: 1; min-width: 0; font: 15px var(--body); color: var(--text); background: var(--bg); border: 1px solid var(--faint); padding: 6px 8px; }
.pit-submit input[readonly] { color: var(--hot); border-style: dashed; cursor: not-allowed; }
.pit-msg b { color: var(--hot); font-weight: 500; }
.pit-submit input:focus-visible { outline: 1px solid var(--fg); outline-offset: 0; border-color: var(--fg); }
.pit-submit button { font: 16px var(--display); padding: 4px 14px; cursor: pointer; color: var(--bg); background: var(--fg); border: 1px solid var(--fg); }
.pit-submit button:disabled { opacity: .45; cursor: default; }
.pit-msg { margin: 6px 0 0; min-height: 1.4em; font: 12.5px var(--body); color: var(--dim); }

@media (max-width: 1100px) {
  .pt-main { grid-template-columns: minmax(0, 1fr) 240px; }
  .pt-watch { grid-column: 1 / -1; grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .pt-low { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); } .pt-poss { grid-column: 1 / -1; }
}
@media (max-width: 760px) {
  .pt-main, .pt-low, .pit-cmp, .pit-setup, .pit-endgrid { grid-template-columns: minmax(0, 1fr); }
  .pt-watch { grid-template-columns: minmax(0, 1fr); }
  .pt-cwrap { min-height: 300px; }
  .pit-final { font-size: 40px; }
}
@media (prefers-reduced-motion: reduce) { .pit-btn { transition: none; } .pit-log li:first-child { animation: none; } }
:root[data-phosphor="cardboard"] .pit-box { background-color: var(--kraft); background-image: var(--fibres), var(--flutes); border-color: #8d6232; --bg: #f1e7d3; }
