/* Replay Lab: the panel that drives the bar-by-bar replay of the past. */
#flowReplayButton .rl-rew{display:inline-block;margin-right:6px;color:#38bdf8;font-size:11px;letter-spacing:-1px}
#flowReplayButton.is-live{border-color:#38bdf8;color:#bae6fd}

.rl{position:fixed;left:50%;bottom:14px;transform:translateX(-50%);z-index:10007;width:min(880px,calc(100vw - 32px));
  display:grid;gap:8px;padding:12px 14px;border-radius:14px;background:rgba(11,22,38,.97);border:1px solid #2b4466;
  box-shadow:0 18px 50px rgba(0,0,0,.55);color:#e6edf6;font:13px/1.35 -apple-system,BlinkMacSystemFont,"Segoe UI",Arial,sans-serif}
.rl[hidden]{display:none}
body.chat-dock .rl{left:calc((100vw - var(--chat-w)) / 2);width:min(880px,calc(100vw - var(--chat-w) - 32px))}
body.in-replay-lab .fs-toasts{bottom:150px}

.rl-top{display:flex;align-items:center;gap:10px;min-width:0}
.rl-top b{font-variant-numeric:tabular-nums;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.rl-badge{padding:2px 8px;border-radius:999px;background:#38bdf8;color:#04121f;font-weight:800;font-size:11px;letter-spacing:.04em}
.rl-muted{color:#94a3b8;white-space:nowrap}
.rl-sp{flex:1}
.rl button{all:unset;cursor:pointer;padding:5px 10px;border-radius:7px;background:#1c3352;font-weight:600;white-space:nowrap}
.rl button:hover,.rl button:focus-visible{background:#284670;outline:none}
.rl .rl-pick[aria-pressed="true"]{background:#38bdf8;color:#04121f}
.rl .rl-play{width:30px;text-align:center;background:#38bdf8;color:#04121f}
.rl .rl-play:hover{background:#7dd3fc}
.rl-ctrl{display:flex;align-items:center;gap:8px}
.rl-count{font-variant-numeric:tabular-nums;color:#94a3b8;min-width:62px;text-align:center}
.rl-ctrl input[type=range]{flex:1;margin:0;accent-color:#38bdf8}
.rl-ctrl input[type=range]:disabled{opacity:.4}
.rl-speed{display:flex;gap:2px;padding:2px;border-radius:8px;background:#0b1626}
.rl-speed button{padding:4px 8px;background:transparent;color:#94a3b8}
.rl-speed button[aria-pressed="true"]{background:#1c3352;color:#e6edf6}
.rl-demo{background:#13243b}
.rl-msg{margin:0;min-height:16px;color:#94a3b8}
.rl-msg.error{color:#fca5a5}
.rl-msg.ok{color:#86efac}
.rl-msg:empty{display:none}

/* choosing the starting bar */
body.rl-picking .market-canvas,body.rl-picking .drawing-canvas{cursor:crosshair}
body.rl-picking #app:after{content:"";position:fixed;inset:49px 0 0;pointer-events:none;z-index:9;
  box-shadow:inset 0 0 0 2px rgba(56,189,248,.55)}

@media (max-width:760px){
  .rl{left:8px;right:8px;width:auto;transform:none;bottom:max(10px,env(safe-area-inset-bottom));padding:10px}
  body.chat-open .rl{bottom:calc(min(58vh,440px) + 10px)}
  body.chat-dock .rl{left:8px;width:auto}
  .rl-top [data-a=live],.rl-demo,.rl-muted{display:none}
  .rl-speed{order:3}
  .rl-ctrl{flex-wrap:wrap}
  .rl-ctrl input[type=range]{flex:1 0 100%;order:4}
  .rl-count{min-width:0}
}

/* ---------- demo account ---------- */
.rl .rl-demo[aria-pressed="true"]{background:#38bdf8;color:#04121f}
#replayTradePanel{position:fixed;right:14px;top:104px;width:334px;max-height:calc(100vh - 210px);z-index:10008;
  display:flex;flex-direction:column;border:1px solid #2b4466;border-radius:14px;background:rgba(11,22,38,.97);
  box-shadow:0 22px 60px rgba(0,0,0,.55);color:#e6edf6;font:13px/1.4 -apple-system,BlinkMacSystemFont,"Segoe UI",Arial,sans-serif;
  overflow:hidden;transition:transform .18s ease,opacity .18s ease}
#replayTradePanel.collapsed{transform:translateX(24px);opacity:0;pointer-events:none}
#replayTradePanel header{display:flex;align-items:center;justify-content:space-between;padding:12px 14px;border-bottom:1px solid #22385a;background:#0d1b2f}
#replayTradePanel header span{display:block;font-size:10px;letter-spacing:.14em;text-transform:uppercase;color:#38bdf8;font-weight:800}
#replayTradePanel header b{font-size:15px}
#replayTradePanel header button{all:unset;cursor:pointer;color:#94a3b8;padding:4px 8px;border-radius:6px}
#replayTradePanel header button:hover{background:#1c3352;color:#fff}
.dm-body{overflow:auto;padding:12px;display:grid;gap:12px}
.dm-figures{display:grid;grid-template-columns:repeat(3,1fr);gap:8px}
.dm-figures div{display:grid;gap:2px;min-width:0;padding:9px 10px;border-radius:9px;background:#0b1626;border:1px solid #1d3350}
.dm-figures span{font-size:10px;letter-spacing:.08em;text-transform:uppercase;color:#8aa0bb}
.dm-figures b{font-size:14px;font-variant-numeric:tabular-nums;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.dm-sec{padding:12px;border:1px solid #22385a;border-radius:11px;background:#0b1626;display:grid;gap:10px}
.dm-sec h4{margin:0;font-size:11px;letter-spacing:.1em;text-transform:uppercase;color:#8aa0bb;font-weight:700}
.dm-grid{display:grid;grid-template-columns:1fr 1fr;gap:9px}
.dm-grid label{display:grid;gap:4px;font-size:11.5px;color:#94a3b8;position:relative}
.dm-unit{position:absolute;right:9px;bottom:9px;font-size:10.5px;color:#64748b;pointer-events:none}
.dm-grid input{width:100%;box-sizing:border-box;border:1px solid #2b4466;border-radius:8px;background:#06101d;color:#e6edf6;
  padding:9px 34px 9px 10px;font:inherit;font-size:14px;font-variant-numeric:tabular-nums}
.dm-grid input:focus{outline:2px solid #38bdf8;outline-offset:1px}
.dm-preview{margin:0;color:#cbd5e1;font-size:12.5px;line-height:1.5}
.dm-preview b{color:#e6edf6}
.dm-ticket{display:grid;grid-template-columns:1fr 1fr;gap:8px}
.dm-ticket button{all:unset;cursor:pointer;text-align:center;padding:12px;border-radius:10px;font-weight:800;font-size:14px}
.dm-buy{background:#15803d;color:#dcfce7}
.dm-buy:hover{background:#16a34a}
.dm-sell{background:#b91c1c;color:#fee2e2}
.dm-sell:hover{background:#dc2626}
.dm-flat{grid-column:1/-1;background:#1c3352;color:#cbd5e1;display:none}
.dm-ticket.has-position .dm-flat{display:block}
.dm-ticket.has-position .dm-buy,.dm-ticket.has-position .dm-sell{opacity:.45}
.dm-pos{margin:0;font-size:13px}
.dm-apply{all:unset;cursor:pointer;text-align:center;padding:9px;border-radius:8px;background:#1c3352;font-weight:600;font-size:12.5px}
.dm-apply:hover{background:#284670}
.dm-muted{color:#8aa0bb}
.dm-summary{margin:0;font-size:12.5px;color:#cbd5e1}
.dm-journal{display:grid;gap:1px;max-height:190px;overflow:auto}
.dm-row{display:grid;grid-template-columns:auto 1fr auto;gap:8px;align-items:baseline;padding:7px 0;border-top:1px solid #182c47;font-size:12.5px}
.dm-row b{font-variant-numeric:tabular-nums}
.dm-row span:last-child{grid-column:3;font-variant-numeric:tabular-nums}
.dm-row span:nth-child(3){grid-column:2;text-align:right;font-size:11.5px}
.dm-foot{display:flex;flex-wrap:wrap;gap:8px;align-items:center}
.dm-quiet,.dm-danger{all:unset;cursor:pointer;padding:7px 10px;border-radius:7px;background:#13243b;color:#94a3b8;font-size:12.5px}
.dm-quiet:hover{background:#1c3352;color:#e6edf6}
.dm-quiet.active{color:#7dd3fc}
.dm-danger{background:#3b1520;color:#fca5a5;font-weight:700}
.dm-ask{flex:1;min-width:140px;color:#cbd5e1;font-size:12.5px}
.positive{color:#4ade80}
.negative{color:#f87171}

@media (max-width:760px){
  #replayTradePanel{right:0;left:0;top:auto;bottom:0;width:auto;max-height:76vh;border-radius:16px 16px 0 0;border-left:0;border-right:0;
    padding-bottom:env(safe-area-inset-bottom)}
  #replayTradePanel.collapsed{transform:translateY(24px)}
  .dm-grid{grid-template-columns:1fr 1fr}
}
