.trading-page {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  box-sizing: border-box;
  background: #020617;
  z-index: 800;
}

/* Button-styled mode toggles and inputs (Manual Trading) */
.trading-mode-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 8px 14px;
  border-radius: 5px;
  border: 1px solid rgba(59, 130, 246, 0.75);
  background: rgba(37, 99, 235, 0.18);
  color: #ffffff;
  font-weight: 700;
  font-size: 14px;
  cursor: pointer;
  transition: background 0.2s ease, border-color 0.2s ease, color 0.2s ease;
}

.trading-mode-btn:hover {
  background: rgba(37, 99, 235, 0.28);
  border-color: rgba(96, 165, 250, 0.95);
}

.trading-mode-btn.active {
  background: #2563eb;
  border-color: #3b82f6;
  color: #ffffff;
}

.trading-inline-input {
  width: 86px;
  max-width: 110px;
  padding: 8px 10px;
  text-align: center;
  font-weight: 700;
  font-size: 14px;
  color: #ffffff;
  background: rgba(37, 99, 235, 0.18);
  border: 1px solid rgba(59, 130, 246, 0.75);
  border-radius: 5px;
  outline: none;
  transition: background 0.2s ease, border-color 0.2s ease;
}

.trading-inline-input:hover,
.trading-inline-input:focus {
  background: rgba(37, 99, 235, 0.28);
  border-color: rgba(96, 165, 250, 0.95);
}

.trading-header-bar {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 100px;
  background: linear-gradient(90deg, #020617, #111827, #020617);
  pointer-events: none;
}

.trading-content {
  width: 100%;
  height: 100%;
  display: grid;
  grid-template-columns: minmax(230px, 0.85fr) minmax(0, 2.2fr) minmax(260px, 1.15fr);
  gap: 0;
  align-items: stretch;
  justify-content: stretch;
  padding-top: 100px;
  padding-left: 0;
  padding-right: 0;
}

.trading-left-rail {
  border-right: 1px solid rgba(30, 41, 59, 0.8);
  background: linear-gradient(180deg, #0b1120 0%, #0f172a 100%);
  padding: 8px 10px;
  overflow: hidden;
}

.trading-left-rail-card {
  height: 100%;
  border-radius: 12px;
  border: 1px solid rgba(148, 163, 184, 0.14);
  background: linear-gradient(180deg, rgba(17, 24, 39, 0.95) 0%, rgba(15, 23, 42, 0.98) 100%);
  display: flex;
  flex-direction: column;
}

.trading-left-rail-head {
  display: flex;
  gap: 6px;
  padding: 10px;
  border-bottom: 1px solid rgba(148, 163, 184, 0.12);
}

.trading-left-rail-tab {
  border: 1px solid rgba(71, 85, 105, 0.6);
  background: rgba(30, 41, 59, 0.55);
  color: #94a3b8;
  border-radius: 8px;
  font-size: 11px;
  font-weight: 700;
  padding: 6px 8px;
}

.trading-left-rail-tab.active {
  color: #38bdf8;
  border-color: rgba(56, 189, 248, 0.75);
  background: rgba(2, 132, 199, 0.2);
}

.trading-left-rail-list {
  padding: 8px 8px 12px;
  overflow-y: auto;
  display: grid;
  gap: 8px;
}

.trading-left-rail-item {
  display: grid;
  grid-template-columns: 30px 1fr auto;
  gap: 8px;
  align-items: center;
  padding: 8px;
  border-radius: 10px;
  border: 1px solid rgba(51, 65, 85, 0.65);
  background: rgba(15, 23, 42, 0.7);
}

.trading-left-rail-icon {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-weight: 800;
  font-size: 13px;
}

.trading-left-rail-item.is-win .trading-left-rail-icon {
  color: #22c55e;
  background: rgba(34, 197, 94, 0.15);
}

.trading-left-rail-item.is-loss .trading-left-rail-icon {
  color: #f59e0b;
  background: rgba(245, 158, 11, 0.15);
}

.trading-left-rail-title {
  color: #e2e8f0;
  font-size: 12px;
  font-weight: 700;
}

.trading-left-rail-title span {
  font-size: 10px;
  color: #94a3b8;
  margin-left: 4px;
}

.trading-left-rail-type {
  color: #64748b;
  font-size: 10px;
  letter-spacing: 0.06em;
}

.trading-left-rail-amount {
  font-size: 14px;
  font-weight: 800;
}

.trading-left-rail-item.is-win .trading-left-rail-amount {
  color: #22c55e;
}

.trading-left-rail-item.is-loss .trading-left-rail-amount {
  color: #f59e0b;
}

.trading-left-rail-item--tx {
  grid-template-columns: 1fr auto;
}

.trading-left-rail-item--tx .trading-left-rail-amount {
  font-size: 13px;
}

.trading-left-rail-item--tx-win {
  border-color: rgba(16, 185, 129, 0.42);
  background: linear-gradient(180deg, rgba(6, 95, 70, 0.22) 0%, rgba(15, 23, 42, 0.78) 100%);
}

.trading-left-rail-item--tx-loss {
  border-color: rgba(168, 85, 247, 0.45);
  background: linear-gradient(180deg, rgba(88, 28, 135, 0.22) 0%, rgba(15, 23, 42, 0.78) 100%);
}

/* Push trading page 10px up on desktop (reduce top padding) */
@media (min-width: 901px) {
  .trading-content {
    padding-top: 80px;
  }
}

.trading-left,
.trading-right {
  display: flex;
  flex-direction: column;
  min-height: 0;
  }
  
  .trading-left {
    flex: 1;
  min-height: 0;
}

.trading-title {
  font-size: 20px;
  font-weight: 600;
  text-align: center;
  padding: 8px 12px;
  color: #e5e7eb;
}

.trading-subtitle {
  font-size: 12px;
  color: #94a3b8;
  text-align: center;
  padding: 4px 12px 8px;
}

.trading-chart-card {
  background: #0a0e1a;
  border-radius: 0;
  border: none;
  padding: 0;
  padding-bottom: 40px;
  box-shadow: 0 12px 30px rgba(15, 23, 42, 0.8);
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
  margin-top: -100px;
  padding-top: 80px;
  margin-left: 0;
  margin-right: 0;
  width: 100%;
}

/* Add extra bottom space under the graph on desktop so bottom time is visible */
@media (min-width: 901px) {
  .trading-chart-card {
    padding-bottom: 90px; /* +50px extra space */
  }
}
.trading-round-info {
  font-size: 12px;
  padding: 8px 12px;
  color: #94a3b8;
  flex-shrink: 0;
}

/* Trade types: chart row (mobile) vs sidebar 2×2 (desktop) */
.trading-trade-types-desktop {
  display: none;
}

.trading-trade-types-heading {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #94a3b8;
  margin: 0 0 12px;
  padding: 0;
}

/* Pill tabs — shared shell */
.trading-market-type-tabs {
  position: relative;
  z-index: 2;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 10px 12px;
  flex-shrink: 0;
  background: transparent;
}

.trading-market-type-tabs--chart {
  padding: 10px 14px 14px;
  margin: 0 8px;
  border-top: 1px solid rgba(30, 41, 59, 0.85);
}

.trading-market-type-tab {
  appearance: none;
  -webkit-appearance: none;
  margin: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 34px;
  padding: 10px 22px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 600;
  font-family: inherit;
  letter-spacing: 0.01em;
  line-height: 1.2;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
  user-select: none;
  color: #93c5fd;
  background: rgba(37, 99, 235, 0.16);
  border: 1px solid rgba(59, 130, 246, 0.55);
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.5);
  transition:
    color 0.15s ease,
    border-color 0.15s ease,
    box-shadow 0.15s ease,
    background 0.15s ease,
    transform 0.1s ease;
}

.trading-market-type-tab:hover {
  color: #dbeafe;
  background: rgba(37, 99, 235, 0.28);
  border-color: rgba(96, 165, 250, 0.85);
}

.trading-market-type-tab:focus {
  outline: none;
}

.trading-market-type-tab:focus-visible {
  outline: 2px solid rgba(96, 165, 250, 0.95);
  outline-offset: 2px;
}

.trading-market-type-tab:active {
  transform: scale(0.97);
}

.trading-market-type-tab.active {
  color: #ffffff;
  font-weight: 700;
  background: rgba(37, 99, 235, 0.45);
  border-color: #60a5fa;
  box-shadow:
    0 0 0 1px rgba(96, 165, 250, 0.55),
    0 0 16px rgba(59, 130, 246, 0.45),
    0 2px 6px rgba(15, 23, 42, 0.45);
}

/* Mobile / tablet chart row: scrollable pills, nudged left + trailing padding so Over/Under stays readable */
@media (max-width: 900px) {
  .trading-market-type-tabs--chart {
    justify-content: flex-start;
    overflow-x: auto;
    flex-wrap: nowrap;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    margin-left: -6px;
    margin-right: 2px;
    padding-left: 6px;
    padding-right: 28px;
  }

  .trading-market-type-tabs--chart::-webkit-scrollbar {
    display: none;
  }

  .trading-market-type-tabs--chart .trading-market-type-tab {
    flex: 0 0 auto;
  }
}

@media (max-width: 480px) {
  .trading-market-type-tabs--chart .trading-market-type-tab {
    min-height: 32px;
    padding: 9px 18px;
    font-size: 12px;
  }
}

.trading-line-graph {
  width: 100%;
  flex: 1;
  min-height: 500px;
  background: #0a0e1a;
  position: relative;
  overflow: hidden;
  display: flex;
  align-items: stretch;
  justify-content: stretch;
  filter: none !important;
  backdrop-filter: none !important;
  -webkit-backdrop-filter: none !important;
}

.trading-volatility-control {
  position: absolute;
  top: 8px;
  left: 10px;
  z-index: 1004;
  width: min(188px, calc(100% - 20px));
}

.trading-volatility-toggle {
  width: 100%;
  height: 26px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  padding: 0 8px;
  border-radius: 8px;
  border: 1px solid rgba(56, 189, 248, 0.45);
  background: rgba(15, 23, 42, 0.86);
  color: #e2e8f0;
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
}

.trading-volatility-current {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.trading-volatility-caret {
  color: #67e8f9;
  font-size: 10px;
  line-height: 1;
}

.trading-volatility-menu {
  margin-top: 4px;
  border-radius: 10px;
  border: 1px solid rgba(51, 65, 85, 0.8);
  background: rgba(15, 23, 42, 0.98);
  box-shadow: 0 10px 24px rgba(2, 6, 23, 0.45);
  max-height: 210px;
  overflow-y: auto;
  display: none;
}

.trading-volatility-control.open .trading-volatility-menu {
  display: block;
}

.trading-volatility-item {
  width: 100%;
  text-align: left;
  border: none;
  border-bottom: 1px solid rgba(51, 65, 85, 0.45);
  background: transparent;
  color: #e2e8f0;
  font-size: 11px;
  font-weight: 600;
  padding: 9px 10px;
  cursor: pointer;
}

.trading-volatility-item:last-child {
  border-bottom: none;
}

.trading-volatility-item.is-active {
  background: rgba(37, 99, 235, 0.2);
  color: #67e8f9;
}

@media (max-width: 900px) {
  .trading-volatility-control {
    width: min(170px, calc(100% - 16px));
    left: 8px;
    top: 8px;
  }

  .trading-volatility-toggle {
    height: 24px;
    font-size: 10px;
    padding: 0 7px;
    border-radius: 7px;
  }

  .trading-volatility-menu {
    max-height: 190px;
  }

  .trading-volatility-item {
    font-size: 10px;
    padding: 8px 9px;
  }
}


.trading-line-graph canvas {
  width: 100%;
  height: 100%;
  display: block;
  filter: none !important;
  backdrop-filter: none !important;
  -webkit-backdrop-filter: none !important;
}

/* 0–9 probability strip inside graph, just above canvas realtime axis (40px band) */
.trading-line-graph .trading-digit-strip {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 40px;
  z-index: 5;
  pointer-events: auto;
  padding: 2px 6px 0;
  background: linear-gradient(
    to top,
    rgba(10, 14, 26, 0.94) 0%,
    rgba(10, 14, 26, 0.45) 65%,
    transparent 100%
  );
  border: none;
}

.trading-digit-strip--hidden {
  display: none !important;
}

#tradingPage.trading-digit-strip-active .trading-graph-forward-btn {
  bottom: 124px;
}

@media (max-width: 900px) {
  #tradingPage.trading-digit-strip-active .trading-graph-forward-btn {
    bottom: 108px !important;
  }
}

.trading-digit-strip-inner {
  position: relative;
  padding-bottom: 10px;
  --cursor-index: 0;
}

/* Track: row-wrap stacks digits-row (rings + cursor) then realtime under the cursor */
.trading-digit-strip-track {
  position: relative;
}

.trading-digit-strip-row-wrap {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: stretch;
}

/* Buy/Sell: show only moving time row; hide digit circles/cursor/prediction */
.trading-digit-strip--time-only .trading-digit-strip-row-wrap,
.trading-digit-strip--time-only .trading-digit-prediction {
  display: none !important;
}

/* Cursor % positions match grid width; height is rings only so top:100% hugs circle bottoms */
.trading-digit-strip-digits-row {
  position: relative;
  width: 100%;
}

.trading-digit-strip-row {
  display: grid;
  grid-template-columns: repeat(10, minmax(0, 1fr));
  gap: 4px;
  align-items: start;
  pointer-events: none;
}

.trading-digit-cell {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  min-width: 0;
}

.trading-digit-ring-wrap {
  position: relative;
  width: 100%;
  max-width: 48px;
  margin: 0 auto;
  aspect-ratio: 1;
}

.trading-digit-ring-wrap::before {
  content: '';
  position: absolute;
  inset: -2px;
  border-radius: 50%;
  opacity: 0;
  pointer-events: none;
  z-index: 0;
}

.trading-digit-ring-wrap--max::before {
  opacity: 1;
  background: conic-gradient(
    from 200deg,
    transparent 0deg 228deg,
    rgba(45, 212, 191, 0.95) 228deg 312deg,
    transparent 312deg 360deg
  );
  -webkit-mask: radial-gradient(farthest-side, transparent calc(100% - 3px), #000 calc(100% - 3px));
  mask: radial-gradient(farthest-side, transparent calc(100% - 3px), #000 calc(100% - 3px));
}

.trading-digit-ring-wrap--min::before {
  opacity: 1;
  background: conic-gradient(
    from 200deg,
    transparent 0deg 228deg,
    rgba(248, 113, 113, 0.95) 228deg 312deg,
    transparent 312deg 360deg
  );
  -webkit-mask: radial-gradient(farthest-side, transparent calc(100% - 3px), #000 calc(100% - 3px));
  mask: radial-gradient(farthest-side, transparent calc(100% - 3px), #000 calc(100% - 3px));
}

.trading-digit-ring {
  position: relative;
  z-index: 1;
  width: 100%;
  height: 100%;
  border-radius: 50%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1px;
  background: radial-gradient(circle at 30% 25%, #1e293b 0%, #0f172a 100%);
  border: 1px solid rgba(100, 116, 139, 0.45);
  box-sizing: border-box;
}

.trading-digit-num {
  font-size: 15px;
  font-weight: 800;
  color: #f8fafc;
  line-height: 1;
}

.trading-digit-pct {
  font-size: 9px;
  font-weight: 700;
  color: #e2e8f0;
  line-height: 1;
}

.trading-digit-ring-wrap--max .trading-digit-pct {
  color: #2dd4bf;
}

.trading-digit-ring-wrap--min .trading-digit-pct {
  color: #f87171;
}

/* Result flash on the digit circles (for digit markets) */
.trading-digit-ring-wrap--result-win .trading-digit-ring {
  background: radial-gradient(circle at 30% 25%, #22c55e 0%, #15803d 100%);
  border-color: rgba(22, 163, 74, 1);
  box-shadow:
    0 0 0 1px rgba(34, 197, 94, 0.7),
    0 0 18px rgba(34, 197, 94, 0.7);
  color: #f9fafb;
}

.trading-digit-ring-wrap--result-loss .trading-digit-ring {
  background: radial-gradient(circle at 30% 25%, #f97373 0%, #b91c1c 100%);
  border-color: rgba(185, 28, 28, 1);
  box-shadow:
    0 0 0 1px rgba(248, 113, 113, 0.7),
    0 0 18px rgba(248, 113, 113, 0.7);
  color: #f9fafb;
}

/* Moving time row between graph area and digit/percentage strip */
.trading-digit-strip-realtime {
  text-align: center;
  width: 100%;
  margin-top: 0;
  margin-bottom: 6px;
  padding-top: 0;
  pointer-events: none;
}

.trading-digit-strip-realtime__clock {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  column-gap: 8px;
  align-items: center;
  font-size: 11px;
  font-variant-numeric: tabular-nums;
  font-weight: 600;
  color: #94a3b8;
  letter-spacing: 0.02em;
}

.trading-digit-strip-realtime__tick {
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: clip;
}

.trading-digit-prediction {
  width: 100%;
  margin-top: 8px;
  pointer-events: auto;
}

.trading-digit-prediction--hidden {
  display: none !important;
}

.trading-digit-prediction__label {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: #7c8ca5;
  text-align: center;
  margin-bottom: 6px;
}

.trading-digit-prediction__row {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 3px;
  flex-wrap: nowrap;
}

.trading-digit-pred-btn {
  appearance: none;
  -webkit-appearance: none;
  width: 36px;
  min-width: 36px;
  height: 42px;
  border: 1px solid rgba(30, 41, 59, 0.92);
  border-radius: 6px;
  background: #111827;
  color: #94a3b8;
  font-size: 24px;
  font-weight: 800;
  line-height: 1;
  cursor: pointer;
}

.trading-digit-pred-btn.is-active {
  background: linear-gradient(180deg, #3b82f6 0%, #2563eb 100%);
  border-color: rgba(96, 165, 250, 0.95);
  color: #ffffff;
}

@media (min-width: 901px) {
  .trading-digit-prediction__row {
    width: 100%;
    justify-content: space-between;
    gap: 6px;
    padding: 0 10px;
  }

  .trading-digit-pred-btn {
    width: 46px;
    min-width: 46px;
    height: 52px;
    font-size: 28px;
    border-radius: 8px;
  }
}

/* Triangle points up; centered on each grid cell accounting for 4px column gaps (9 gaps) */
.trading-digit-cursor {
  --digit-strip-gap: 4px;
  --digit-strip-tracks: 10;
  --digit-strip-gaps: 9;
  position: absolute;
  top: 100%;
  left: calc(
    (100% - var(--digit-strip-gap) * var(--digit-strip-gaps)) / (2 * var(--digit-strip-tracks)) +
      var(--cursor-index, 0) *
        ((100% - var(--digit-strip-gap) * var(--digit-strip-gaps)) / var(--digit-strip-tracks) + var(--digit-strip-gap))
  );
  width: 0;
  height: 0;
  border-left: 5px solid transparent;
  border-right: 5px solid transparent;
  border-bottom: 7px solid #f97316;
  transform: translate(-50%, -3px);
  transition: left 0.12s ease-out;
  pointer-events: none;
}

@media (max-width: 480px) {
  .trading-digit-ring-wrap {
    max-width: 34px;
  }

  .trading-digit-num {
    font-size: 12px;
  }

  .trading-digit-pct {
    font-size: 7px;
  }

  .trading-digit-strip-realtime__clock {
    font-size: 10px;
  }

  .trading-digit-pred-btn {
    width: 30px;
    min-width: 30px;
    height: 34px;
    font-size: 19px;
  }
}

.trading-zoom-controls {
  --zoom-stack-h: 38px; /* two 18px buttons + 2px gap */
  position: absolute;
  left: max(4px, env(safe-area-inset-left, 0px));
  right: auto;
  top: auto;
  transform: none;
  /* Stay above 40px time axis + margin; never push stack past top of graph */
  bottom: min(
    calc(40px + 8px),
    calc(100% - var(--zoom-stack-h) - max(6px, env(safe-area-inset-top, 0px)))
  );
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  gap: 2px;
  z-index: 1002;
  pointer-events: auto;
}

/* Lift above digit probability strip when visible; still clamp inside graph height */
#tradingPage.trading-digit-strip-active .trading-zoom-controls {
  bottom: min(
    calc(40px + 78px + 8px),
    calc(100% - var(--zoom-stack-h) - max(6px, env(safe-area-inset-top, 0px)))
  );
}

@media (max-width: 900px) {
  #tradingPage.trading-digit-strip-active .trading-zoom-controls {
    bottom: min(
      calc(40px + 62px + 8px),
      calc(100% - var(--zoom-stack-h) - max(6px, env(safe-area-inset-top, 0px)))
    );
  }
}

/* Show zoom controls only in normal/manual graph view. */
#tradingPage:not(.manual-mode-active) .trading-zoom-controls,
#tradingPage.bot-config-open .trading-zoom-controls {
  display: none !important;
}

.trading-zoom-btn {
  box-sizing: border-box;
  width: 18px;
  height: 18px;
  min-width: 0;
  padding: 0;
  margin: 0;
  border-width: 1px;
  border-style: solid;
  border-color: rgba(148, 163, 184, 0.5);
  border-radius: 1px;
  background: rgba(15, 23, 42, 0.92);
  color: #e5e7eb;
  font-size: 11px;
  font-weight: 700;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

/* Phone-only: one split zoom control (top +, bottom -) with 2px divider gap */
@media (max-width: 900px) {
  .trading-zoom-controls {
    gap: 2px;
  }

  .trading-zoom-btn {
    width: 20px;
    min-width: 20px;
    height: 11px;
    font-size: 10px;
    border-radius: 0;
    line-height: 1;
  }

  .trading-zoom-controls .trading-zoom-btn:first-child {
    border-top-left-radius: 4px;
    border-top-right-radius: 4px;
  }

  .trading-zoom-controls .trading-zoom-btn:last-child {
    border-bottom-left-radius: 4px;
    border-bottom-right-radius: 4px;
  }
}

.trading-graph-forward-btn {
  position: absolute;
  right: 42px;
  bottom: 47px;
  width: 26px;
  height: 22px;
  border-radius: 5px;
  border: 1px solid rgba(59, 130, 246, 0.85);
  background: rgba(37, 99, 235, 0.22);
  color: #3b82f6;
  font-size: 14px;
  font-weight: 800;
  line-height: 1;
  cursor: pointer;
  z-index: 1003;
}

.trading-graph-forward-btn:hover {
  background: rgba(37, 99, 235, 0.34);
  color: #60a5fa;
}

@media (max-width: 900px) {
  .trading-graph-forward-btn {
    bottom: 22px !important;
    width: 22px !important;
    height: 18px !important;
    font-size: 12px !important;
    border-radius: 4px !important;
    line-height: 1 !important;
    padding: 0 !important;
  }
}

.trading-open-trades {
  flex: 0 0 auto;
  padding: 12px;
  background: #0a0e1a;
  max-height: 42vh;
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: thin;
}

.trading-trades-section-title {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #64748b;
  padding: 6px 4px 8px;
  margin-top: 4px;
}

.trading-trades-section-title--history {
  margin-top: 14px;
  padding-top: 10px;
  border-top: 1px solid rgba(148, 163, 184, 0.15);
}

.trading-trades-empty {
  padding: 10px 8px 14px;
  text-align: center;
  color: #64748b;
  font-size: 12px;
}

@media (max-width: 900px) {
  .trading-open-trades {
    max-height: 36vh;
    padding-bottom: 22px; /* keep last trade visible above fixed mobile actions */
  }
}


.trading-notification {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  padding: 10px 18px;
  background: rgba(15, 23, 42, 0.95);
  border-radius: 5px;
  color: #e5e7eb;
  font-size: 13px;
  font-weight: 600;
  z-index: 1000;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
  max-width: 80%;
  text-align: center;
}

.trading-notification-win {
  background: rgba(22, 163, 74, 0.92);
  border: 1px solid rgba(34, 197, 94, 0.9);
  color: #ffffff;
}

.trading-notification-loss {
  background: rgba(220, 38, 38, 0.92);
  border: 1px solid rgba(239, 68, 68, 0.9);
  color: #ffffff;
}

.trading-notification-neutral {
  background: rgba(15, 23, 42, 0.9);
  border: 1px solid rgba(148, 163, 184, 0.45);
  color: #e5e7eb;
}

.trading-right {
  background: rgba(15, 23, 42, 0.9);
  border-left: 1px solid rgba(148, 163, 184, 0.2);
  overflow: hidden;
}

.trading-panel {
  padding: 20px;
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: thin;
}

.trading-mode-toggle {
  display: flex;
  gap: 4px;
  margin-bottom: 20px;
  padding: 4px;
  background: rgba(30, 41, 59, 0.8);
  border-radius: 5px;
  border: 1px solid rgba(148, 163, 184, 0.3);
}

.trading-mode-toggle-below-graph {
  display: none;
  gap: 10px;
  margin: 12px 20px;
  padding: 4px;
  background: #0a0e1a;
  border-radius: 5px;
  border: 1px solid rgba(148, 163, 184, 0.3);
  flex-shrink: 0;
}

.trading-mode-cards,
.trading-mode-cards-below {
  display: flex;
  gap: 10px;
  margin: 6px 0;
  flex-wrap: wrap;
}

.trading-mode-card {
  background: rgba(10, 14, 26, 0.9);
  border: 1px solid rgba(37, 99, 235, 0.4);
  border-radius: 10px;
  padding: 6px 8px;
  width: 100%;
  min-width: 0;
  box-sizing: border-box;
  flex: 1 1 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px 16px;
  flex-wrap: nowrap;
  min-height: 44px !important;
}

.trading-mode-segment {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 0 1 auto;
  min-width: 0;
  cursor: pointer;
  border-radius: 5px;
  padding: 2px 4px;
  margin: -2px -4px;
  transition: background 0.15s ease;
}

.trading-mode-segment:hover {
  background: rgba(37, 99, 235, 0.12);
}

.trading-mode-segment input.trading-inline-input {
  cursor: text;
}

.trading-mode-segment--ticks {
  justify-content: flex-start;
}

.trading-mode-segment--minutes {
  justify-content: flex-end;
}

.trading-mode-card.active {
  border-color: rgba(59, 130, 246, 0.9);
  box-shadow: 0 6px 20px rgba(37, 99, 235, 0.22);
}

/* Ensure the inline fields are row-aligned within the card */
.trading-mode-card .trading-field-inline {
  flex-direction: row !important;
  align-items: center !important;
  margin: 0;
  gap: 6px;
}

.trading-mode-card .trading-mode-btn {
  padding: 4px 10px !important;
  min-height: 30px !important;
  line-height: 1 !important;
}

.trading-mode-card .trading-inline-input {
  padding: 4px 8px !important;
  min-height: 30px !important;
  height: 30px !important;
}

@media (max-width: 900px) {
  .trading-mode-cards,
  .trading-mode-cards-below {
    margin: 2px 0 !important;
  }

  .trading-mode-card {
    padding: 4px 6px !important;
    gap: 6px 10px !important;
    min-height: 38px !important;
  }

  .trading-mode-segment {
    gap: 6px !important;
  }

  .trading-mode-card .trading-mode-btn {
    padding: 3px 8px !important;
    min-height: 26px !important;
    font-size: 12px !important;
  }

  .trading-mode-card .trading-inline-input {
    padding: 2px 6px !important;
    min-height: 26px !important;
    height: 26px !important;
    font-size: 12px !important;
  }
}

.trading-stake-inline {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 10px 0 12px;
  position: relative;
  top: 0;
  width: 100%;
}

/* Stake control matching amount section style (below ticks/minutes) */
.trading-stake-stepper {
  display: flex;
  align-items: stretch;
  gap: 8px;
  width: 100%;
  max-width: 100%;
}

.trading-stake-step-btn {
  flex: 0 0 auto;
  width: 48px;
  min-width: 48px;
  height: 48px;
  padding: 0;
  border-radius: 14px;
  border: 1px solid rgba(148, 163, 184, 0.18);
  background: linear-gradient(180deg, #1e2534 0%, #161d2c 100%);
  color: #cbd5e1;
  font-size: 1.7rem;
  line-height: 1;
  cursor: pointer;
}

.trading-stake-step-mid {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  height: 48px;
  padding: 4px 10px 6px;
  border-radius: 18px;
  border: 1px solid rgba(37, 99, 235, 0.75);
  background: radial-gradient(circle at top, #111827 0%, #0b1220 70%);
}

.trading-stake-step-label {
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: #3b82f6;
  line-height: 1;
  transform: translateY(3px);
}

.trading-stake-step-value-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 3px;
  width: 100%;
}

.trading-stake-step-currency {
  font-size: 20px;
  font-weight: 800;
  color: #3b82f6;
  line-height: 1;
}

.trading-stake-step-input.trading-stake-input {
  flex: 1 1 auto;
  min-width: 0;
  width: 100% !important;
  max-width: 100px !important;
  min-width: 0 !important;
  height: auto !important;
  min-height: 0 !important;
  border: none !important;
  background: transparent !important;
  color: #f8fafc !important;
  font-size: 1.7rem !important;
  font-weight: 800 !important;
  line-height: 1 !important;
  text-align: center;
  padding: 0 !important;
}

.trading-stake-step-input::-webkit-outer-spin-button,
.trading-stake-step-input::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

.trading-stake-input {
  width: 82px !important;
  max-width: 82px !important;
  min-width: 82px !important;
  height: 26px !important;
  min-height: 26px !important;
  padding: 2px 6px !important;
  font-size: 12px !important;
  line-height: 1 !important;
}

@media (max-width: 900px) {
  .trading-stake-inline {
    gap: 6px !important;
    margin: 4px 0 8px !important;
  }

  .trading-stake-stepper {
    max-width: 100%;
  }

  .trading-stake-step-btn {
    width: 44px;
    min-width: 44px;
    height: 34px;
    border-radius: 12px;
    font-size: 1.25rem;
    line-height: 1;
  }

  .trading-stake-step-mid {
    height: 34px;
    border-radius: 16px;
  }

  .trading-stake-step-input.trading-stake-input {
    font-size: 1.5rem !important;
    max-width: 86px !important;
  }

  .trading-stake-input {
    width: 72px !important;
    max-width: 72px !important;
    min-width: 72px !important;
    height: 18px !important;
    min-height: 18px !important;
    padding: 1px 4px !important;
    font-size: 11px !important;
  }
}

.trading-fields-below-graph {
  display: none;
  flex-direction: row;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: 12px 20px;
  background: #0a0e1a;
  flex-shrink: 0;
  flex-wrap: wrap;
}

.trading-fields-below-graph .trading-field-bot-below {
  flex: 1 1 100%;
  width: 100%;
  order: 10;
  margin-top: 12px;
  clear: both;
}

.trading-fields-desktop {
  display: flex;
  flex-direction: row;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  width: 100%;
  flex-wrap: wrap;
}

@media (min-width: 901px) {
  .trading-trade-types-chart {
    display: none !important;
  }

  .trading-trade-types-desktop {
    display: block;
  }

  .trading-fields-desktop {
    margin-top: 60px;
  }

  .trading-market-type-tabs--desktop {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px 12px;
    width: 100%;
    max-width: 100%;
    padding: 0;
    margin: 0;
    border-top: none;
    justify-content: stretch;
    justify-items: stretch;
    align-items: stretch;
  }

  .trading-market-type-tabs--desktop .trading-market-type-tab {
    width: 100%;
    min-width: 0;
  }

}

/* Desktop-only Buy / Sell — raised physical-style buttons */
.trading-desktop-buy-sell {
  display: flex;
  flex-direction: row;
  align-items: stretch;
  gap: 10px;
  width: 100%;
  margin-top: 10px;
}

.trading-desktop-action-btn {
  flex: 1;
  min-width: 0;
  max-width: none;
  min-height: 42px;
  padding: 10px 14px;
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-family: inherit;
  color: #ffffff;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  border-radius: 10px;
  border-style: solid;
  border-width: 1px;
  text-shadow: 0 1px 1px rgba(0, 0, 0, 0.35);
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.28) inset,
    0 -1px 0 rgba(0, 0, 0, 0.12) inset,
    0 4px 0 rgba(0, 0, 0, 0.18),
    0 6px 14px rgba(0, 0, 0, 0.28);
  transition:
    filter 0.15s ease,
    box-shadow 0.12s ease,
    transform 0.1s ease;
}

.trading-desktop-action-btn:hover:not(:disabled) {
  filter: brightness(1.07);
}

.trading-desktop-action-btn:focus-visible {
  outline: 2px solid rgba(250, 250, 250, 0.85);
  outline-offset: 2px;
}

.trading-desktop-action-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  filter: grayscale(0.25);
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.12) inset,
    0 2px 4px rgba(0, 0, 0, 0.2);
}

.trading-desktop-action-btn--buy {
  background: linear-gradient(180deg, #4ade80 0%, #22c55e 38%, #16a34a 100%);
  border-color: #166534;
}

.trading-desktop-action-btn--sell {
  background: linear-gradient(180deg, #fb7185 0%, #ef4444 40%, #b91c1c 100%);
  border-color: #7f1d1d;
}

.trading-desktop-action-btn:active:not(:disabled) {
  transform: translateY(2px);
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.2) inset,
    0 2px 0 rgba(0, 0, 0, 0.22),
    0 3px 8px rgba(0, 0, 0, 0.22);
}

.trading-desktop-action-btn.is-starting {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  text-transform: none;
  font-weight: 600;
  font-size: 10px;
  padding: 7px 8px;
  background: linear-gradient(100deg, #3a3222 0%, #262e3d 100%) !important;
  color: #d2d6df !important;
  border: 1px solid #c79420;
  box-shadow: inset 0 0 0 1px rgba(199, 148, 32, 0.15);
}

.trading-desktop-action-btn.is-starting .trading-starting-spinner {
  width: 14px;
  height: 14px;
  flex-basis: 14px;
}

.trading-desktop-action-btn.is-starting .trading-starting-text {
  font-size: 10px;
}

.trading-fields-desktop .trading-field:first-child {
  flex: 1 1 auto;
  min-width: 0;
  width: 100%;
}

.trading-fields-desktop .trading-field-bot {
  flex: 1 1 100%;
  width: 100%;
  order: 10;
  margin-top: 12px;
  clear: both;
}

/* Keep Manual Trading + Smart Trading Bot on one horizontal row */
.trading-field-bot .trading-mode-split,
.trading-field-bot-below .trading-mode-split {
  display: flex !important;
  flex-direction: row !important;
  flex-wrap: nowrap !important;
  align-items: stretch !important;
  gap: 10px !important;
  width: 100% !important;
}

.trading-field-bot .trading-mode-split > button,
.trading-field-bot-below .trading-mode-split > button {
  flex: 1 1 0 !important;
  min-width: 0 !important;
  width: 50% !important;
  max-width: 50% !important;
}

.trading-mode-split > #manualTradingBtn,
.trading-mode-split > #manualTradingBtnBelow {
  order: 1 !important;
  flex-basis: 50% !important;
}

.trading-mode-split > #smartTradingBotBtn,
.trading-mode-split > #smartTradingBotBtnBelow {
  order: 2 !important;
  flex-basis: 50% !important;
}

.trading-mode-button {
  flex: 1;
  padding: 10px 16px;
  background: transparent;
  border: none;
  border-radius: 5px;
  color: #94a3b8;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}

.trading-mode-button.active {
  background: rgba(59, 130, 246, 0.2);
  color: #3b82f6;
}

.trading-field {
  margin-bottom: 20px;
}

.trading-field label {
  display: block;
  margin-bottom: 8px;
  color: #e5e7eb;
  font-size: 14px;
  font-weight: 600;
}

.trading-field input {
  width: 100%;
  padding: 12px;
  background: rgba(30, 41, 59, 0.8);
  border: 1px solid rgba(148, 163, 184, 0.3);
  border-radius: 5px;
  color: #e5e7eb;
  font-size: 14px;
  font-weight: 600;
}

.trading-field input:focus {
  outline: none;
  border-color: #3b82f6;
  box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.2);
}

.trading-field-inline {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-left: auto;
  margin-right: 0;
  width: fit-content;
}

/* Ticks field with stake below - use column layout */
.trading-field-inline.trading-field-ticks,
.trading-field-inline.trading-field-ticks-below {
  flex-direction: column;
  align-items: flex-start;
}

/* Keep ticks label and input on same row */
.trading-ticks-row {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
}

/* Stake field positioned directly below ticks */
.trading-stake-below-ticks {
  margin-top: 12px;
  width: 100%;
}

.trading-stake-below-ticks .trading-stake-container {
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: 100%;
}

.trading-stake-below-ticks .trading-stake-label-section {
  width: 100%;
}

.trading-stake-below-ticks .trading-stake-input-section {
  max-width: 72px;
  width: 72px;
}

.trading-stake-below-ticks .trading-stake-input-wrapper {
  width: 100%;
}

.trading-stake-below-ticks .trading-stake-input-wrapper input {
  width: 100%;
  max-width: 72px;
  padding: 4px 8px;
  font-size: 12px;
  line-height: 1.1;
}

.trading-field-stake-below {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-right: auto;
  margin-left: 0;
  width: fit-content;
}

.trading-fields-below-graph .trading-field,
.trading-fields-desktop .trading-field {
  margin-right: auto;
  margin-left: 0;
}

.trading-field-inline label {
  margin-bottom: 0;
  white-space: nowrap;
}

.trading-field-inline input {
  max-width: 60px;
  width: auto;
}

.trading-stake-container {
  display: flex;
  align-items: center;
  gap: 12px;
  transform: translateY(-200px);
  width: fit-content;
}

.trading-stake-label-section {
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: flex-start;
  white-space: nowrap;
}

.trading-stake-label-section label {
  font-weight: bold;
  color: #e5e7eb;
  font-size: 14px;
  display: inline-block;
  margin: 0;
  padding: 0;
  line-height: 1;
}

.trading-stake-currency {
  color: #94a3b8;
  font-size: 14px;
  font-weight: bold;
}

.trading-stake-input-section {
  flex: 0 0 auto;
  max-width: 80px;
  position: relative;
}

/* Position label inside input field */
.trading-stake-container .trading-stake-label-section {
  position: absolute;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
  z-index: 2;
  pointer-events: none;
  white-space: nowrap;
  margin-left: 12px;
}

/* Minimize height/thickness of stake input from bottom (mobile) */
.trading-fields-below-graph .trading-stake-input-wrapper input {
  padding: 6px 8px;
  font-size: 14px;
  min-height: auto;
  height: auto;
  margin-top: -16px;
}

/* Minimize height/thickness of ticks/minutes input from bottom (mobile) */
.trading-fields-below-graph .trading-field-inline input {
  padding: 6px 8px;
  font-size: 14px;
  min-height: auto;
  height: auto;
  max-width: 50px;
}

/* Mobile below-graph mode bar should read: Ticks | 2 | Minutes (no extra inline labels). */
.trading-fields-below-graph .trading-inline-label {
  display: none;
}

/* Keep mobile mode row anchored: Ticks (left), Minutes (right). */
.trading-fields-below-graph .trading-mode-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: nowrap;
  width: 100%;
}

.trading-fields-below-graph .trading-mode-segment {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
}

.trading-fields-below-graph .trading-mode-segment--minutes {
  margin-left: auto;
  justify-content: flex-end;
}

@media (max-width: 900px) {
  .trading-fields-below-graph .trading-mode-card {
    display: flex !important;
    align-items: center !important;
    justify-content: space-between !important;
    flex-wrap: nowrap !important;
    width: 100% !important;
    gap: 8px !important;
  }

  .trading-fields-below-graph .trading-mode-segment--ticks {
    flex: 1 1 auto !important;
    display: flex !important;
    align-items: center !important;
    justify-content: flex-start !important;
    min-width: 0 !important;
  }

  .trading-fields-below-graph .trading-mode-segment--minutes {
    flex: 1 1 auto !important;
    display: flex !important;
    align-items: center !important;
    justify-content: flex-end !important;
    margin-left: 0 !important;
    min-width: 0 !important;
  }

  .trading-fields-below-graph .trading-mode-segment--ticks .trading-field-inline,
  .trading-fields-below-graph .trading-mode-segment--minutes .trading-field-inline {
    margin-left: 0 !important;
    margin-right: 0 !important;
  }
}

.trading-stake-input-wrapper {
  display: flex;
  flex-direction: column;
  gap: 4px;
  width: 100%;
  position: relative;
}

.trading-stake-input-wrapper input {
  padding-left: 12px;
}

.trading-field {
  position: relative;
}

.trading-stake-input-wrapper {
  position: relative;
}

.trading-stake-input-wrapper input {
  max-width: 100%;
  width: 100%;
}

.trading-hint {
  font-size: 11px;
  color: #94a3b8;
  display: flex;
  justify-content: flex-start;
  align-items: center;
  width: 100%;
  white-space: nowrap;
}

.trading-hint span {
  float: none;
}

/* Mobile-specific styling for trading hint */
@media (max-width: 900px) {
  .trading-hint {
    font-size: 10px;
    justify-content: flex-start;
    white-space: nowrap;
  }
}

/* Stake field above Buy/Sell buttons (mobile only) */
.trading-stake-above-buttons {
  position: fixed;
  bottom: 100px; /* Position above buttons (buttons are ~100px tall) */
  left: 0;
  right: 0;
  padding: 12px 20px;
  background: #0a0e1a;
  z-index: 999;
  display: none; /* Hidden by default, shown on mobile */
}

.trading-stake-field-above-buttons {
  width: 100%;
  max-width: 100%;
}

.trading-stake-above-buttons .trading-stake-container {
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: 100%;
}

.trading-stake-above-buttons .trading-stake-label-section {
  width: 100%;
}

.trading-stake-above-buttons .trading-stake-input-section {
  max-width: 100%;
  width: 100%;
}

.trading-stake-above-buttons .trading-stake-input-wrapper {
  width: 100%;
}

.trading-stake-above-buttons .trading-stake-input-wrapper input {
  width: 100%;
  max-width: 100%;
}

.trading-mobile-actions {
  position: fixed;
  bottom: calc(58px + env(safe-area-inset-bottom, 0px));
  left: 0;
  right: 0;
  display: none;
  gap: 10px;
  z-index: 1000;
  padding: 10px 12px 10px;
  background: linear-gradient(180deg, rgba(15, 23, 42, 0.65) 0%, rgba(10, 14, 26, 0.96) 100%);
  border-top: 1px solid rgba(148, 163, 184, 0.22);
  box-shadow: 0 -8px 24px rgba(0, 0, 0, 0.35);
}

.trading-mobile-actions-main {
  display: flex;
  gap: 10px;
  width: 100%;
  padding: 0 14px;
  box-sizing: border-box;
}

.trading-mobile-button {
  flex: 1;
  appearance: none;
  -webkit-appearance: none;
  min-height: 27px;
  padding: 6px 12px;
  font-size: 15px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-family: inherit;
  color: #ffffff;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
  border-radius: 14px;
  border-style: solid;
  border-width: 1px;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.35);
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.3) inset,
    0 -1px 0 rgba(0, 0, 0, 0.15) inset,
    0 4px 0 rgba(0, 0, 0, 0.2),
    0 8px 18px rgba(0, 0, 0, 0.35);
  transition:
    filter 0.15s ease,
    box-shadow 0.12s ease,
    transform 0.1s ease;
}

.trading-mobile-button:active {
  transform: translateY(2px);
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.22) inset,
    0 2px 0 rgba(0, 0, 0, 0.25),
    0 4px 10px rgba(0, 0, 0, 0.28);
}

.trading-mobile-button-buy {
  background: linear-gradient(180deg, #4ade80 0%, #22c55e 38%, #16a34a 100%);
  border-color: #166534;
}

.trading-mobile-button-sell {
  background: linear-gradient(180deg, #fb7185 0%, #ef4444 40%, #b91c1c 100%);
  border-color: #7f1d1d;
}

.trading-mobile-button.is-starting {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 14px;
  padding-left: 26px;
  text-transform: none;
  background: linear-gradient(100deg, #3a3222 0%, #262e3d 100%) !important;
  color: #d2d6df !important;
  border: 1px solid #c79420;
  box-shadow: inset 0 0 0 1px rgba(199, 148, 32, 0.15);
}

.trading-mobile-position-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 1001;
  display: none;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  padding: 8px 12px calc(8px + env(safe-area-inset-bottom, 0px));
  border-top: 1px solid rgba(148, 163, 184, 0.22);
  background: rgba(10, 14, 26, 0.98);
}

.trading-mobile-position-nav-item {
  border: 1px solid rgba(51, 65, 85, 0.8);
  background: rgba(15, 23, 42, 0.8);
  color: #94a3b8;
  border-radius: 10px;
  min-height: 42px;
  display: flex;
  flex-direction: row;
  justify-content: center;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  font-weight: 700;
}

.trading-mobile-position-nav-item.is-active {
  color: #3b82f6;
  border-color: rgba(59, 130, 246, 0.8);
  background: rgba(37, 99, 235, 0.2);
}

.trading-mobile-position-nav-icon {
  font-size: 14px;
  line-height: 1;
}

.trading-mobile-positions-screen {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: calc(58px + env(safe-area-inset-bottom, 0px));
  z-index: 1000;
  background: #0b1326;
  display: none;
  flex-direction: column;
  padding-bottom: 0;
}

.trading-mobile-positions-screen.is-visible {
  display: flex !important;
}


#mobilePositionsScreen .trading-mobile-positions-tabs {
  display: none !important;
}

.trading-mobile-positions-tabs {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 1105;
  display: grid !important;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  border-bottom: 1px solid rgba(71, 85, 105, 0.35);
  background: linear-gradient(180deg, #121a2d 0%, #0f172a 100%);
  box-shadow: 0 1px 0 rgba(37, 99, 235, 0.22);
}

.trading-mobile-positions-tab {
  border: none;
  border-bottom: 2px solid transparent;
  background: transparent;
  color: #9caec8;
  min-height: 52px;
  font-size: 12px;
  font-weight: 700;
}

.trading-mobile-positions-tab.is-active {
  color: #3b82f6;
  border-bottom-color: #3b82f6;
}

.trading-mobile-positions-panel {
  display: none;
  flex: 1;
  align-items: stretch;
  justify-content: flex-start;
  flex-direction: column;
  gap: 8px;
  text-align: left;
  padding: 56px 10px 14px;
  overflow-y: auto;
}

.trading-mobile-positions-panel.is-active {
  display: flex;
}

.trading-mobile-positions-empty-icon {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  color: #94a3b8;
  font-size: 20px;
  background: rgba(59, 130, 246, 0.15);
  box-shadow: inset 0 0 0 1px rgba(148, 163, 184, 0.2);
}

.trading-mobile-positions-empty-title {
  color: #f8fafc;
  font-size: 24px;
  font-weight: 700;
  text-align: center;
}

.trading-mobile-positions-empty-subtitle {
  color: #93a7c4;
  font-size: 16px;
  text-align: center;
}

.trading-mobile-positions-empty-wrap {
  margin: auto;
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
}

.trading-mobile-position-card {
  border: 1px solid rgba(51, 65, 85, 0.7);
  border-radius: 12px;
  padding: 10px 12px;
  background: linear-gradient(180deg, rgba(30, 41, 59, 0.8) 0%, rgba(15, 23, 42, 0.95) 100%);
}

.trading-mobile-position-card--open {
  border-color: rgba(59, 130, 246, 0.38);
}

.trading-mobile-position-card--win {
  border-color: rgba(16, 185, 129, 0.45);
}

.trading-mobile-position-card--loss {
  border-color: rgba(245, 158, 11, 0.45);
}

.trading-mobile-position-card-title {
  display: flex;
  justify-content: space-between;
  align-items: center;
  color: #e2e8f0;
  font-size: 15px;
  font-weight: 800;
  margin-bottom: 4px;
}

.trading-mobile-position-card-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  color: #94a3b8;
  font-size: 12px;
  gap: 8px;
}

.trading-mobile-position-card-amount {
  margin-top: 6px;
  text-align: right;
  font-weight: 800;
  font-size: 20px;
  color: #22c55e;
}

.trading-mobile-position-card--loss .trading-mobile-position-card-amount {
  color: #f59e0b;
}

.trading-mobile-tx-card {
  border-radius: 12px;
  padding: 10px 12px;
  border: 1px solid transparent;
}

.trading-mobile-tx-card--credit {
  background: linear-gradient(180deg, rgba(6, 95, 70, 0.3) 0%, rgba(15, 23, 42, 0.95) 100%);
  border-color: rgba(16, 185, 129, 0.5);
}

.trading-mobile-tx-card--debit {
  background: linear-gradient(180deg, rgba(88, 28, 135, 0.28) 0%, rgba(15, 23, 42, 0.95) 100%);
  border-color: rgba(168, 85, 247, 0.5);
}

.trading-mobile-tx-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  color: #f8fafc;
  font-size: 14px;
  font-weight: 800;
}

.trading-mobile-tx-meta {
  margin-top: 4px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  color: #cbd5e1;
  font-size: 12px;
  gap: 8px;
}

.trading-starting-spinner {
  width: 18px;
  height: 18px;
  border: 2px solid rgba(142, 153, 172, 0.35);
  border-top-color: #8e99ac;
  border-radius: 50%;
  flex: 0 0 18px;
  animation: tradingStartingSpin 0.8s linear infinite !important;
}

.trading-starting-text {
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0.2px;
  color: #c3ccd9;
}

@keyframes tradingStartingSpin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

@media (max-width: 900px) {
  .trading-page.is-mobile-positions .trading-header-bar {
    display: none !important;
  }
  .trading-starting-spinner {
    width: 16px;
    height: 16px;
    flex-basis: 16px;
  }

  .trading-starting-text {
    font-size: 13px;
  }
}

.back-button {
  position: absolute;
  top: 20px;
  left: 20px;
  padding: 10px 20px;
  background: rgba(15, 23, 42, 0.9);
  border: 1px solid rgba(148, 163, 184, 0.3);
  border-radius: 5px;
  color: #e5e7eb;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  z-index: 900;
  transition: all 0.2s ease;
}

.back-button:hover {
  background: rgba(30, 41, 59, 0.9);
  border-color: rgba(148, 163, 184, 0.5);
}

@media (max-width: 900px) {
  .trading-page.is-mobile-positions .trading-left,
  .trading-page.is-mobile-positions .trading-right,
  .trading-page.is-mobile-positions .trading-mobile-actions {
    display: none !important;
  }

  .back-button {
    display: none !important;
  }

  .trading-content {
    grid-template-columns: minmax(0, 1fr);
  }

  .trading-left-rail {
    display: none;
  }

  .trading-right {
    border-top: 1px solid rgba(148, 163, 184, 0.3);
    border-left: none;
}

  .trading-mobile-actions {
  display: flex;
  }

  .trading-mobile-position-nav {
    display: grid;
  }

  .trading-mobile-positions-tabs {
    top: 7px;
  }

  .trading-mobile-positions-panel {
    padding-top: 73px;
  }

  .trading-mobile-positions-empty-title {
    font-size: 30px;
  }

  .trading-mobile-positions-empty-subtitle {
    font-size: 20px;
  }
  
  .trading-stake-above-buttons {
    display: block;
  }

  .trading-chart-card {
    padding-bottom: 300px; /* room for raised controls + bottom position strip */
  }

  .trading-line-graph {
    min-height: 300px;
  }

  .trading-mode-toggle {
    display: none;
  }

  .trading-mode-toggle-below-graph {
    display: flex;
}

  .trading-fields-below-graph {
    display: flex;
    position: fixed;
    left: 0;
    right: 0;
    bottom: calc(87px + env(safe-area-inset-bottom, 0px));
    z-index: 999;
    padding: 10px 12px;
    border-top: 1px solid rgba(148, 163, 184, 0.2);
    background: linear-gradient(180deg, rgba(15, 23, 42, 0.72) 0%, rgba(10, 14, 26, 0.97) 100%);
  }

  .trading-open-trades {
    display: none;
  }

  .trading-fields-desktop {
    display: none;
}
}
