/* ═══════════════════════════════════════════
   BASTION — practice floor (paper trading)
   Uses the tokens from style.css.
   ═══════════════════════════════════════════ */
.tpage { --up: #007a68; --muted: #3f5d58; }
body.tpage { background: var(--stone); overflow-x: clip; }
.tpage .up { color: var(--up); } .tpage .dn { color: var(--down); }

/* top bar */
.tbar { position: sticky; top: 0; z-index: 300; display: flex; align-items: center; gap: 24px; height: 84px; padding-right: var(--pad); background: var(--stone); border-bottom: 2px solid var(--ink); }
.tbar .logo { height: 84px; }
.tbar__mid { flex: 1; display: flex; align-items: baseline; gap: 18px; min-width: 0; }
.tbar__tag { font: 600 1.6rem/1 var(--serif); letter-spacing: -.02em; white-space: nowrap; }
.tbar__note { color: var(--muted); font-size: .95rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tbar__back { height: 56px; padding: 0 22px; display: inline-flex; align-items: center; font-weight: 700; box-shadow: inset 0 0 0 2px var(--ink); border-radius: 2px; transition: background-color .3s, color .3s; }
.tbar__back:hover { background: var(--ink); color: var(--mint); }

.tmain { max-width: 1480px; margin: 0 auto; padding: 28px var(--pad) 40px; display: flex; flex-direction: column; gap: 18px; }

/* account strip */
.acct { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 22px 36px; align-items: center; background: var(--ink); color: var(--paper); padding: 22px 26px; border-radius: 2px; }
.acct__left { display: flex; flex-direction: column; gap: 12px; }
.acct__sizes { display: flex; gap: 6px; }
.acct__sizes button { height: 42px; padding: 0 14px; font-weight: 700; font-size: .95rem; color: rgba(255,255,255,.7); box-shadow: inset 0 0 0 1.5px rgba(255,255,255,.25); border-radius: 2px; transition: background-color .25s, color .25s; }
.acct__sizes button:hover { color: var(--paper); }
.acct__sizes button[aria-checked="true"] { background: var(--mint); color: var(--ink); box-shadow: none; }
.acct__status { display: inline-flex; align-items: center; gap: 9px; font-weight: 600; font-size: .95rem; color: var(--mint); }
.acct__status i { width: 9px; height: 9px; border-radius: 50%; background: currentColor; animation: blink 1.6s infinite; }
.acct__status[data-s="passed"] { color: var(--mint); } .acct__status[data-s="passed"] i { animation: none; }
.acct__status[data-s="breached"] { color: #ff8b8f; } .acct__status[data-s="breached"] i { animation: none; }
.acct__nums { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 24px; min-width: 0; }
.acct__nums dt { font-size: .85rem; color: rgba(255,255,255,.6); }
.acct__nums dd { font: 600 clamp(1.25rem, 1.8vw, 1.9rem)/1.15 var(--serif); font-variant-numeric: tabular-nums; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.acct__nums dd.up { color: var(--mint); } .acct__nums dd.dn { color: #ff8b8f; }
.bars { grid-column: 1 / -1; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 28px; padding-top: 18px; border-top: 1px solid rgba(255,255,255,.12); }
.bar__k { display: flex; justify-content: space-between; gap: 12px; font-size: .85rem; color: rgba(255,255,255,.7); margin-bottom: 5px; }
.bar__k b { color: var(--paper); font-weight: 600; font-variant-numeric: tabular-nums; }
.bar__t { height: 6px; background: rgba(255,255,255,.12); border-radius: 3px; overflow: hidden; }
.bar__t i { display: block; height: 100%; width: 0; background: var(--mint); transition: width .5s var(--ease), background-color .3s; }
.bar--risk .bar__t i { background: #ffb547; }
.bar--risk.is-hot .bar__t i { background: #ff6b70; }
.acct__reset { grid-column: 3; grid-row: 1; height: 46px; padding: 0 18px; font-weight: 700; font-size: .92rem; color: var(--paper); box-shadow: inset 0 0 0 1.5px rgba(255,255,255,.3); border-radius: 2px; transition: background-color .25s, color .25s; }
.acct__reset:hover { background: var(--paper); color: var(--ink); }

/* main grid */
.tgrid { display: grid; grid-template-columns: 270px minmax(0, 1fr) 360px; gap: 18px; align-items: stretch; }
.mk, .ch, .tk, .pos { background: var(--paper); border-radius: 2px; box-shadow: 0 0 0 1.5px rgba(4,32,28,.1); }

/* markets list */
.mk { display: flex; flex-direction: column; min-height: 0; max-height: 640px; }
.mk__head { display: flex; justify-content: space-between; align-items: center; padding: 18px 18px 12px; font: 600 1.25rem/1 var(--serif); }
.mk__live { display: inline-flex; align-items: center; gap: 7px; font: 600 .82rem var(--sans); color: var(--up); }
.mk__live i { width: 7px; height: 7px; border-radius: 50%; background: currentColor; animation: blink 1.6s infinite; }
.mk__live.is-off { color: var(--down); }
.mk__cols, .mk__row { display: grid; grid-template-columns: 1fr 1fr 64px; gap: 8px; align-items: center; padding: 0 18px; }
.mk__cols { font-size: .78rem; font-weight: 600; color: var(--muted); padding-bottom: 8px; border-bottom: 2px solid var(--ink); }
.mk__cols span:not(:first-child), .mk__row span:not(:first-child) { text-align: right; }
.mk__list { overflow-y: auto; flex: 1; }
.mk__row { width: 100%; min-height: 46px; text-align: left; border-bottom: 1px solid rgba(4,32,28,.08); font-variant-numeric: tabular-nums; font-size: .92rem; transition: background-color .2s; }
.mk__row b { font-weight: 700; }
.mk__row:hover { background: var(--stone); }
.mk__row[aria-selected="true"] { background: var(--mint); }
.mk__row.tick-up { animation: tUp .7s; } .mk__row.tick-dn { animation: tDn .7s; }
@keyframes tUp { from { background: rgba(0,179,154,.3); } } @keyframes tDn { from { background: rgba(229,72,77,.22); } }

/* chart */
.ch { display: flex; flex-direction: column; padding: 20px 22px 14px; min-height: 520px; min-width: 0; }
.ch__head { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; }
.ch__coin { font: 600 clamp(2rem, 3vw, 2.8rem)/1 var(--serif); letter-spacing: -.03em; }
.ch__sub { display: block; margin-top: 6px; font-size: .88rem; color: var(--muted); }
.ch__px { text-align: right; }
.ch__px b { display: block; font: 600 clamp(1.8rem, 2.6vw, 2.6rem)/1 var(--serif); font-variant-numeric: tabular-nums; }
.ch__px span { display: block; margin-top: 6px; font-weight: 600; font-size: .92rem; font-variant-numeric: tabular-nums; }
.ch__tf { display: flex; gap: 4px; margin: 16px 0 8px; }
.ch__tf button { height: 34px; padding: 0 12px; font-weight: 700; font-size: .85rem; border-radius: 2px; color: var(--muted); }
.ch__tf button[aria-selected="true"] { background: var(--ink); color: var(--mint); }
#chart { display: block; flex: 1 1 0; width: 100%; height: 0; min-height: 360px; touch-action: none; }

/* ticket */
.tk { display: flex; flex-direction: column; gap: 16px; padding: 20px; }
.tk__side { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.tk__side button { height: 52px; font-weight: 800; font-size: 1.02rem; border-radius: 2px; box-shadow: inset 0 0 0 2px rgba(4,32,28,.15); transition: background-color .2s, color .2s, box-shadow .2s; }
.tk__long[aria-checked="true"] { background: var(--up); color: var(--paper); box-shadow: none; }
.tk__short[aria-checked="true"] { background: var(--down); color: var(--paper); box-shadow: none; }
.tk__f { display: flex; flex-direction: column; gap: 7px; }
.tk__k { display: flex; justify-content: space-between; font-weight: 600; font-size: .9rem; }
.tk__k em { font-style: normal; font-weight: 500; color: var(--muted); }
.tk__k b { font-variant-numeric: tabular-nums; }
.tk__in { display: flex; align-items: center; height: 50px; padding: 0 14px; background: var(--stone); border-radius: 2px; box-shadow: inset 0 0 0 1.5px rgba(4,32,28,.12); }
.tk__in:focus-within { box-shadow: inset 0 0 0 2px var(--ink); }
.tk__in i { font-style: normal; color: var(--muted); margin-right: 6px; }
.tk__in input { flex: 1; min-width: 0; width: 100%; border: 0; background: none; outline: none; font: 600 1.05rem var(--sans); font-variant-numeric: tabular-nums; }
.tk__pct { display: grid; grid-template-columns: repeat(4, 1fr); gap: 4px; margin-top: -6px; }
.tk__pct button { height: 34px; font-weight: 700; font-size: .82rem; border-radius: 2px; background: var(--stone); transition: background-color .2s, color .2s; }
.tk__pct button:hover { background: var(--ink); color: var(--mint); }
.tk__two { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 10px; }
.tk__two .tk__k em { display: none; }
.tk__two .tk__k { font-size: .82rem; }
.tk input[type=range] { -webkit-appearance: none; appearance: none; width: 100%; height: 28px; background: transparent; }
.tk input[type=range]::-webkit-slider-runnable-track { height: 4px; background: var(--ink); }
.tk input[type=range]::-moz-range-track { height: 4px; background: var(--ink); }
.tk input[type=range]::-webkit-slider-thumb { -webkit-appearance: none; width: 24px; height: 24px; margin-top: -10px; background: var(--mint); border: 3px solid var(--ink); border-radius: 50%; }
.tk input[type=range]::-moz-range-thumb { width: 18px; height: 18px; background: var(--mint); border: 3px solid var(--ink); border-radius: 50%; }
.tk__sum { display: grid; grid-template-columns: 1fr 1fr; gap: 10px 14px; padding: 14px 0; border-top: 1px solid rgba(4,32,28,.1); border-bottom: 1px solid rgba(4,32,28,.1); }
.tk__sum dt { font-size: .8rem; color: var(--muted); }
.tk__sum dd { font-weight: 700; font-variant-numeric: tabular-nums; }
.tk__go { height: 62px; font-weight: 800; font-size: 1.1rem; color: var(--paper); background: var(--up); border-radius: 2px; transition: background-color .2s, transform .2s var(--ease), opacity .2s; }
.tk__go.is-short { background: var(--down); }
.tk__go:hover { transform: translateY(-2px); }
.tk__go:disabled { opacity: .45; transform: none; }
.tk__note { font-size: .8rem; color: var(--muted); }

/* positions */
.pos { padding: 8px 0 6px; }
.pos__tabs { display: flex; align-items: center; gap: 4px; padding: 8px 18px 12px; }
.pos__tabs [role=tab] { height: 40px; padding: 0 16px; font: 600 1.15rem var(--serif); border-radius: 2px; color: var(--muted); }
.pos__tabs [role=tab] b { font: 700 .8rem var(--sans); margin-left: 6px; padding: 2px 7px; background: var(--stone); border-radius: 10px; }
.pos__tabs [aria-selected="true"] { background: var(--ink); color: var(--mint); }
.pos__tabs [aria-selected="true"] b { background: var(--mint); color: var(--ink); }
.pos__closeall { margin-left: auto; height: 38px; padding: 0 14px; font-weight: 700; font-size: .85rem; box-shadow: inset 0 0 0 1.5px var(--ink); border-radius: 2px; }
.pos__closeall:hover { background: var(--ink); color: var(--mint); }
.pos__closeall[hidden] { display: none; }
.pr { display: grid; grid-template-columns: 1fr .8fr 1.1fr 1fr 1fr 1.3fr 1.3fr 92px; gap: 10px; align-items: center; min-height: 54px; padding: 0 18px; border-bottom: 1px solid rgba(4,32,28,.08); font-variant-numeric: tabular-nums; font-size: .93rem; }
.pr--hist { grid-template-columns: .9fr .9fr .7fr 1.1fr 1fr 1fr 1fr 1.2fr; }
.pr--head { min-height: 38px; font-size: .78rem; font-weight: 600; color: var(--muted); border-bottom: 2px solid var(--ink); }
.pr b { font-weight: 700; }
.pr .pnl { font-weight: 700; }
.pr .pnl small { display: block; font-weight: 600; font-size: .78rem; opacity: .8; }
.side { display: inline-block; padding: 3px 9px; border-radius: 2px; font-weight: 700; font-size: .8rem; color: var(--paper); }
.side--l { background: var(--up); } .side--s { background: var(--down); }
.pr__x { height: 36px; font-weight: 700; font-size: .85rem; box-shadow: inset 0 0 0 1.5px var(--ink); border-radius: 2px; }
.pr__x:hover { background: var(--ink); color: var(--mint); }
.pos__empty { padding: 26px 18px; color: var(--muted); }
.pos__empty[hidden] { display: none; }
.tfoot { font-size: .82rem; color: var(--muted); text-align: center; padding-top: 6px; }

/* result dialog */
.res { position: fixed; inset: 0; z-index: 5000; display: grid; place-items: center; padding: 24px; background: rgba(4,32,28,.6); opacity: 0; visibility: hidden; pointer-events: none; transition: opacity .35s, visibility 0s .35s; }
.res.is-open { opacity: 1; visibility: visible; pointer-events: auto; transition: opacity .35s; }
.res__card { width: min(620px, 100%); background: var(--mint); padding: 42px; border-radius: 2px; transform: translateY(16px); transition: transform .5s var(--ease); }
.res.is-open .res__card { transform: none; }
.res[data-s="breached"] .res__card { background: var(--paper); }
.res__k { font-weight: 600; color: var(--muted); }
.res__t { font: 600 clamp(3rem, 7vw, 5rem)/.95 var(--serif); letter-spacing: -.04em; margin: 10px 0 16px; }
.res__p { font-size: 1.05rem; max-width: 48ch; }
.res__row { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 28px; }

@media (max-width: 1240px) {
  .acct { grid-template-columns: minmax(0, 1fr) auto; }
  .acct__nums { grid-column: 1 / -1; grid-row: 2; }
  .acct__reset { grid-column: 2; grid-row: 1; }
  .tgrid { grid-template-columns: 240px minmax(0, 1fr); }
  .tk { grid-column: 1 / -1; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); align-items: end; }
  .tk__side, .tk__sum, .tk__go, .tk__note { grid-column: 1 / -1; }
}
@media (max-width: 860px) {
  .tbar__note { display: none; }
  .acct { grid-template-columns: 1fr; gap: 18px; }
  .acct__nums { grid-template-columns: 1fr 1fr; grid-row: auto; }
  .acct__reset { grid-column: auto; grid-row: auto; justify-self: start; }
  .bars { grid-template-columns: 1fr; gap: 12px; }
  .tgrid { grid-template-columns: 1fr; }
  .mk { max-height: 300px; }
  .ch { min-height: 420px; }
  #chart { min-height: 280px; }
  .tk { display: flex; align-items: stretch; }
  .pos { overflow-x: auto; }
  .pr { min-width: 760px; }
}
@media (max-width: 560px) {
  .tbar { gap: 10px; }
  .tbar .logo span, .tbar__back { display: none; }
  .tbar__tag { font-size: 1.25rem; }
  .acct__sizes button { padding: 0 10px; font-size: .85rem; }
}
