/* Phone futures terminal. Keep this after mobile-review.css. */
.mobile-contract-bar,
.mobile-order-type,
.mobile-order-actions,
.book-quantity-short,
.book-mark {
  display: none;
}


/* Shared input and allocation controls. Quantity remains the order's base asset size. */
.available-short, .protection-short { display: none; }
.terminal-page .trade-form-panel .stepper-input {
  position: relative;
  display: grid;
  grid-template-columns: 30px minmax(0, 1fr) 30px;
  grid-template-rows: auto 40px;
  grid-template-areas: none;
  align-items: center;
  gap: 0 3px;
  min-width: 0;
  padding: 4px 5px 2px;
}
.terminal-page .trade-form-panel .stepper-input > .field-heading {
  grid-area: auto;
  grid-column: 1 / -1;
  grid-row: 1;
  max-width: none;
  min-width: 0;
  margin: 0;
  color: #929ba8;
  font-size: 12px;
  line-height: 1.35;
  text-align: center;
}
.terminal-page .field-heading small { font-size: inherit; }
.terminal-page .trade-form-panel .quantity-input > .field-heading {
  padding: 2px 81px 0 5px;
  text-align: left;
}
.terminal-page .trade-form-panel .stepper-input > input {
  grid-area: auto;
  grid-column: 2;
  grid-row: 2;
  width: 100%;
  min-width: 0;
  min-height: 38px;
  padding: 0;
  border: 0;
  background: transparent;
  font-size: 16px;
  font-weight: 500;
  text-align: center;
  -moz-appearance: textfield;
}
.terminal-page .stepper-input input::-webkit-outer-spin-button,
.terminal-page .stepper-input input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.terminal-page .field-stepper {
  grid-row: 2;
  width: 30px;
  min-width: 0;
  min-height: 40px;
  padding: 0;
  color: #929ba8;
  font-size: 22px;
  line-height: 1;
  border-radius: 4px;
  touch-action: manipulation;
}
.terminal-page .field-stepper.step-down { grid-column: 1; }
.terminal-page .field-stepper.step-up { grid-column: 3; }
.terminal-page .field-stepper:active { color: var(--yellow); background: #323946; }
.terminal-page .amount-unit {
  position: absolute;
  top: 1px;
  right: 5px;
  display: flex;
  align-items: center;
  width: 78px;
  max-width: 48%;
  min-height: 26px;
}
.terminal-page .amount-unit select {
  appearance: none;
  -webkit-appearance: none;
  width: 100%;
  min-height: 26px;
  padding: 2px 16px 2px 2px;
  border: 0;
  background: transparent;
  color: #dce0e5;
  font-size: 16px;
  line-height: 1.2;
  text-align: right;
  text-align-last: right;
}
.terminal-page .amount-unit .icon {
  position: absolute;
  right: 0;
  width: 11px;
  height: 11px;
  color: #929ba8;
  pointer-events: none;
}
.terminal-page .amount-unit option { background: #202630; }
.terminal-page .trade-form-panel .stepper-input.is-market { opacity: .75; }
.terminal-page .trade-form-panel .stepper-input > .market-price-note {
  grid-area: auto;
  grid-column: 1 / -1;
  grid-row: 2;
  font-size: 16px;
  text-align: center;
}
.terminal-page .amount-equivalent {
  margin: -2px 0 6px;
  color: #929ba8;
  font-size: 11px;
  line-height: 1.4;
  text-align: right;
  font-variant-numeric: tabular-nums;
}
.terminal-page .amount-equivalent[hidden] { display: none; }
.terminal-page .allocation-control { --allocation-fill: 0%; margin: 7px 0 0; min-width: 0; }
.terminal-page .allocation-caption {
  display: flex;
  justify-content: space-between;
  gap: 6px;
  color: #929ba8;
  font-size: 12px;
  line-height: 1.4;
}
.terminal-page .allocation-caption output { color: var(--yellow); font-weight: 600; font-variant-numeric: tabular-nums; }
.terminal-page .allocation-caption output.over-capacity { color: #f6465d; }
.terminal-page .allocation-track { position: relative; height: 30px; margin: 0 6px; }
.terminal-page .allocation-control .allocation-range {
  position: relative;
  z-index: 2;
  display: block;
  appearance: none;
  -webkit-appearance: none;
  width: 100%;
  min-width: 0;
  min-height: 30px;
  height: 30px;
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 0;
  outline-offset: 2px;
  background: transparent;
  cursor: pointer;
  touch-action: pan-y;
}
.terminal-page .allocation-control .allocation-range::-webkit-slider-runnable-track {
  height: 3px;
  border: 0;
  border-radius: 0;
  background: linear-gradient(to right, var(--yellow) 0 var(--allocation-fill), #424b58 var(--allocation-fill) 100%);
}
.terminal-page .allocation-control .allocation-range::-moz-range-track { height: 3px; background: #424b58; }
.terminal-page .allocation-control .allocation-range::-moz-range-progress { height: 3px; background: var(--yellow); }
.terminal-page .allocation-control .allocation-range::-webkit-slider-thumb {
  appearance: none;
  -webkit-appearance: none;
  width: 13px;
  height: 13px;
  margin-top: -5px;
  border: 2px solid var(--yellow);
  border-radius: 2px;
  background: #1d232c;
  transform: rotate(45deg);
}
.terminal-page .allocation-control .allocation-range::-moz-range-thumb { width: 11px; height: 11px; border: 2px solid var(--yellow); border-radius: 2px; background: #1d232c; transform: rotate(45deg); }
.terminal-page .allocation-nodes { position: absolute; z-index: 3; inset: 0; display: flex; justify-content: space-between; align-items: center; pointer-events: none; }
.terminal-page .allocation-nodes i { width: 7px; height: 7px; border: 1px solid #515d6b; border-radius: 1px; background: #1d232c; transform: rotate(45deg); }
.terminal-page .allocation-nodes i.filled { border-color: var(--yellow); background: var(--yellow); }
.terminal-page .allocation-control .allocation-labels {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  width: 100%;
  gap: 0;
  margin: -6px 0 0;
  padding: 0;
}
.terminal-page .allocation-control .allocation-labels > button {
  width: 100%;
  min-width: 0;
  min-height: 36px;
  padding: 3px 0;
  border: 0;
  background: transparent;
  color: #929ba8;
  font-size: 12px;
  line-height: 1.3;
  text-align: center;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.terminal-page .allocation-control .allocation-labels > button:first-child { text-align: left; }
.terminal-page .allocation-control .allocation-labels > button:last-child { text-align: right; }
.terminal-page .allocation-control .allocation-labels > button.active { color: var(--yellow); font-weight: 600; }

@media (max-width: 760px), (orientation: landscape) and (max-height: 540px) and (max-width: 1024px) {
  .terminal-page {
    --futures-gutter: 12px;
    min-width: 0;
    padding: 0 max(0px, env(safe-area-inset-right, 0px)) 18px max(0px, env(safe-area-inset-left, 0px));
    background: #101419;
  }
  .terminal-page .market-source {
    min-height: 28px;
    gap: 6px;
    padding: 0 var(--futures-gutter);
    border: 0;
    font-size: 10px;
    line-height: 1.3;
  }
  .terminal-page .market-source :is(strong, span, time, .text-btn) {
    font-size: 10px;
  }
  .terminal-page .market-source .text-btn {
    position: relative;
    min-height: 28px;
    padding: 0 3px;
  }
  .terminal-page .market-source .text-btn::after {
    position: absolute;
    inset: -6px 0;
    content: "";
  }

  /* Reward progress precedes the contract quote, without a second explanatory paragraph. */
  .terminal-page #rewardTracker {
    margin: 8px var(--futures-gutter) 0;
  }
  .terminal-page #rewardTracker .contest-progress-card {
    margin: 0;
    padding: 6px 10px;
    border: 1px solid #514728;
    border-radius: 8px;
    background: linear-gradient(110deg, #242319, #191e24 62%);
  }
  .terminal-page .contest-progress-summary {
    flex-wrap: nowrap;
    align-items: center;
    gap: 8px;
    min-height: 40px;
  }
  .terminal-page .contest-progress-summary > div {
    flex: 1 1 0;
    min-width: 0;
    gap: 6px;
  }
  .terminal-page .contest-progress-summary > div > .icon {
    width: 17px;
    height: 17px;
  }
  .terminal-page .contest-progress-summary > div > div > strong {
    font-size: 13px;
    line-height: 1.3;
    overflow-wrap: anywhere;
  }
  .terminal-page .contest-progress-summary > div > div > span {
    display: none;
  }
  .terminal-page .contest-progress-summary > .text-btn {
    flex: 0 1 auto;
    max-width: 38%;
    min-height: 40px;
    padding: 4px 0 4px 5px;
    font-size: 10.5px;
    line-height: 1.3;
    text-align: right;
    white-space: normal;
    overflow-wrap: anywhere;
  }
  .terminal-page .contest-progress-numbers {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    margin: 0 0 4px;
  }
  .terminal-page .contest-progress-numbers > * {
    min-width: 0;
    padding-right: 6px;
  }
  .terminal-page .contest-progress-numbers > * + * {
    padding-left: 7px;
  }
  .terminal-page .contest-progress-numbers > :last-child {
    padding-right: 0;
  }
  .terminal-page .contest-progress-numbers span,
  .terminal-page .contest-progress-numbers dt {
    min-height: 0;
    margin-bottom: 4px;
    font-size: 10px;
    line-height: 1.3;
    overflow-wrap: anywhere;
    hyphens: auto;
  }
  .terminal-page .contest-progress-numbers strong,
  .terminal-page .contest-progress-numbers dd {
    font-size: 15px;
    line-height: 1.2;
    letter-spacing: -.35px;
    overflow-wrap: anywhere;
  }
  .terminal-page .contest-progress-numbers small {
    display: inline;
    margin: 0 0 0 3px;
    font-size: 9px;
    line-height: 1.2;
    letter-spacing: 0;
    white-space: nowrap;
  }
  .terminal-page .contest-progress-bar {
    height: 3px;
    min-height: 3px;
    border-radius: 3px;
  }
  .terminal-page .contest-progress-foot {
    align-items: center;
    gap: 5px 10px;
    margin-top: 3px;
    font-size: 11px;
    line-height: 1.35;
  }
  .terminal-page .contest-progress-foot > .contest-mini-status {
    display: none;
  }
  .terminal-page .contest-progress-foot > .contest-mini-status[data-attention="true"] {
    display: block;
    flex-basis: 100%;
    font-size: 11px;
    line-height: 1.4;
    overflow-wrap: anywhere;
  }
  .terminal-page .contest-progress-foot > strong {
    flex: 1 1 auto;
    min-width: 0;
    font-size: 11px;
    line-height: 1.35;
    overflow-wrap: anywhere;
  }
  .terminal-page .contest-progress-foot > .btn {
    display: inline-flex;
    justify-content: center;
    align-items: center;
    min-height: 40px;
    max-width: 100%;
    margin-left: auto;
    padding: 8px 12px;
    font-size: 12px;
    line-height: 1.3;
    white-space: normal;
  }

  /* A compact quote row keeps the contract picker and current price visible. */
  .terminal-page .market-ticker {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, auto);
    align-items: center;
    gap: 2px 8px;
    min-height: 0;
    padding: 5px var(--futures-gutter) 2px;
    border: 0;
    border-radius: 0;
    background: transparent;
  }
  .terminal-page .pair-picker {
    grid-column: 1;
    grid-row: 1;
    min-width: 0;
    min-height: 44px;
    gap: 5px;
  }
  .terminal-page .pair-picker .token-icon {
    flex: 0 0 24px;
    width: 24px;
    height: 24px;
  }
  .terminal-page .pair-picker > div {
    min-width: 0;
  }
  .terminal-page .pair-picker strong {
    max-width: 100%;
    overflow: hidden;
    font-size: 15px;
    line-height: 1.3;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
  .terminal-page .pair-picker .token-sub {
    display: block;
    max-width: 100%;
    overflow: hidden;
    font-size: 10px;
    line-height: 1.4;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
  .terminal-page .pair-picker > .icon {
    flex: 0 0 11px;
    width: 11px;
    height: 11px;
    margin-left: 0;
  }
  .terminal-page .ticker-price {
    grid-column: 2;
    grid-row: 1;
    min-width: 0;
    padding: 0;
    border: 0;
    font-size: 18px;
    line-height: 1.3;
    text-align: right;
    overflow-wrap: anywhere;
  }
  .terminal-page .ticker-price small {
    font-size: 9px;
    line-height: 1.5;
    white-space: nowrap;
  }
  .terminal-page .ticker-stat {
    grid-column: 1 / -1;
    grid-row: 2;
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-start;
    gap: 4px;
    min-width: 0;
    font-size: 11px;
    line-height: 1.4;
  }
  .terminal-page .ticker-stat > span {
    margin: 0;
    font-size: 10px;
    white-space: normal;
  }
  .terminal-page .ticker-stat.high-stat,
  .terminal-page .ticker-stat.low-stat,
  .terminal-page .ticker-stat.volume-stat,
  .terminal-page .ticker-star {
    display: none;
  }
  .terminal-page .mobile-contract-bar {
    display: flex;
    align-items: stretch;
    gap: 7px;
    padding: 3px var(--futures-gutter) 5px;
  }
  .terminal-page .mobile-contract-bar > button {
    display: inline-flex;
    flex: 1 1 0;
    align-items: center;
    justify-content: center;
    gap: 5px;
    min-width: 0;
    min-height: 40px;
    padding: 5px 7px;
    border: 1px solid #39414c;
    border-radius: 5px;
    background: #1c222b;
    color: #d7dde6;
    font-size: 12px;
    line-height: 1.3;
    text-align: center;
    white-space: normal;
    overflow-wrap: anywhere;
  }
  .terminal-page .mobile-contract-bar > .leverage-btn {
    flex: 0 0 64px;
    color: var(--yellow);
  }
  .terminal-page .mobile-contract-bar > .position-mode-btn {
    flex-grow: 1.4;
  }
  .terminal-page .mobile-contract-bar .icon {
    flex: 0 0 11px;
    width: 11px;
    height: 11px;
  }

  /* Classic mobile futures: order book on the left, order entry on the right. */
  .terminal-page .trade-grid {
    display: grid;
    grid-template-columns: minmax(0, 1.9fr) minmax(0, 3.1fr);
    align-items: start;
    gap: 12px;
    min-width: 0;
    padding: 0 var(--futures-gutter) 14px;
    border: 0;
    background: transparent;
  }
  .terminal-page .trade-grid > .terminal-account,
  .terminal-page .trade-grid > .mobile-trade-tabs {
    display: none;
  }
  .terminal-page .trade-grid > .orderbook-panel,
  .terminal-page .trade-grid.mobile-book > .orderbook-panel {
    display: block;
    grid-column: 1;
    grid-row: 3;
    order: 0;
    min-width: 0;
    border: 0;
    background: transparent;
  }
  .terminal-page .trade-grid > .trade-form-panel,
  .terminal-page .trade-grid.mobile-book > .trade-form-panel,
  .terminal-page .trade-grid:not(.mobile-book) > .trade-form-panel {
    display: block;
    grid-column: 2;
    grid-row: 3;
    order: 0;
    min-width: 0;
    border: 0;
    background: transparent;
  }
  .terminal-page .orderbook-panel > .panel-title {
    display: flex;
    min-height: 40px;
    padding: 0;
    border: 0;
  }
  .terminal-page .book-tabs {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    align-items: stretch;
    width: 100%;
    gap: 5px;
  }
  .terminal-page .book-tabs > button {
    min-width: 0;
    min-height: 40px;
    padding: 4px 0;
    border-bottom: 2px solid transparent;
    font-size: 10.5px;
    line-height: 1.3;
    white-space: normal;
    overflow-wrap: anywhere;
  }
  .terminal-page .book-tabs > button.active {
    border-bottom-color: var(--yellow);
  }
  .terminal-page .orderbook-panel #bookContent {
    max-height: none;
    overflow: visible;
  }
  .terminal-page .orderbook-panel .book-subhead,
  .terminal-page .orderbook-panel .book-row {
    display: grid;
    grid-template-columns: minmax(0, 1.15fr) minmax(0, .85fr);
    gap: 4px;
    min-width: 0;
    width: 100%;
    padding-inline: 0;
    text-align: right;
  }
  .terminal-page .orderbook-panel .book-subhead {
    align-items: start;
    min-height: 26px;
    padding-block: 5px 4px;
    font-size: 9px;
    line-height: 1.3;
    overflow-wrap: anywhere;
  }
  .terminal-page .orderbook-panel .book-row {
    align-items: center;
    min-height: 22px;
    padding-block: 2px;
    border: 0;
    font-size: 11.5px;
    line-height: 1.4;
    font-variant-numeric: tabular-nums;
  }
  .terminal-page .orderbook-panel .book-row > span {
    min-width: 0;
    white-space: nowrap;
  }
  .terminal-page .orderbook-panel .book-row > span:first-child,
  .terminal-page .orderbook-panel .book-subhead > span:first-child {
    text-align: left;
  }
  .terminal-page .orderbook-panel .book-subhead > :nth-child(3),
  .terminal-page .orderbook-panel .book-row > :nth-child(3),
  .terminal-page .book-quantity-full {
    display: none;
  }
  .terminal-page .book-quantity-short {
    display: inline;
  }
  .terminal-page .orderbook-panel .book-mid {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-start;
    gap: 3px;
    min-width: 0;
    margin: 4px 0;
    padding: 6px 0;
    border: 0;
    font-size: clamp(16px, 4.4vw, 20px);
    line-height: 1.2;
    overflow-wrap: anywhere;
  }
  .terminal-page .book-mid > span:not(.book-mark) {
    display: none;
  }
  .terminal-page .book-mid .book-mark {
    display: block;
    width: 100%;
    font-size: 10px;
    line-height: 1.35;
    font-weight: 400;
    color: var(--muted);
    overflow-wrap: anywhere;
  }
  .terminal-page .book-ratio {
    flex-wrap: wrap;
    justify-content: space-between;
    gap: 5px;
    padding: 6px 0;
    font-size: 10px;
  }
  .terminal-page .book-ratio .ratio-line {
    flex-basis: 100%;
    order: 3;
  }

  /* Native order type, readable numeric fields and two real submit actions. */
  .terminal-page .trade-form-panel > .panel-title,
  .terminal-page .trade-form-panel .contract-controls,
  .terminal-page .trade-form-panel .side-switch,
  .terminal-page .trade-form-panel .futures-order-tabs,
  .terminal-page .trade-form-panel .order-notional,
  .terminal-page .trade-form-panel #submitOrder,
  .terminal-page .trade-form-panel .form-footnote {
    display: none;
  }
  .terminal-page .trade-form-panel .form-content {
    min-width: 0;
    padding: 0;
  }
  .terminal-page #orderForm {
    display: flex;
    flex-direction: column;
    min-width: 0;
  }
  .terminal-page .trade-form-panel .available-line {
    order: -2;
    align-items: baseline;
    flex-wrap: wrap;
    gap: 2px 4px;
    min-height: 20px;
    margin: 0 0 4px;
    font-size: 10.5px;
    line-height: 1.4;
  }
  .terminal-page .available-line > span,
  .terminal-page .available-line > b {
    min-width: 0;
    overflow-wrap: anywhere;
  }
  .terminal-page .available-line > b {
    margin-left: auto;
    font-size: 11px;
    font-weight: 500;
    text-align: right;
    font-variant-numeric: tabular-nums;
  }
  .terminal-page .mobile-order-type {
    position: relative;
    display: block;
    order: -1;
    min-width: 0;
    margin-bottom: 6px;
  }
  .terminal-page .mobile-order-type > .icon {
    position: absolute;
    top: 50%;
    right: 10px;
    width: 13px;
    height: 13px;
    margin-top: -6px;
    color: #a3acb8;
    pointer-events: none;
  }
  .terminal-page #mobileOrderType {
    appearance: none;
    -webkit-appearance: none;
    width: 100%;
    min-width: 0;
    min-height: 40px;
    padding: 8px 27px 8px 10px;
    border: 1px solid transparent;
    border-radius: 5px;
    background: #242b35;
    color: #eaecef;
    font-size: 16px;
    line-height: 1.3;
    text-align: center;
  }
  .terminal-page #mobileOrderType:focus-visible {
    border-color: var(--yellow);
    outline: 1px solid var(--yellow);
  }
  .terminal-page .trade-form-panel .input-box {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    grid-template-areas: "label unit" "input input";
    align-items: center;
    gap: 1px 5px;
    min-width: 0;
    min-height: 48px;
    margin: 0 0 6px;
    padding: 4px 9px;
    border: 1px solid #303844;
    border-radius: 6px;
    background: #1e252e;
  }
  .terminal-page .trade-form-panel .input-box > span:first-child {
    grid-area: label;
    max-width: none;
    min-width: 0;
    font-size: 10px;
    line-height: 1.3;
    white-space: normal;
    overflow-wrap: anywhere;
  }
  .terminal-page .trade-form-panel .input-box > small {
    grid-area: unit;
    min-width: 0;
    font-size: 10px;
    line-height: 1.3;
    text-align: right;
  }
  .terminal-page .trade-form-panel .input-box > input {
    grid-area: input;
    min-width: 0;
    min-height: 23px;
    width: 100%;
    margin: 0;
    padding: 0;
    border: 0;
    background: transparent;
    font-size: 16px;
    line-height: 1.3;
    font-weight: 500;
    text-align: center;
  }
  .terminal-page .trade-form-panel .input-box > .market-price-note {
    grid-area: input;
    font-size: 14px;
    line-height: 1.4;
    text-align: center;
    white-space: normal;
    overflow-wrap: anywhere;
  }
  .terminal-page .trade-form-panel .input-box:focus-within {
    border-color: var(--yellow);
  }
  .terminal-page .trade-form-panel .order-notional {
    display: none;
  }
  .terminal-page .allocation-range {
    width: 100%;
    min-width: 0;
    min-height: 40px;
    height: 40px;
    margin: 0;
    padding: 0;
    accent-color: var(--yellow);
  }
  .terminal-page .allocation-control .allocation-labels {
    display: grid;
  }
  .terminal-page .protection-toggle {
    flex-wrap: nowrap;
    gap: 6px;
    min-height: 40px;
    margin: 0;
    font-size: 11px;
    line-height: 1.35;
  }
  .terminal-page .protection-toggle > span {
    min-width: 0;
    overflow-wrap: anywhere;
  }
  .terminal-page .protection-toggle input[type="checkbox"] {
    flex: 0 0 16px;
    width: 16px;
    height: 16px;
    min-height: 16px;
    margin: 0;
  }
  .terminal-page .protection-fields {
    grid-template-columns: minmax(0, 1fr);
    gap: 6px;
    margin-bottom: 6px;
  }
  .terminal-page .protection-fields .input-box {
    margin: 0;
  }
  .terminal-page .order-estimate {
    display: none;
    margin: 3px 0 5px;
    padding: 0;
    border: 0;
  }
  .terminal-page .trade-form-panel .estimate-line {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: start;
    gap: 5px;
    min-width: 0;
    margin-bottom: 5px;
    font-size: 10.5px;
    line-height: 1.4;
  }
  .terminal-page .estimate-line > span {
    min-width: 0;
    overflow-wrap: anywhere;
  }
  .terminal-page .estimate-line > strong {
    font-size: 10.5px;
    line-height: 1.4;
    text-align: right;
    white-space: nowrap;
  }
  .terminal-page .order-risk-note {
    min-height: 0;
    margin: 3px 0 8px;
    font-size: 10.5px;
    line-height: 1.4;
  }
  .terminal-page .order-risk-note:empty,
  .terminal-page .order-risk-note[data-state="ready"],
  .terminal-page .order-risk-note[data-state="error"],
  .terminal-page .form-message:empty {
    display: none;
  }
  .terminal-page .mobile-order-actions {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 6px;
  }
  .terminal-page .mobile-order-actions button {
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 0;
    width: 100%;
    min-height: 44px;
    padding: 9px 6px;
    border: 0;
    border-radius: 6px;
    color: #fff;
    font-size: 13px;
    font-weight: 600;
    line-height: 1.3;
    white-space: normal;
    overflow-wrap: anywhere;
  }
  .terminal-page .mobile-long-order {
    background: #0caa7d;
  }
  .terminal-page .mobile-short-order {
    background: #e63b60;
  }
  .terminal-page .mobile-order-actions button:disabled {
    opacity: .5;
    cursor: not-allowed;
  }
  .terminal-page .mobile-direction-order { display: grid; grid-template-columns: minmax(0, 1fr); gap: 4px; min-width: 0; }
  .terminal-page .mobile-order-actions { gap: 12px; }
  .terminal-page .mobile-order-max,
  .terminal-page .mobile-order-cost {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    flex-wrap: wrap;
    gap: 1px 5px;
    min-width: 0;
    color: #929ba8;
    font-size: 12px;
    line-height: 1.35;
  }
  .terminal-page :is(.mobile-order-max, .mobile-order-cost) > span {
    min-width: 0;
    overflow-wrap: anywhere;
  }
  .terminal-page :is(.mobile-order-max, .mobile-order-cost) > strong {
    min-width: 0;
    max-width: 100%;
    margin-left: auto;
    color: var(--text);
    font-size: 12px;
    font-weight: 400;
    font-variant-numeric: tabular-nums;
    text-align: right;
    white-space: normal;
    overflow-wrap: anywhere;
  }
  .terminal-page .mobile-order-actions button { margin-top: 2px; font-size: 14px; }
  .terminal-page .available-full,
  .terminal-page .protection-full { display: none; }
  .terminal-page .available-short,
  .terminal-page .protection-short { display: inline; }
  .terminal-page .trade-form-panel .available-line,
  .terminal-page .available-line > b { font-size: 12px; }
  .terminal-page .protection-toggle { min-height: 34px; margin: 0 0 5px; font-size: 13px; }
  .terminal-page .trade-form-panel .input-box.stepper-input {
    grid-template-columns: 30px minmax(0, 1fr) 30px;
    grid-template-rows: auto 40px;
    grid-template-areas: none;
    gap: 0 3px;
    padding: 4px 5px 2px;
  }
  .terminal-page .trade-form-panel .input-box.stepper-input > .field-heading:first-child {
    grid-area: auto;
    grid-column: 1 / -1;
    grid-row: 1;
    font-size: 11.5px;
    line-height: 1.35;
  }
  .terminal-page .trade-form-panel .input-box.stepper-input > input {
    grid-area: auto;
    grid-column: 2;
    grid-row: 2;
    min-height: 38px;
  }
  .terminal-page .trade-form-panel .input-box.stepper-input > .market-price-note {
    grid-area: auto;
    grid-column: 1 / -1;
    grid-row: 2;
    font-size: 16px;
  }
  .terminal-page .mobile-order-error {
    color: #ff7f8e;
    font-size: 10.5px;
    line-height: 1.4;
    overflow-wrap: anywhere;
  }
  .terminal-page .mobile-order-error[hidden] {
    display: none;
  }
  .terminal-page .form-message {
    min-height: 0;
    margin-top: 8px;
    font-size: 11px;
    line-height: 1.45;
    overflow-wrap: anywhere;
  }
  .terminal-page .contract-size-note {
    margin: 6px 0 0;
    font-size: 10px;
    line-height: 1.4;
    overflow-wrap: anywhere;
  }

  /* Records remain below both terminal views, with their existing horizontal tabs. */
  .terminal-page .orders-panel {
    min-width: 0;
    margin: 0;
    border-top: 5px solid #0b0e11;
    border-inline: 0;
  }
  .terminal-page .orders-tabs {
    min-width: 0;
    gap: 16px;
    padding-inline: var(--futures-gutter);
    overflow-x: auto;
    overscroll-behavior-x: contain;
    -webkit-overflow-scrolling: touch;
  }
  .terminal-page .orders-tabs > button {
    flex: 0 0 auto;
    min-height: 44px;
    font-size: 12px;
  }
  .terminal-page .trade-bottom-note {
    padding-inline: var(--futures-gutter);
    font-size: 11px;
    line-height: 1.5;
  }

  /* Candles stay visible in the trading page, above the order controls. */
  .terminal-page .trade-grid > .chart-panel {
    display: block;
    grid-column: 1 / -1;
    grid-row: 1;
    order: 0;
    min-width: 0;
    width: calc(100% + 2 * var(--futures-gutter));
    margin-inline: calc(-1 * var(--futures-gutter));
    border-inline: 0;
    border-top: 1px solid var(--line);
    border-bottom: 1px solid var(--line);
    background: #101419;
  }
  .terminal-page .trade-grid > .mobile-contract-bar {
    grid-column: 1 / -1;
    grid-row: 2;
    padding: 0;
    margin: 0;
    min-width: 0;
  }
  .terminal-page .chart-toolbar {
    flex-wrap: wrap;
    gap: 0 8px;
    padding: 0 var(--futures-gutter);
  }
  .terminal-page .chart-toolbar .timeframes {
    flex: 0 0 auto;
    gap: 2px;
  }
  .terminal-page .chart-toolbar .chart-options {
    flex-wrap: wrap;
    margin-left: auto;
    gap: 2px;
  }
  .terminal-page .chart-toolbar button {
    min-height: 44px;
    font-size: 11px;
    padding: 4px 7px;
  }
  .terminal-page .chart-ohlc {
    flex-wrap: wrap;
    gap: 3px 10px;
    padding-inline: var(--futures-gutter);
    font-size: 10px;
    min-height: 16px;
  }
  .terminal-page .indicator-legend {
    flex-wrap: wrap;
    padding: 3px var(--futures-gutter) 0;
    gap: 8px 16px;
    font-size: 10px;
  }
  .terminal-page .chart-wrap {
    height: clamp(210px, 27vh, 250px);
  }
  .terminal-page .chart-caption {
    display: none;
  }

}

@media (max-width: 359px) {
  .terminal-page { --futures-gutter: 10px; }
  .terminal-page .trade-grid { gap: 9px; }
  .terminal-page .contest-progress-numbers strong { font-size: 14px; }
  .terminal-page .contest-progress-summary > div > div > strong { font-size: 12px; }
  .terminal-page .pair-picker strong { font-size: 13px; }
  .terminal-page .pair-picker .token-icon { width: 21px; height: 21px; flex-basis: 21px; }
  .terminal-page .ticker-price { font-size: 16px; }
  .terminal-page .ticker-price small { font-size: 8.5px; }
  .terminal-page .mobile-contract-bar > button { font-size: 11px; padding-inline: 5px; }
  .terminal-page .mobile-contract-bar > .leverage-btn { flex-basis: 56px; }
  .terminal-page .orderbook-panel .book-row { font-size: 10.5px; }
  .terminal-page .book-tabs > button { font-size: 10px; }
  .terminal-page .trade-form-panel .input-box { padding-inline: 7px; }
  .terminal-page .estimate-line > strong { font-size: 10px; }
  .terminal-page .mobile-order-actions button { font-size: 12px; }
}
