:root {
  --bg-primary: #0d1117;
  --bg-secondary: #161b22;
  --bg-tertiary: #1e2329;
  --bg-card: rgba(22, 27, 34, 0.85);
  --bg-card-hover: rgba(30, 37, 46, 0.9);
  --border-color: rgba(48, 54, 61, 0.6);
  --border-accent: rgba(16, 185, 129, 0.2);
  --text-primary: #e6edf3;
  --text-secondary: rgba(230, 237, 243, 0.7);
  --text-tertiary: rgba(139, 148, 158, 0.8);
  --accent-green: #10b981;
  --accent-cyan: #06b6d4;
  --accent-red: #ef4444;
  --accent-yellow: #f0b90b;
  --accent-blue: #3b82f6;
  --glow-green: rgba(16, 185, 129, 0.4);
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  background: #0d1117 !important;
  background-color: #0d1117 !important;
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  background: #0d1117 !important;
  background-color: #0d1117 !important;
  color: var(--text-primary, #e6edf3);
  min-height: 100vh;
  overflow-x: hidden;
  padding-bottom: 80px;
}

/* Top Header */
.top-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  background: #0d1117 !important;
  background-color: #0d1117 !important;
  border-bottom: 1px solid var(--border-color);
  position: sticky;
  top: 0;
  z-index: 50;
}

.top-header .back-btn {
  background: none;
  border: none;
  color: var(--text-primary);
  font-size: 20px;
  cursor: pointer;
  padding: 4px;
}

.top-header h1 {
  font-size: 16px;
  font-weight: 700;
}

.mode-switch {
  display: flex;
  gap: 4px;
}

.mode-switch button {
  padding: 4px 12px;
  font-size: 12px;
  border-radius: 6px;
  border: none;
  cursor: pointer;
  font-weight: 600;
  transition: all 0.2s;
}

.mode-switch .spot-btn {
  background: transparent;
  color: var(--text-secondary);
}

.mode-switch .spot-btn:hover {
  color: var(--text-primary);
}

.mode-switch .futures-btn {
  background: rgba(240, 185, 11, 0.12);
  color: var(--accent-yellow);
}

.mode-switch .mining-btn {
  background: transparent;
  color: var(--text-secondary);
}

.mode-switch .mining-btn:hover {
  color: var(--accent-green);
  background: rgba(16, 185, 129, 0.1);
}

/* Coin Selector */
.coin-selector-area {
  padding: 16px;
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border-color);
}

.coin-selector-btn {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  padding: 12px 16px;
  width: 100%;
  cursor: pointer;
  transition: all 0.2s;
}

.coin-selector-btn:hover {
  border-color: var(--accent-yellow);
}

.coin-icon {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: linear-gradient(135deg, #f7931a, #ffab40);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 14px;
  color: #fff;
}

.coin-name {
  font-weight: 700;
  font-size: 16px;
}

.coin-pair {
  font-size: 12px;
  color: var(--text-secondary);
}

.coin-price-live {
  margin-left: auto;
  text-align: right;
}

.coin-price-val {
  font-weight: 700;
  font-size: 16px;
}

.coin-price-chg {
  font-size: 12px;
}

.coin-price-chg.up {
  color: var(--accent-green);
}

.coin-price-chg.down {
  color: var(--accent-red);
}

/* Coin Dropdown */
.coin-dropdown {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: var(--bg-primary);
  z-index: 200;
  flex-direction: column;
}

.coin-dropdown.show {
  display: flex;
}

.coin-dropdown-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border-color);
}

.coin-dropdown-header .close-dd {
  background: none;
  border: none;
  color: var(--text-primary);
  font-size: 20px;
  cursor: pointer;
}

.coin-dropdown-header input {
  flex: 1;
  background: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 8px 12px;
  color: var(--text-primary);
  font-size: 14px;
  outline: none;
}

.coin-dropdown-header input::placeholder {
  color: var(--text-tertiary);
}

.coin-dropdown-list {
  flex: 1;
  overflow-y: auto;
}

.coin-dropdown-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.03);
  cursor: pointer;
  transition: background 0.15s;
}

.coin-dropdown-item:hover {
  background: var(--bg-tertiary);
}

.coin-dropdown-item .dd-icon {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 12px;
  color: #fff;
}

.coin-dropdown-item .dd-name {
  font-weight: 600;
  font-size: 14px;
}

.coin-dropdown-item .dd-balance {
  margin-left: auto;
  text-align: right;
}

.coin-dropdown-item .dd-bal-val {
  font-weight: 600;
  font-size: 14px;
}

.coin-dropdown-item .dd-bal-usd {
  font-size: 11px;
  color: var(--text-secondary);
}

/* Trade Setup */
.trade-setup {
  padding: 16px;
}

.amount-section {
  margin-bottom: 16px;
}

.amount-label {
  font-size: 13px;
  color: var(--text-secondary);
  margin-bottom: 8px;
  display: flex;
  justify-content: space-between;
}

.amount-input-wrap {
  display: flex;
  align-items: center;
  gap: 0;
  background: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  overflow: hidden;
}

.amount-input-wrap input {
  flex: 1;
  background: transparent;
  border: none;
  padding: 14px 16px;
  color: var(--text-primary);
  font-size: 18px;
  font-weight: 600;
  outline: none;
}

.amount-input-wrap input::placeholder {
  color: var(--text-tertiary);
}

.amount-input-wrap .unit {
  padding: 14px 16px;
  color: var(--accent-yellow);
  font-weight: 700;
  font-size: 14px;
}

.amount-presets {
  display: flex;
  gap: 8px;
  margin-top: 8px;
}

.amount-presets button {
  flex: 1;
  padding: 8px;
  border-radius: 8px;
  background: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  color: var(--text-secondary);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
}

.amount-presets button:hover,
.amount-presets button.active {
  background: rgba(240, 185, 11, 0.12);
  color: var(--accent-yellow);
  border-color: var(--accent-yellow);
}

/* Duration */
.duration-section {
  margin-bottom: 16px;
}

.section-label {
  font-size: 13px;
  color: var(--text-secondary);
  margin-bottom: 8px;
}

.duration-btns {
  display: flex;
  gap: 8px;
}

.duration-btns button {
  flex: 1;
  padding: 12px 8px;
  border-radius: 12px;
  background: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  color: var(--text-secondary);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  text-align: center;
}

.duration-btns button span {
  display: block;
  font-size: 11px;
  color: var(--text-tertiary);
  margin-top: 2px;
}

.duration-btns button.active {
  background: rgba(240, 185, 11, 0.12);
  color: var(--accent-yellow);
  border-color: var(--accent-yellow);
}

/* Direction Buttons */
.direction-btns {
  display: flex;
  gap: 12px;
  margin-bottom: 16px;
}

.direction-btns button {
  flex: 1;
  padding: 16px;
  border-radius: 14px;
  border: none;
  font-size: 16px;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: all 0.25s;
  position: relative;
  overflow: hidden;
}

.dir-up {
  background: linear-gradient(135deg, #0ecb81, #00a86b);
  color: white;
  box-shadow: 0 4px 20px rgba(14, 203, 129, 0.3);
}

.dir-up:hover {
  box-shadow: 0 6px 28px rgba(14, 203, 129, 0.5);
  transform: translateY(-2px);
}

.dir-up:active {
  transform: translateY(0);
}

.dir-down {
  background: linear-gradient(135deg, #f6465d, #d63150);
  color: white;
  box-shadow: 0 4px 20px rgba(246, 70, 93, 0.3);
}

.dir-down:hover {
  box-shadow: 0 6px 28px rgba(246, 70, 93, 0.5);
  transform: translateY(-2px);
}

.dir-down:active {
  transform: translateY(0);
}

/* Active Trade Modal */
.trade-modal-overlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.7);
  z-index: 300;
  justify-content: center;
  align-items: flex-end;
}

.trade-modal-overlay.show {
  display: flex;
}

.trade-modal {
  background: #fff;
  width: 100%;
  max-width: 500px;
  border-radius: 24px 24px 0 0;
  padding: 0;
  color: #1a1a2e;
  max-height: 90vh;
  overflow-y: auto;
  animation: slideUpModal 0.35s ease;
  position: relative;
}

@keyframes slideUpModal {
  from {
    transform: translateY(100%);
  }

  to {
    transform: translateY(0);
  }
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 24px 12px;
  border-bottom: 1px solid #eee;
}

.modal-pair {
  font-weight: 800;
  font-size: 18px;
  color: #1a1a2e;
}

.modal-close {
  background: #f5f5f5;
  border: none;
  border-radius: 50%;
  width: 32px;
  height: 32px;
  font-size: 18px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #666;
}

/* Countdown Circle */
.countdown-area {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 24px 24px 16px;
}

.countdown-circle {
  width: 160px;
  height: 160px;
  position: relative;
}

.countdown-circle svg {
  width: 160px;
  height: 160px;
  transform: rotate(-90deg);
}

.countdown-circle .bg-ring {
  fill: none;
  stroke: #e8e8e8;
  stroke-width: 6;
}

.countdown-circle .progress-ring {
  fill: none;
  stroke-width: 6;
  stroke-linecap: round;
  transition: stroke-dashoffset 0.5s linear;
}

.countdown-circle .progress-ring.up {
  stroke: var(--accent-green);
}

.countdown-circle .progress-ring.down {
  stroke: var(--accent-red);
}

.countdown-text {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  text-align: center;
}

.countdown-secs {
  font-size: 42px;
  font-weight: 800;
  color: #1a1a2e;
  line-height: 1;
}

.countdown-label {
  font-size: 12px;
  color: #999;
  margin-top: 2px;
}

/* Now Price */
.now-price {
  padding: 8px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: #fafafa;
  margin: 0 16px;
  border-radius: 12px;
}

.now-price-label {
  font-size: 13px;
  color: #999;
}

.now-price-val {
  font-size: 18px;
  font-weight: 700;
}

.now-price-val.up {
  color: var(--accent-green);
}

.now-price-val.down {
  color: var(--accent-red);
}

/* Trade Details */
.trade-details {
  padding: 16px 24px;
}

.trade-detail-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 0;
  border-bottom: 1px solid #f0f0f0;
}

.trade-detail-row:last-child {
  border-bottom: none;
}

.td-label {
  font-size: 13px;
  color: #999;
}

.td-value {
  font-size: 14px;
  font-weight: 600;
  color: #1a1a2e;
}

.td-value.profit {
  color: var(--accent-green);
  font-weight: 700;
}

.td-value.loss {
  color: var(--accent-red);
  font-weight: 700;
}

/* Modal Back Button */
.modal-back-btn {
  margin: 8px 24px 24px;
  padding: 14px;
  border-radius: 14px;
  background: var(--accent-blue);
  color: #fff;
  border: none;
  font-size: 15px;
  font-weight: 700;
  width: calc(100% - 48px);
  cursor: pointer;
  transition: all 0.2s;
}

.modal-back-btn:hover {
  opacity: 0.9;
}

.modal-back-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* Result Overlay inside modal */
.result-overlay {
  display: none;
  position: absolute;
  inset: 0;
  background: #fff;
  z-index: 5;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 32px 24px;
  text-align: center;
  animation: fadeInResult 0.4s ease;
}

.result-overlay.show {
  display: flex;
}

@keyframes fadeInResult {
  from {
    opacity: 0;
    transform: scale(0.9);
  }

  to {
    opacity: 1;
    transform: scale(1);
  }
}

.result-emoji {
  font-size: 64px;
  margin-bottom: 16px;
}

.result-title {
  font-size: 22px;
  font-weight: 800;
  margin-bottom: 4px;
}

.result-title.win {
  color: var(--accent-green);
}

.result-title.loss {
  color: var(--accent-red);
}

.result-subtitle {
  font-size: 13px;
  color: #999;
  margin-bottom: 20px;
}

.result-details {
  width: 100%;
  background: #f8f8f8;
  border-radius: 14px;
  padding: 16px;
  margin-bottom: 20px;
}

.result-row {
  display: flex;
  justify-content: space-between;
  padding: 8px 0;
  border-bottom: 1px solid #eee;
  font-size: 13px;
}

.result-row:last-child {
  border-bottom: none;
}

.result-row .r-label {
  color: #999;
}

.result-row .r-value {
  font-weight: 700;
  color: #1a1a2e;
}

.result-row .r-value.profit {
  color: var(--accent-green);
}

.result-row .r-value.loss {
  color: var(--accent-red);
}

.result-btn {
  width: 100%;
  padding: 14px;
  border-radius: 14px;
  border: none;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  color: #fff;
}

.result-btn.win {
  background: var(--accent-green);
}

.result-btn.loss {
  background: var(--accent-red);
}

/* Trade History Tabs */
.history-section {
  padding: 0 16px 16px;
}

.history-tabs {
  display: flex;
  gap: 0;
  margin-bottom: 12px;
  border-bottom: 2px solid var(--border-color);
}

.history-tab {
  padding: 10px 20px;
  font-size: 14px;
  font-weight: 600;
  color: var(--text-secondary);
  cursor: pointer;
  border: none;
  background: none;
  transition: all 0.2s;
  position: relative;
}

.history-tab.active {
  color: var(--accent-yellow);
}

.history-tab.active::after {
  content: '';
  position: absolute;
  bottom: -2px;
  left: 0;
  right: 0;
  height: 2px;
  background: var(--accent-yellow);
}

/* history list */
.history-list {
  max-height: 400px;
  overflow-y: auto;
}

.history-item {
  display: flex;
  gap: 12px;
  padding: 14px;
  background: var(--bg-secondary);
  border-radius: 12px;
  margin-bottom: 8px;
  border: 1px solid var(--border-color);
}

.hi-dir {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 13px;
  flex-shrink: 0;
}

.hi-dir.up {
  background: rgba(14, 203, 129, 0.15);
  color: var(--accent-green);
}

.hi-dir.down {
  background: rgba(246, 70, 93, 0.15);
  color: var(--accent-red);
}

.hi-info {
  flex: 1;
  min-width: 0;
}

.hi-pair {
  font-weight: 700;
  font-size: 14px;
}

.hi-date {
  font-size: 11px;
  color: var(--text-tertiary);
  margin-top: 2px;
}

.hi-meta {
  display: flex;
  gap: 12px;
  font-size: 11px;
  color: var(--text-secondary);
  margin-top: 4px;
}

.hi-right {
  text-align: right;
  flex-shrink: 0;
}

.hi-pl {
  font-weight: 700;
  font-size: 14px;
}

.hi-pl.win {
  color: var(--accent-green);
}

.hi-pl.lose {
  color: var(--accent-red);
}

.hi-status {
  font-size: 11px;
  margin-top: 2px;
}

.hi-status.active {
  color: var(--accent-yellow);
}

.hi-status.closed {
  color: var(--text-tertiary);
}

.hi-countdown {
  font-size: 12px;
  color: var(--accent-yellow);
  font-weight: 600;
  margin-top: 2px;
}

.empty-history {
  text-align: center;
  padding: 40px 20px;
  color: var(--text-tertiary);
}

.empty-history i {
  font-size: 36px;
  margin-bottom: 12px;
  display: block;
  color: var(--text-tertiary);
  opacity: 0.4;
}

/* Toast */
.toast-msg {
  position: fixed;
  top: 20px;
  left: 50%;
  transform: translateX(-50%);
  padding: 12px 24px;
  border-radius: 12px;
  z-index: 9999;
  font-size: 14px;
  font-weight: 600;
  animation: fadeInToast 0.3s ease;
}

.toast-msg.success {
  background: var(--accent-green);
  color: #fff;
}

.toast-msg.error {
  background: var(--accent-red);
  color: #fff;
}

@keyframes fadeInToast {
  from {
    opacity: 0;
    transform: translateX(-50%) translateY(-10px);
  }

  to {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
  }
}

/* Scrollbar */
::-webkit-scrollbar {
  width: 4px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: var(--border-color);
  border-radius: 4px;
}

.inline-style-389affa9f9 {
  background: rgba(240, 185, 11, 0.18);
  color: var(--accent-yellow);
  border-color: var(--accent-yellow);
  font-weight: 700;
}

.inline-style-ea7a82ba86 {
  font-size: 36px;
  opacity: 0.3;
}