/* Quotex-style timed trade — matches spot dark theme */
html:has(body.qt-page) {
  height: 100%;
  overflow: hidden;
}

body.qt-page {
  height: 100dvh;
  max-height: 100dvh;
  overflow: hidden;
  overscroll-behavior: none;
  touch-action: manipulation;
}

.qt-page {
  display: flex;
  flex-direction: column;
  height: 100dvh;
  max-height: 100dvh;
  min-height: 0;
  overflow: hidden;
  background:
    radial-gradient(circle at 10% 0%, rgba(112, 247, 255, 0.08), transparent 40%),
    radial-gradient(circle at 90% 20%, rgba(14, 203, 129, 0.06), transparent 35%),
    #05070f;
}

.qt-top {
  position: relative;
  z-index: 30;
  flex: 0 0 auto;
  display: grid;
  gap: 6px;
  padding: 8px 10px;
  padding-top: calc(8px + env(safe-area-inset-top, 0px));
  border-bottom: 1px solid rgba(112, 247, 255, 0.15);
  background: rgba(5, 7, 15, 0.92);
  backdrop-filter: blur(16px);
}

.qt-top-main,
.qt-top-tools {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
}

.qt-top-main {
  min-height: 40px;
}

.qt-top-tools {
  min-height: 32px;
}

.qt-back,
.qt-history-btn,
.qt-spot-btn,
.qt-chart-collapse,
.qt-pair-sheet-head button {
  border: 1px solid rgba(112, 247, 255, 0.25);
  border-radius: 10px;
  color: #d7f9ff;
  background: rgba(0, 0, 0, 0.35);
  cursor: pointer;
  font-weight: 800;
}

.qt-back {
  width: 40px;
  height: 40px;
  flex: 0 0 40px;
  font-size: 1.1rem;
}

.qt-pair-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1;
  min-width: 0;
  padding: 6px 10px;
  border: 1px solid rgba(112, 247, 255, 0.25);
  border-radius: 14px;
  color: #fff;
  background: rgba(10, 18, 32, 0.9);
  cursor: pointer;
  text-align: left;
}

.qt-pair-btn img {
  width: 28px;
  height: 28px;
  border-radius: 50%;
}

.qt-pair-btn span {
  display: grid;
  min-width: 0;
}

.qt-pair-btn strong {
  font-size: 0.92rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.qt-pair-btn em {
  font-style: normal;
  font-size: 0.72rem;
  color: #8fa3b8;
}

.qt-pair-btn em.up { color: #0ecb81; }
.qt-pair-btn em.down { color: #f6465d; }

.qt-pair-btn svg {
  width: 16px;
  height: 16px;
  flex: 0 0 16px;
  fill: none;
  stroke: #8fa3b8;
  stroke-width: 2;
  margin-left: auto;
}

.qt-balance-pill {
  display: grid;
  flex: 1;
  min-width: 0;
  padding: 6px 10px;
  border-radius: 12px;
  background: rgba(112, 247, 255, 0.08);
  border: 1px solid rgba(112, 247, 255, 0.2);
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: pointer;
}

.qt-balance-pill:active {
  transform: scale(0.98);
}

.qt-balance-pill small {
  font-size: 0.62rem;
  color: #8fa3b8;
}

.qt-balance-pill strong {
  font-size: 0.82rem;
  color: #70f7ff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.qt-history-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  flex: 0 0 auto;
  padding: 4px 12px 4px 4px;
  min-height: 40px;
  font-size: 0.72rem;
  position: relative;
  z-index: 2;
}

.qt-action-ico,
.qt-spot-btn img,
.qt-history-btn img {
  width: 32px !important;
  height: 32px !important;
  max-width: 32px !important;
  max-height: 32px !important;
  object-fit: cover;
  border-radius: 50%;
  flex: 0 0 32px;
  filter: drop-shadow(0 0 8px rgba(112, 247, 255, 0.35));
}

.qt-spot-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  gap: 8px;
  padding: 4px 14px 4px 4px;
  min-height: 44px;
  font-size: 0.72rem;
  font-weight: 900;
  letter-spacing: 0.02em;
  text-decoration: none;
  color: #041018;
  border: 1px solid rgba(255, 255, 255, 0.28);
  border-radius: 999px;
  background: linear-gradient(180deg, #9ffcff 0%, #70f7ff 45%, #0d9488 100%);
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.45) inset,
    0 10px 22px rgba(112, 247, 255, 0.28),
    0 3px 0 rgba(13, 148, 136, 0.55);
}

.qt-spot-btn .qt-action-ico {
  width: 36px !important;
  height: 36px !important;
  max-width: 36px !important;
  max-height: 36px !important;
  flex: 0 0 36px;
  background: #05070f;
  box-shadow: 0 0 12px rgba(112, 247, 255, 0.35);
}

.qt-spot-btn:active {
  transform: translateY(1px);
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.3) inset,
    0 6px 14px rgba(112, 247, 255, 0.2);
}

.qt-shell {
  display: grid;
  grid-template-rows: minmax(0, 1fr) auto;
  flex: 1 1 auto;
  min-height: 0;
  overflow: hidden;
  padding-bottom: calc(64px + env(safe-area-inset-bottom, 0px));
}

.qt-chart-panel {
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow: hidden;
}

.qt-chart-panel.is-expanded {
  min-height: 0;
}

.qt-chart-panel:not(.is-expanded) {
  flex: 0 0 auto;
  min-height: 0;
}

.qt-chart-panel:not(.is-expanded) .qt-chart-wrap {
  height: 0;
  min-height: 0;
  margin: 0;
  border: 0;
  opacity: 0;
  pointer-events: none;
}

.qt-chart-wrap {
  position: relative;
  flex: 1 1 auto;
  width: 100%;
  min-height: calc(100dvh - 250px);
  height: 100%;
  margin: 0;
  overflow: hidden;
  border-radius: 0;
  border: 0;
  border-top: 1px solid rgba(112, 247, 255, 0.12);
  border-bottom: 1px solid rgba(112, 247, 255, 0.12);
  background:
    linear-gradient(180deg, rgba(112, 247, 255, 0.03) 0%, transparent 18%),
    #05070f;
}

.qt-chart-toolbar {
  position: absolute;
  top: 8px;
  left: 8px;
  right: 8px;
  z-index: 8;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 6px;
  border-radius: 12px;
  border: 1px solid rgba(112, 247, 255, 0.18);
  background: rgba(5, 7, 15, 0.78);
  backdrop-filter: blur(12px);
  pointer-events: none;
}

.qt-chart-toolbar > * {
  pointer-events: auto;
}

.qt-intervals {
  flex: 1;
  min-width: 0;
  padding: 0;
}

.qt-intervals button {
  min-width: 36px;
  min-height: 28px;
  padding: 0 8px;
  font-size: 0.64rem;
}

.qt-chart-zoom {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  flex: 0 0 auto;
}

.qt-chart-zoom button {
  width: 28px;
  min-height: 28px;
  padding: 0;
  border: 1px solid rgba(112, 247, 255, 0.22);
  border-radius: 8px;
  color: #d7f9ff;
  background: rgba(0, 0, 0, 0.4);
  cursor: pointer;
  font-size: 0.72rem;
  font-weight: 800;
  line-height: 1;
}

.qt-chart-zoom button[data-qt-zoom="live"] {
  color: #0ecb81;
  font-size: 0.55rem;
}

.qt-chart-collapse {
  flex: 0 0 auto;
  width: 32px;
  min-height: 28px;
  padding: 0;
  font-size: 0.9rem;
  line-height: 1;
  background: rgba(0, 0, 0, 0.45);
}

.qt-chart-mount {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  min-height: 0;
}

.qt-chart-status {
  position: absolute;
  left: 50%;
  bottom: 28%;
  z-index: 4;
  transform: translateX(-50%);
  margin: 0;
  padding: 4px 10px;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.55);
  font-size: 0.68rem;
  pointer-events: none;
}

.qt-trade-overlay {
  position: absolute;
  top: 52px;
  left: 8px;
  z-index: 12;
  display: grid;
  grid-template-columns: repeat(4, auto);
  gap: 8px;
  padding: 6px 8px;
  border-radius: 10px;
  background: rgba(0, 0, 0, 0.82);
  border: 1px solid rgba(112, 247, 255, 0.35);
  backdrop-filter: blur(10px);
  pointer-events: none;
}

.qt-trade-overlay strong.up {
  color: #0ecb81;
}

.qt-trade-overlay strong.down {
  color: #f6465d;
}

.rqx-trade-marker {
  position: absolute;
  left: 10px;
  bottom: 12%;
  z-index: 11;
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 8px 10px;
  border-radius: 10px;
  background: rgba(0, 0, 0, 0.78);
  border: 1px solid rgba(112, 247, 255, 0.28);
  font-size: 0.68rem;
  color: #fff;
  pointer-events: none;
  min-width: 120px;
}

.rqx-trade-marker strong {
  font-size: 0.74rem;
}

.rqx-trade-marker span {
  color: #8fa3b8;
  font-size: 0.62rem;
}

.rqx-trade-marker em {
  font-style: normal;
  font-weight: 800;
  font-size: 0.82rem;
  letter-spacing: 0.04em;
}

.rqx-trade-marker.up {
  border-color: rgba(14, 203, 129, 0.45);
}

.rqx-trade-marker.up em {
  color: #0ecb81;
}

.rqx-trade-marker.down {
  border-color: rgba(246, 70, 93, 0.45);
}

.rqx-trade-marker.down em {
  color: #f6465d;
}

.qt-trade-overlay small {
  display: block;
  font-size: 0.58rem;
  color: #8fa3b8;
}

.qt-trade-overlay strong {
  font-size: 0.72rem;
  color: #fff;
}

.qt-price-tag {
  position: absolute;
  right: 6px;
  top: 50%;
  z-index: 5;
  transform: translateY(-50%);
  padding: 5px 8px;
  border-radius: 6px;
  background: rgba(14, 203, 129, 0.92);
  color: #04120c;
  font-weight: 800;
  font-size: 0.76rem;
  pointer-events: none;
}

@media (max-width: 420px) {
  .qt-chart-wrap {
    min-height: calc(100dvh - 236px);
  }
}

@media (min-height: 780px) {
  .qt-chart-wrap {
    min-height: calc(100dvh - 220px);
  }
}

.qt-controls {
  flex: 0 0 auto;
  margin-top: 0;
  padding: 8px 10px 6px;
  border-top: 1px solid rgba(112, 247, 255, 0.14);
  border-radius: 16px 16px 0 0;
  background: linear-gradient(180deg, rgba(12, 18, 32, 0.98), rgba(5, 7, 15, 0.98));
  box-shadow: 0 -8px 28px rgba(0, 0, 0, 0.4);
}

.qt-inputs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  min-width: 0;
  width: 100%;
}

.qt-field {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.qt-field > span {
  font-size: 0.58rem;
  color: #8fa3b8;
  font-weight: 700;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

.qt-field-row {
  display: flex;
  align-items: center;
  gap: 2px;
  padding: 2px;
  min-width: 0;
  min-height: 34px;
  border-radius: 10px;
  border: 1px solid rgba(112, 247, 255, 0.2);
  background: rgba(0, 0, 0, 0.35);
}

.qt-field-row input {
  flex: 1 1 auto;
  width: 0;
  min-width: 0;
  max-width: 100%;
  border: 0;
  background: transparent;
  color: #fff;
  text-align: center;
  font-size: 0.86rem;
  font-weight: 800;
  outline: none;
}

.qt-field-row button {
  width: 26px;
  height: 26px;
  flex: 0 0 26px;
  border: 0;
  border-radius: 7px;
  color: #70f7ff;
  background: rgba(112, 247, 255, 0.1);
  cursor: pointer;
  font-size: 0.9rem;
  font-weight: 800;
}

.qt-unit {
  flex: 0 0 auto;
  padding: 0 6px 0 2px;
  font-style: normal;
  font-size: 0.62rem;
  color: #8fa3b8;
  font-weight: 700;
  white-space: nowrap;
}

.qt-presets {
  display: flex;
  flex-wrap: nowrap;
  gap: 5px;
  margin-top: 6px;
  overflow-x: auto;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
}

.qt-presets::-webkit-scrollbar {
  display: none;
}

.qt-presets button {
  flex: 0 0 auto;
  min-width: 36px;
  min-height: 26px;
  padding: 0 8px;
  border: 1px solid rgba(112, 247, 255, 0.18);
  border-radius: 999px;
  color: #8fa3b8;
  background: rgba(0, 0, 0, 0.3);
  cursor: pointer;
  font-size: 0.64rem;
  font-weight: 800;
}

.qt-presets button.active {
  color: #04120c;
  border-color: transparent;
  background: linear-gradient(135deg, #70f7ff, #0ecb81);
}

.qt-profit-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin: 6px 2px 6px;
  font-size: 0.72rem;
  color: #8fa3b8;
}

.qt-profit-row strong,
.qt-profit-amt {
  color: #0ecb81;
  font-size: 0.78rem;
}

.qt-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.qt-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 40px;
  border: 0;
  border-radius: 11px;
  color: #fff;
  cursor: pointer;
  font-size: 0.82rem;
  font-weight: 900;
  letter-spacing: 0.04em;
}

.qt-btn svg {
  width: 14px;
  height: 14px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.4;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.qt-btn.lower {
  background: linear-gradient(180deg, #ff6b7a, #f6465d);
  box-shadow: 0 4px 14px rgba(246, 70, 93, 0.28);
}

.qt-btn.higher {
  background: linear-gradient(180deg, #2ee59a, #0ecb81);
  box-shadow: 0 4px 14px rgba(14, 203, 129, 0.28);
}

.qt-btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.qt-status {
  min-height: 0.9em;
  margin: 4px 0 0;
  text-align: center;
  color: #8fa3b8;
  font-size: 0.68rem;
}

.qt-pair-sheet,
.qt-history-sheet,
.qt-wallet-sheet {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  width: 100%;
  height: 100dvh;
  max-height: 100dvh;
  z-index: 400;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  margin: 0;
  background: rgba(0, 0, 0, 0.62);
}

.qt-pair-sheet[hidden],
.qt-history-sheet[hidden],
.qt-wallet-sheet[hidden] {
  display: none !important;
}

.qt-pair-sheet.is-open,
.qt-history-sheet.is-open,
.qt-wallet-sheet.is-open {
  display: flex !important;
}

.qt-pair-sheet-card,
.qt-history-card,
.qt-wallet-card {
  width: 100%;
  max-height: min(72dvh, calc(100dvh - 72px));
  overflow: auto;
  padding: 16px 16px calc(16px + env(safe-area-inset-bottom, 0px));
  border-radius: 22px 22px 0 0;
  background: #0b1220;
  border: 1px solid rgba(112, 247, 255, 0.2);
}

.qt-wallet-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-bottom: 14px;
}

.qt-wallet-tabs button {
  min-height: 40px;
  border: 1px solid rgba(112, 247, 255, 0.22);
  border-radius: 12px;
  background: rgba(0, 0, 0, 0.35);
  color: #8fa3b8;
  font-weight: 800;
  cursor: pointer;
}

.qt-wallet-tabs button.active {
  color: #041018;
  border-color: transparent;
  background: linear-gradient(135deg, #70f7ff, #0ecb81);
}

.qt-wallet-lead {
  margin: 0 0 12px;
  font-size: 0.82rem;
  color: #8fa3b8;
  line-height: 1.45;
}

.qt-wallet-amount-row strong {
  display: block;
  font-size: 1.35rem;
  color: #70f7ff;
}

.qt-wallet-deposit-btn,
.qt-wallet-save-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-height: 46px;
  margin-top: 14px;
  border-radius: 14px;
  border: 1px solid rgba(255, 255, 255, 0.28);
  background: linear-gradient(180deg, #9ffcff 0%, #70f7ff 45%, #0d9488 100%);
  color: #041018;
  font-weight: 900;
  text-decoration: none;
  cursor: pointer;
}

.qt-wallet-display-field {
  display: grid;
  gap: 6px;
  width: 100%;
}

.qt-wallet-display-field span {
  font-size: 0.72rem;
  color: #8fa3b8;
  font-weight: 700;
}

.qt-wallet-display-field input {
  width: 100%;
  min-height: 44px;
  padding: 0 12px;
  border-radius: 12px;
  border: 1px solid rgba(112, 247, 255, 0.22);
  background: rgba(0, 0, 0, 0.35);
  color: #fff;
  font-size: 1.1rem;
  font-weight: 800;
}

.qt-wallet-note {
  margin: 10px 0 0;
  font-size: 0.78rem;
  color: #8fa3b8;
}

.qt-wallet-currency-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-top: 14px;
  font-size: 0.78rem;
  color: #8fa3b8;
}

.qt-wallet-currency-toggle {
  display: flex;
  gap: 6px;
}

.qt-wallet-currency-toggle button {
  min-height: 34px;
  padding: 0 12px;
  border: 1px solid rgba(112, 247, 255, 0.22);
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.35);
  color: #8fa3b8;
  font-weight: 800;
  cursor: pointer;
}

.qt-wallet-currency-toggle button.active {
  color: #041018;
  border-color: transparent;
  background: linear-gradient(135deg, #70f7ff, #0ecb81);
}

.qt-pair-sheet-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}

.qt-pair-sheet-head h3 {
  margin: 0;
  font-size: 1.05rem;
}

.qt-pair-sheet-head button {
  min-height: 34px;
  padding: 0 12px;
}

.qt-pair-list,
.qt-history-list {
  display: grid;
  gap: 8px;
}

.qt-pair-item,
.qt-history-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 12px;
  border-radius: 14px;
  border: 1px solid rgba(112, 247, 255, 0.14);
  background: rgba(0, 0, 0, 0.28);
  color: #fff;
  cursor: pointer;
  text-align: left;
}

.qt-pair-item img {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  margin-right: 8px;
}

.qt-pair-item span {
  display: flex;
  align-items: center;
}

.qt-history-item {
  cursor: default;
  flex-direction: column;
  align-items: stretch;
}

.qt-history-item .row {
  display: flex;
  justify-content: space-between;
  gap: 8px;
}

.qt-history-item .win { color: #0ecb81; }
.qt-history-item .loss { color: #f6465d; }
.qt-history-item .open { color: #70f7ff; }

@media (min-width: 900px) {
  .qt-shell {
    max-width: 720px;
    margin: 0 auto;
  }
}
