/* ============================================================
   CryptoPingAi.ai — Binance-style Dark Theme Trading UI
   ============================================================ */

/* ── CSS Variables ── */
:root {
  --bg-primary:    #0B0E11;
  --bg-secondary:  #1E2026;
  --bg-tertiary:   #2B2F36;
  --bg-hover:      #2B3139;

  --text-primary:  #EAECEF;
  --text-secondary:#848E9C;
  --text-disabled: #474D57;

  --color-buy:     #0ECB81;
  --color-sell:    #F6465D;
  --color-buy-bg:  rgba(14,203,129,0.1);
  --color-sell-bg: rgba(246,70,93,0.1);

  --color-yellow:  #F0B90B;
  --color-tp:      #0ECB81;
  --color-sl:      #F6465D;
  --color-liq:     #FF4D4D;

  --border:        #2B2F36;
  --border-light:  #383F48;

  --font-mono: 'IBM Plex Mono', monospace;
  --font-ui:   'Inter', -apple-system, sans-serif;

  --radius-sm: 4px;
  --radius-md: 8px;

  --header-h:       0px; /* old t-header removed */
  --coin-list-w:    180px;
  --order-panel-w:  280px;
  --bottom-h:       200px;
  --mobile-tab-h:   48px;
  --disclaimer-h:   24px;
}

/* ── Base Reset ── */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

/* ── Body ── */
body {
  background-color: var(--bg-primary);
  color: var(--text-primary);
  font-family: var(--font-ui);
  font-size: 13px;
  overflow: hidden;
}

/* ============================================================
   HEADER
   ============================================================ */
.t-header { display: none !important;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: var(--header-h);
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  z-index: 100;
  padding: 0 16px;
}

.t-header-left {
  display: flex;
  align-items: center;
  gap: 20px;
}

.t-header-right {
  display: flex;
  align-items: center;
  gap: 16px;
}

.t-logo img {
  height: 28px;
  display: block;
}

/* Ticker */
.t-ticker {
  display: flex;
  align-items: baseline;
  gap: 8px;
}

.t-ticker-sym {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
}

.t-ticker-price {
  font-family: var(--font-mono);
  font-size: 20px;
  font-weight: 700;
  color: var(--text-primary);
}

.t-ticker-chg {
  font-family: var(--font-mono);
  font-size: 13px;
}

.t-ticker-chg.positive,
.positive { color: var(--color-buy); }

.t-ticker-chg.negative,
.negative { color: var(--color-sell); }

/* Balance */
.t-bal-label {
  color: var(--text-secondary);
  font-size: 12px;
}

.t-bal-val {
  font-family: var(--font-mono);
  color: var(--color-yellow);
  font-weight: 700;
  font-size: 14px;
}

/* Header buttons */
.t-header-btn {
  background: transparent;
  border: 1px solid var(--border-light);
  color: var(--text-primary);
  font-family: var(--font-ui);
  font-size: 13px;
  padding: 6px 14px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background 0.15s;
}

.t-header-btn:hover {
  background: var(--bg-hover);
}

.t-header-btn.primary {
  background: var(--color-yellow);
  border-color: var(--color-yellow);
  color: #000;
  font-weight: 600;
}

.t-header-btn.primary:hover {
  background: #d4a20a;
}

/* ============================================================
   MAIN LAYOUT
   ============================================================ */
.t-layout {
  display: flex;
  /* new layout: nav + trade-bar are sticky, content fills remaining */
  height: calc(100vh - 54px - 50px - var(--disclaimer-h));
  margin-top: 0;
}

/* ============================================================
   COIN LIST
   ============================================================ */
.t-coin-list {
  width: var(--coin-list-w);
  min-width: var(--coin-list-w);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: var(--bg-secondary);
}

.t-search {
  padding: 8px;
  border-bottom: 1px solid var(--border);
}

.t-search input {
  width: 100%;
  background: var(--bg-tertiary);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-family: var(--font-ui);
  font-size: 12px;
  padding: 6px 8px;
  outline: none;
  transition: border-color 0.15s;
}

.t-search input::placeholder {
  color: var(--text-disabled);
}

.t-search input:focus {
  border-color: var(--color-yellow);
}

.t-coin-list-inner {
  overflow-y: auto;
  flex: 1;
}

.t-coin-list-inner::-webkit-scrollbar { width: 4px; }
.t-coin-list-inner::-webkit-scrollbar-track { background: transparent; }
.t-coin-list-inner::-webkit-scrollbar-thumb { background: var(--border-light); border-radius: 2px; }

.t-ci {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 10px;
  cursor: pointer;
  border-bottom: 1px solid var(--border);
  transition: background 0.12s;
}

.t-ci:hover {
  background: var(--bg-hover);
}

.t-ci.active {
  background: var(--bg-tertiary);
  border-left: 2px solid var(--color-yellow);
}

.t-ci-sym {
  font-weight: 600;
  font-size: 12px;
  color: var(--text-primary);
}

.t-ci-sub {
  font-size: 11px;
  color: var(--text-secondary);
  margin-top: 2px;
}

.t-ci-right {
  text-align: right;
}

.t-ci-price {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--text-primary);
}

.t-ci-chg {
  font-family: var(--font-mono);
  font-size: 11px;
  margin-top: 2px;
}

/* ============================================================
   CHART AREA
   ============================================================ */
.t-chart-area {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
  overflow: hidden;
}

.t-chart-ctrl {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 12px;
  height: 36px;
  border-bottom: 1px solid var(--border);
  background: var(--bg-secondary);
  flex-shrink: 0;
}

.t-tfs,
.t-cts {
  display: flex;
  align-items: center;
  gap: 2px;
}

.t-ctrl-sep {
  width: 1px;
  height: 16px;
  background: var(--border-light);
}

.t-tf,
.t-ct {
  background: transparent;
  border: none;
  color: var(--text-secondary);
  font-family: var(--font-ui);
  font-size: 12px;
  padding: 4px 8px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: color 0.12s, background 0.12s;
  white-space: nowrap;
}

.t-tf:hover,
.t-ct:hover {
  color: var(--text-primary);
  background: var(--bg-hover);
}

.t-tf.active,
.t-ct.active {
  color: var(--color-yellow);
  background: rgba(240,185,11,0.1);
  font-weight: 600;
}

.t-chart {
  flex: 1;
  position: relative;
  overflow: hidden;
  background: var(--bg-primary);
}

#tv-chart {
  width: 100%;
  height: 100%;
}

/* ============================================================
   BOTTOM PANEL
   ============================================================ */
.t-bottom {
  height: var(--bottom-h);
  border-top: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  background: var(--bg-secondary);
  flex-shrink: 0;
}

.t-btabs {
  display: flex;
  align-items: center;
  height: 36px;
  border-bottom: 1px solid var(--border);
  padding: 0 12px;
  gap: 4px;
  flex-shrink: 0;
}

.t-btab {
  background: transparent;
  border: none;
  border-bottom: 2px solid transparent;
  color: var(--text-secondary);
  font-family: var(--font-ui);
  font-size: 12px;
  padding: 6px 10px;
  cursor: pointer;
  transition: color 0.12s, border-color 0.12s;
  display: flex;
  align-items: center;
  gap: 6px;
  height: 100%;
}

.t-btab:hover {
  color: var(--text-primary);
}

.t-btab.active {
  color: var(--color-yellow);
  border-bottom-color: var(--color-yellow);
}

.t-badge {
  background: var(--color-yellow);
  color: #000;
  font-size: 10px;
  font-weight: 700;
  padding: 1px 5px;
  border-radius: 8px;
  min-width: 16px;
  text-align: center;
}

.t-bottom-body {
  flex: 1;
  overflow: hidden;
  position: relative;
}

.t-bpanel {
  display: none;
  height: 100%;
  overflow-y: auto;
}

.t-bpanel::-webkit-scrollbar { width: 4px; }
.t-bpanel::-webkit-scrollbar-track { background: transparent; }
.t-bpanel::-webkit-scrollbar-thumb { background: var(--border-light); border-radius: 2px; }

.t-bpanel.active {
  display: block;
}

/* ============================================================
   POSITION TABLE
   ============================================================ */
.t-pos-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 12px;
}

.t-close-all {
  background: transparent;
  border: 1px solid var(--color-sell);
  color: var(--color-sell);
  font-family: var(--font-ui);
  font-size: 11px;
  padding: 4px 10px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background 0.12s;
}

.t-close-all:hover {
  background: var(--color-sell-bg);
}

.t-pos-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
}

.t-pos-table th {
  text-align: left;
  color: var(--text-secondary);
  font-weight: 500;
  padding: 6px 12px;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
  position: sticky;
  top: 0;
  background: var(--bg-secondary);
  z-index: 1;
}

.t-pos-table td {
  padding: 8px 12px;
  border-bottom: 1px solid var(--border);
  font-family: var(--font-mono);
  white-space: nowrap;
}

.t-pos-table tr:hover td {
  background: var(--bg-hover);
}

.pos-long  { color: var(--color-buy); font-weight: 600; }
.pos-short { color: var(--color-sell); font-weight: 600; }

.pnl-pos { color: var(--color-buy);  font-weight: 600; }
.pnl-neg { color: var(--color-sell); font-weight: 600; }

.pos-liq { color: var(--color-liq); }
.pos-tp  { color: var(--color-tp);  }
.pos-sl  { color: var(--color-sl);  }

.t-close-pos-btn {
  background: transparent;
  border: 1px solid var(--border-light);
  color: var(--text-secondary);
  font-family: var(--font-ui);
  font-size: 11px;
  padding: 3px 8px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: border-color 0.12s, color 0.12s;
}

.t-close-pos-btn:hover {
  border-color: var(--color-sell);
  color: var(--color-sell);
}

/* Empty state */
.t-empty-state {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100%;
  color: var(--text-disabled);
  font-size: 12px;
}

/* ============================================================
   ORDER PANEL
   ============================================================ */
.t-order-panel {
  width: var(--order-panel-w);
  min-width: var(--order-panel-w);
  border-left: 1px solid var(--border);
  overflow-y: auto;
  background: var(--bg-secondary);
}

.t-order-panel::-webkit-scrollbar { width: 4px; }
.t-order-panel::-webkit-scrollbar-track { background: transparent; }
.t-order-panel::-webkit-scrollbar-thumb { background: var(--border-light); border-radius: 2px; }

.t-order-inner {
  padding: 12px;
}

/* Long/Short Tabs */
.t-otabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0;
  border-radius: var(--radius-sm);
  overflow: hidden;
  border: 1px solid var(--border-light);
  margin-bottom: 12px;
}

.t-otab {
  background: transparent;
  border: none;
  font-family: var(--font-ui);
  font-size: 13px;
  font-weight: 600;
  padding: 8px;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
  color: var(--text-secondary);
}

.t-otab.long {
  border-right: 1px solid var(--border-light);
}

.t-otab.long:hover {
  background: var(--color-buy-bg);
  color: var(--color-buy);
}

.t-otab.long.active {
  background: var(--color-buy-bg);
  color: var(--color-buy);
}

.t-otab.short:hover {
  background: var(--color-sell-bg);
  color: var(--color-sell);
}

.t-otab.short.active {
  background: var(--color-sell-bg);
  color: var(--color-sell);
}

/* Leverage */
.t-lev-sec {
  margin-bottom: 4px;
}

.t-slabel {
  color: var(--text-secondary);
  font-size: 11px;
  margin-bottom: 3px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.t-lev-val {
  font-family: var(--font-mono);
  color: var(--color-yellow);
  font-weight: 700;
  font-size: 13px;
}

.t-lev-btns {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
  margin-bottom: 4px;
}

.t-lb {
  background: var(--bg-tertiary);
  border: 1px solid var(--border-light);
  color: var(--text-secondary);
  font-family: var(--font-mono);
  font-size: 11px;
  padding: 3px 7px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background 0.12s, border-color 0.12s, color 0.12s;
}

.t-lb:hover {
  border-color: var(--color-yellow);
  color: var(--color-yellow);
}

.t-lb.active {
  background: rgba(240,185,11,0.15);
  border-color: var(--color-yellow);
  color: var(--color-yellow);
  font-weight: 600;
}

.t-lb.locked {
  opacity: 0.35;
  cursor: not-allowed;
  pointer-events: none;
}

.t-lev-slider {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 4px;
  border-radius: 2px;
  background: var(--border-light);
  outline: none;
  cursor: pointer;
}

.t-lev-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--color-yellow);
  cursor: pointer;
  border: 2px solid var(--bg-secondary);
  box-shadow: 0 0 0 1px var(--color-yellow);
}

.t-lev-slider::-moz-range-thumb {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--color-yellow);
  cursor: pointer;
  border: 2px solid var(--bg-secondary);
}

/* Amount Input */
.t-amt-sec {
  margin-bottom: 10px;
}

.t-amt-wrap {
  display: flex;
  align-items: center;
  background: var(--bg-tertiary);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-sm);
  overflow: hidden;
  transition: border-color 0.15s;
}

.t-amt-wrap:focus-within {
  border-color: var(--color-yellow);
}

.t-amt-input {
  flex: 1;
  background: transparent;
  border: none;
  color: var(--text-primary);
  font-family: var(--font-mono);
  font-size: 15px;
  padding: 8px 10px;
  outline: none;
  min-width: 0;
}

.t-amt-input::placeholder {
  color: var(--text-disabled);
  font-size: 13px;
}

.t-amt-unit {
  padding: 0 10px;
  color: var(--text-secondary);
  font-size: 12px;
  font-weight: 600;
  border-left: 1px solid var(--border-light);
  white-space: nowrap;
}

.t-pcts {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 4px;
  margin-top: 6px;
}

.t-pct {
  background: var(--bg-tertiary);
  border: 1px solid var(--border-light);
  color: var(--text-secondary);
  font-family: var(--font-ui);
  font-size: 11px;
  padding: 4px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  text-align: center;
  transition: background 0.12s, border-color 0.12s, color 0.12s;
}

.t-pct:hover {
  border-color: var(--color-yellow);
  color: var(--color-yellow);
  background: rgba(240,185,11,0.08);
}

/* TP/SL Section */
.t-tpsl-sec {
  border: 1px solid var(--border-light);
  border-radius: var(--radius-sm);
  margin-bottom: 10px;
  overflow: hidden;
}

.t-tpsl-header {
  background: var(--bg-tertiary);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 7px 10px;
  cursor: pointer;
}

.t-tpsl-title {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
}

.t-tpsl-body {
  padding: 10px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.t-tpsl-row {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.t-tpsl-label {
  font-size: 11px;
  font-weight: 600;
}

.t-tpsl-label.tp { color: var(--color-tp); }
.t-tpsl-label.sl { color: var(--color-sl); }

.t-tpsl-inputs {
  display: flex;
  gap: 6px;
  align-items: center;
}

.t-tpsl-input-wrap {
  display: flex;
  align-items: center;
  flex: 1;
  background: var(--bg-tertiary);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-sm);
  overflow: hidden;
  transition: border-color 0.15s;
}

.t-tpsl-input-wrap:focus-within {
  border-color: var(--color-yellow);
}

.t-tpsl-prefix {
  padding: 0 8px;
  font-size: 11px;
  color: var(--text-disabled);
  border-right: 1px solid var(--border-light);
  white-space: nowrap;
  line-height: 28px;
}

.t-tpsl-input {
  flex: 1;
  background: transparent;
  border: none;
  color: var(--text-primary);
  font-family: var(--font-mono);
  font-size: 12px;
  padding: 5px 8px;
  outline: none;
  min-width: 0;
}

.t-tpsl-pct-wrap {
  width: 64px;
  display: flex;
  align-items: center;
  background: var(--bg-tertiary);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-sm);
  overflow: hidden;
  transition: border-color 0.15s;
}

.t-tpsl-pct-wrap:focus-within {
  border-color: var(--color-yellow);
}

.t-tpsl-pct {
  flex: 1;
  background: transparent;
  border: none;
  color: var(--text-primary);
  font-family: var(--font-mono);
  font-size: 12px;
  padding: 5px 6px;
  outline: none;
  width: 100%;
  min-width: 0;
}

.t-tpsl-pct-unit {
  padding: 0 5px;
  font-size: 10px;
  color: var(--text-disabled);
}

.t-tpsl-error {
  color: var(--color-sell);
  font-size: 11px;
  min-height: 14px;
}

/* Toggle Switch */
.t-toggle-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
}

.t-toggle-label {
  font-size: 12px;
  color: var(--text-secondary);
}

.t-toggle {
  position: relative;
  display: inline-block;
  width: 36px;
  height: 20px;
  flex-shrink: 0;
}

.t-toggle input {
  opacity: 0;
  width: 0;
  height: 0;
  position: absolute;
}

.t-toggle-slider {
  position: absolute;
  inset: 0;
  background: var(--bg-tertiary);
  border: 1px solid var(--border-light);
  border-radius: 10px;
  cursor: pointer;
  transition: background 0.2s, border-color 0.2s;
}

.t-toggle-slider::before {
  content: '';
  position: absolute;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--text-secondary);
  top: 2px;
  left: 2px;
  transition: transform 0.2s, background 0.2s;
}

.t-toggle input:checked + .t-toggle-slider {
  background: rgba(240,185,11,0.2);
  border-color: var(--color-yellow);
}

.t-toggle input:checked + .t-toggle-slider::before {
  transform: translateX(16px);
  background: var(--color-yellow);
}

/* Order Info */
.t-oinfo {
  background: var(--bg-tertiary);
  border-radius: var(--radius-sm);
  padding: 8px 10px;
  margin-bottom: 10px;
}

.t-oi-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 3px 0;
  font-size: 11px;
}

.t-oi-row span:first-child {
  color: var(--text-secondary);
}

.t-oi-row span:last-child {
  font-family: var(--font-mono);
  color: var(--text-primary);
}

.t-oi-liq span:last-child {
  color: var(--color-liq);
}

/* Submit Button */
.t-submit {
  width: 100%;
  padding: 12px;
  border: none;
  border-radius: var(--radius-sm);
  font-family: var(--font-ui);
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  transition: opacity 0.15s, box-shadow 0.15s;
  letter-spacing: 0.3px;
}

.t-submit:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.long-btn {
  background: var(--color-buy);
  color: #000;
}

.long-btn:not(:disabled):hover {
  opacity: 0.88;
  box-shadow: 0 4px 16px rgba(14,203,129,0.35);
}

.short-btn {
  background: var(--color-sell);
  color: #fff;
}

.short-btn:not(:disabled):hover {
  opacity: 0.88;
  box-shadow: 0 4px 16px rgba(246,70,93,0.35);
}

/* ============================================================
   RANKING
   ============================================================ */
.t-ri {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  border-bottom: 1px solid var(--border);
  transition: background 0.12s;
}

.t-ri:hover {
  background: var(--bg-hover);
}

.t-ri.my {
  background: rgba(240,185,11,0.06);
  border-left: 2px solid var(--color-yellow);
}

.t-ri-num {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--text-secondary);
  min-width: 20px;
  text-align: center;
}

.t-ri-num.gold   { color: #FFD700; font-weight: 700; }
.t-ri-num.silver { color: #C0C0C0; font-weight: 700; }
.t-ri-num.bronze { color: #CD7F32; font-weight: 700; }

.t-ri-flag {
  font-size: 16px;
}

.t-ri-name {
  flex: 1;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-primary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.t-ri-pnl {
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 600;
}

/* ============================================================
   MODALS & OVERLAY
   ============================================================ */
.t-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.7);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

.t-overlay.hidden {
  display: none;
}

.t-modal {
  background: var(--bg-secondary);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  width: 100%;
  max-width: 480px;
  max-height: 90vh;
  overflow-y: auto;
  padding: 24px;
  position: relative;
}

.t-modal::-webkit-scrollbar { width: 4px; }
.t-modal::-webkit-scrollbar-track { background: transparent; }
.t-modal::-webkit-scrollbar-thumb { background: var(--border-light); border-radius: 2px; }

.t-modal-title {
  font-size: 18px;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 4px;
}

.t-modal-sub {
  font-size: 13px;
  color: var(--text-secondary);
  margin-bottom: 20px;
}

.t-modal-close {
  position: absolute;
  top: 16px;
  right: 16px;
  background: transparent;
  border: none;
  color: var(--text-secondary);
  font-size: 18px;
  cursor: pointer;
  line-height: 1;
  padding: 4px;
}

.t-modal-close:hover {
  color: var(--text-primary);
}

/* Compare / Country grid */
.t-compare {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 16px;
}

.t-ccard {
  background: var(--bg-tertiary);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-sm);
  padding: 14px;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
  text-align: center;
}

.t-ccard:hover {
  border-color: var(--border-light);
  background: var(--bg-hover);
}

.t-ccard.featured,
.t-ccard.active {
  border-color: var(--color-yellow);
  background: rgba(240,185,11,0.06);
}

.t-cbadge {
  display: inline-block;
  background: var(--color-yellow);
  color: #000;
  font-size: 10px;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 8px;
  margin-bottom: 8px;
}

/* Country buttons */
.t-countries-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
  margin-bottom: 16px;
  max-height: 200px;
  overflow-y: auto;
}

.t-countries-grid::-webkit-scrollbar { width: 4px; }
.t-countries-grid::-webkit-scrollbar-track { background: transparent; }
.t-countries-grid::-webkit-scrollbar-thumb { background: var(--border-light); border-radius: 2px; }

.t-cbtn {
  background: var(--bg-tertiary);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-family: var(--font-ui);
  font-size: 11px;
  padding: 6px 4px;
  cursor: pointer;
  text-align: center;
  transition: border-color 0.12s, background 0.12s;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
}

.t-cbtn:hover {
  border-color: var(--color-yellow);
  background: rgba(240,185,11,0.06);
}

.t-cbtn.active {
  border-color: var(--color-yellow);
  background: rgba(240,185,11,0.12);
  color: var(--color-yellow);
}

.t-cbtn-flag {
  font-size: 18px;
  line-height: 1;
}

/* Form elements */
.t-form-group {
  margin-bottom: 14px;
}

.t-form-label {
  display: block;
  font-size: 12px;
  color: var(--text-secondary);
  margin-bottom: 6px;
}

.t-form-input {
  width: 100%;
  background: var(--bg-tertiary);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-family: var(--font-ui);
  font-size: 14px;
  padding: 10px 12px;
  outline: none;
  transition: border-color 0.15s;
}

.t-form-input::placeholder {
  color: var(--text-disabled);
}

.t-form-input:focus {
  border-color: var(--color-yellow);
}

.t-nick-status {
  font-size: 11px;
  margin-top: 4px;
  min-height: 16px;
}

.t-modal-btn {
  width: 100%;
  padding: 12px;
  border: none;
  border-radius: var(--radius-sm);
  font-family: var(--font-ui);
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  transition: opacity 0.15s;
  background: var(--color-yellow);
  color: #000;
  margin-top: 8px;
}

.t-modal-btn:hover {
  opacity: 0.88;
}

.t-modal-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.t-modal-btn.secondary {
  background: transparent;
  border: 1px solid var(--border-light);
  color: var(--text-secondary);
}

.t-modal-btn.secondary:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}

/* ============================================================
   TOAST
   ============================================================ */
.t-toast {
  position: fixed;
  bottom: calc(var(--disclaimer-h) + 16px);
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: var(--bg-tertiary);
  border: 1px solid var(--border-light);
  color: var(--text-primary);
  font-size: 13px;
  padding: 10px 20px;
  border-radius: var(--radius-md);
  z-index: 500;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s, transform 0.2s;
  box-shadow: 0 4px 20px rgba(0,0,0,0.4);
}

.t-toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

.t-toast.success {
  border-color: var(--color-buy);
  color: var(--color-buy);
}

.t-toast.error {
  border-color: var(--color-sell);
  color: var(--color-sell);
}

/* ============================================================
   DISCLAIMER
   ============================================================ */
.t-disclaimer {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: var(--disclaimer-h);
  background: var(--bg-secondary);
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 90;
  font-size: 11px;
  color: var(--text-disabled);
  text-align: center;
  padding: 0 16px;
}

/* ============================================================
   MOBILE
   ============================================================ */

/* Horizontal coin scroll bar (below header on mobile) */
.mob-coin-scroll {
  position: fixed;
  top: var(--header-h);
  left: 0;
  right: 0;
  height: 40px;
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border);
  display: none;
  overflow-x: auto;
  overflow-y: hidden;
  z-index: 80;
  -webkit-overflow-scrolling: touch;
  align-items: center;
  gap: 4px;
  padding: 0 8px;
}

.mob-coin-scroll::-webkit-scrollbar { display: none; }

.mob-cb {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  background: var(--bg-tertiary);
  border: 1px solid var(--border-light);
  border-radius: 16px;
  white-space: nowrap;
  cursor: pointer;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
  transition: border-color 0.12s, color 0.12s;
  flex-shrink: 0;
}

.mob-cb.active {
  border-color: var(--color-yellow);
  color: var(--color-yellow);
}

/* Mobile tab contents */
.mob-tab-contents {
  display: none;
}

.mob-tc {
  display: none;
}

.mob-tc.active {
  display: block;
}

/* Mobile bottom nav */
.mob-nav {
  position: fixed;
  bottom: var(--disclaimer-h);
  left: 0;
  right: 0;
  height: var(--mobile-tab-h);
  background: var(--bg-secondary);
  border-top: 1px solid var(--border);
  display: none;
  grid-template-columns: repeat(4, 1fr);
  z-index: 90;
}

.mob-tab {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  background: transparent;
  border: none;
  color: var(--text-secondary);
  font-family: var(--font-ui);
  font-size: 10px;
  cursor: pointer;
  transition: color 0.12s;
  padding: 4px;
}

.mob-tab:hover,
.mob-tab.active {
  color: var(--color-yellow);
}

.mob-tab-icon {
  font-size: 18px;
  line-height: 1;
}

/* Mobile chart container */
.mob-chart-wrap {
  height: 300px;
  position: relative;
}

/* ============================================================
   FLASH ANIMATIONS
   ============================================================ */
@keyframes fUp {
  0%   { background-color: rgba(14,203,129,0.25); }
  100% { background-color: transparent; }
}

@keyframes fDown {
  0%   { background-color: rgba(246,70,93,0.25); }
  100% { background-color: transparent; }
}

.flash-up {
  animation: fUp 0.6s ease-out;
}

.flash-down {
  animation: fDown 0.6s ease-out;
}

/* ============================================================
   PC / MOBILE VISIBILITY
   ============================================================ */
.pc-only  { display: block; }
.mob-only { display: none;  }

/* ============================================================
   RESPONSIVE — Mobile (max-width: 1023px)
   ============================================================ */
@media (max-width: 1023px) {
  body {
    overflow: auto;
  }

  .t-layout {
    display: block;
    height: auto;
    margin-top: 0; /* nav + trade-bar are sticky, mob-coin-scroll is in flow */
    margin-bottom: calc(var(--mobile-tab-h) + var(--disclaimer-h));
  }

  /* Hide PC-only elements */
  .pc-only {
    display: none !important;
  }

  /* Show mobile-only elements */
  .mob-only {
    display: block !important;
  }

  .mob-coin-scroll {
    display: flex;
  }

  .mob-nav {
    display: grid;
  }

  .mob-tab-contents {
    display: block;
  }

  /* Chart gets fixed height on mobile */
  .t-chart-area {
    height: auto;
  }

  /* ID selector required to override #tv-chart{height:100%} from desktop */
  #tv-chart, .t-chart {
    height: 300px !important;
    flex: none;
  }

  /* Full width panels on mobile */
  .t-order-panel {
    width: 100%;
    min-width: unset;
    border-left: none;
    border-top: 1px solid var(--border);
  }

  .t-coin-list {
    display: none;
  }

  .t-bottom {
    height: auto;
    min-height: 180px;
  }

  /* Modal full width on mobile */
  .t-modal {
    max-width: 100%;
    margin: 0;
  }

  .t-compare {
    grid-template-columns: 1fr;
  }

  .t-toast {
    bottom: calc(var(--mobile-tab-h) + var(--disclaimer-h) + 8px);
    font-size: 12px;
    padding: 8px 16px;
  }
}

/* ============================================================
   SCROLLBAR GLOBAL
   ============================================================ */
::-webkit-scrollbar { width: 4px; height: 4px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border-light); border-radius: 2px; }

/* ============================================================
   UTILITY
   ============================================================ */
.hidden { display: none !important; }

.text-mono { font-family: var(--font-mono); }
.text-sm   { font-size: 11px; }
.text-xs   { font-size: 10px; }
.text-secondary { color: var(--text-secondary); }
.text-yellow    { color: var(--color-yellow); }
.text-buy       { color: var(--color-buy); }
.text-sell      { color: var(--color-sell); }

/* ============================================================
   MODAL MISSING CLASSES (HTML shorthand aliases)
   ============================================================ */

#modal-onboard .t-modal { max-width: 560px; }

.t-msub {
  font-size: 13px;
  color: var(--text-secondary);
  margin-bottom: 20px;
  margin-top: 4px;
}

.t-ctitle {
  font-size: 16px;
  font-weight: 700;
  margin-bottom: 10px;
  color: var(--text-primary);
}

.t-ccard ul {
  list-style: none;
  padding: 0;
  margin: 0 0 14px 0;
  text-align: left;
  font-size: 12px;
  color: var(--text-secondary);
  line-height: 1.8;
}
.t-ccard ul li::before { content: '• '; color: var(--text-disabled); }

.t-btn-pri {
  width: 100%;
  padding: 11px;
  border: none;
  border-radius: var(--radius-sm);
  font-family: var(--font-ui);
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  transition: opacity 0.15s;
  background: var(--color-yellow);
  color: #000;
  margin-top: 6px;
  display: block;
  box-sizing: border-box;
}
.t-btn-pri:hover { opacity: 0.88; }
.t-btn-pri:disabled { opacity: 0.4; cursor: not-allowed; }

.t-btn-sec {
  width: 100%;
  padding: 11px;
  border: 1px solid var(--border-light);
  border-radius: var(--radius-sm);
  font-family: var(--font-ui);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s;
  background: transparent;
  color: var(--text-secondary);
  margin-top: 6px;
  display: block;
  box-sizing: border-box;
}
.t-btn-sec:hover { background: var(--bg-hover); color: var(--text-primary); }

.t-fg { margin-bottom: 14px; }
.t-fg label {
  display: block;
  font-size: 12px;
  color: var(--text-secondary);
  margin-bottom: 6px;
}
.t-fg input {
  width: 100%;
  box-sizing: border-box;
  background: var(--bg-tertiary);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-family: var(--font-ui);
  font-size: 14px;
  padding: 10px 12px;
  outline: none;
  transition: border-color 0.15s;
}
.t-fg input::placeholder { color: var(--text-disabled); }
.t-fg input:focus { border-color: var(--color-yellow); }

.t-countries {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
  margin-top: 8px;
  margin-bottom: 8px;
  max-height: 200px;
  overflow-y: auto;
}
.t-countries::-webkit-scrollbar { width: 4px; }
.t-countries::-webkit-scrollbar-thumb { background: var(--border-light); border-radius: 2px; }

.t-preview {
  background: var(--bg-tertiary);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  font-size: 15px;
  font-weight: 700;
  color: var(--color-yellow);
  text-align: center;
  margin-bottom: 12px;
}

.t-upsell {
  background: var(--bg-tertiary);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-sm);
  padding: 12px 16px;
  margin-bottom: 12px;
}
.t-upsell ul {
  list-style: none;
  padding: 0;
  margin: 0;
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 2;
}

.t-liq-ico { font-size: 48px; text-align: center; margin-bottom: 8px; }
.t-countdown { text-align: center; color: var(--text-secondary); font-size: 13px; margin-bottom: 16px; }
.t-countdown span {
  display: block;
  font-size: 28px;
  font-family: var(--font-mono);
  font-weight: 700;
  color: var(--color-sell);
  margin-top: 4px;
}

@media (min-width: 769px) {
  .t-overlay { align-items: center; padding: 24px; }
  .t-modal { max-height: 85vh; }
  #modal-onboard .t-modal { max-width: 560px; }
  #modal-profile .t-modal { max-width: 440px; }
}


/* ============================================================
   실시간 시세 배너 (Binance 스타일)
   ============================================================ */
.t-live-price {
  background: linear-gradient(180deg, rgba(245,158,11,.06), rgba(245,158,11,.02));
  border: 1px solid rgba(245,158,11,.18);
  border-radius: 8px;
  padding: 10px 12px;
  margin: 0 12px 10px;
}
.t-lp-label {
  font-size: 10px;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: .5px;
  font-weight: 600;
  margin-bottom: 4px;
}
.t-lp-value {
  display: flex;
  align-items: baseline;
  gap: 8px;
  flex-wrap: wrap;
}
.t-lp-symbol {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
}
.t-lp-num {
  font-size: 20px;
  font-weight: 800;
  color: var(--text-primary);
  font-family: 'IBM Plex Mono', monospace;
  letter-spacing: -.4px;
}
.t-lp-chg {
  font-size: 12px;
  font-weight: 600;
  margin-left: auto;
}
.t-lp-chg.up { color: #22c55e; }
.t-lp-chg.down { color: #ef4444; }

/* ============================================================
   호가창 (Order Book)
   ============================================================ */
.t-orderbook {
  margin: 0 12px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
  background: var(--bg-secondary);
}
.t-ob-header {
  display: flex;
  justify-content: space-between;
  padding: 6px 10px;
  font-size: 10px;
  font-weight: 700;
  color: var(--text-secondary);
  background: var(--bg-tertiary, #1a1d2a);
  text-transform: uppercase;
  letter-spacing: .4px;
}
.t-ob-asks, .t-ob-bids {
  display: flex;
  flex-direction: column;
}
.t-ob-row {
  position: relative;
  display: flex;
  justify-content: space-between;
  padding: 3px 10px;
  font-size: 11px;
  font-family: 'IBM Plex Mono', monospace;
  cursor: pointer;
  transition: background .12s;
  z-index: 1;
}
.t-ob-row:hover { background: rgba(255,255,255,.04); }
.t-ob-row.selected { background: rgba(245,158,11,.12); }
.t-ob-bar {
  position: absolute;
  right: 0;
  top: 0;
  bottom: 0;
  z-index: -1;
  opacity: .15;
}
.ask-bar { background: #ef4444; }
.bid-bar { background: #22c55e; }
.t-ob-price { font-weight: 600; }
.t-ob-row.ask .t-ob-price { color: #ef4444; }
.t-ob-row.bid .t-ob-price { color: #22c55e; }
.t-ob-vol { color: var(--text-secondary); font-size: 10px; }
.t-ob-mid {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 7px 10px;
  background: var(--bg-tertiary, #1a1d2a);
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  font-family: 'IBM Plex Mono', monospace;
  font-weight: 800;
  font-size: 14px;
  color: var(--accent-warning, #f59e0b);
}

/* ============================================================
   매수/매도 버튼 가격 표시 강화
   ============================================================ */
.t-submit { display: flex; align-items: center; justify-content: center; gap: 6px; }
.t-sb-action { font-weight: 800; font-size: 14px; }
.t-sb-price { font-size: 11px; opacity: .85; font-family: 'IBM Plex Mono', monospace; font-weight: 600; }

/* 모바일 약간 작게 */
@media (max-width: 1023px) {
  .t-lp-num { font-size: 18px; }
  .t-orderbook { margin: 0 10px 10px; }
}


/* ============================================================
   계정 요약 위젯 (잔고/PNL/포지션수)
   ============================================================ */
.cp-account-summary {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1px;
  background: #1a1d2a;
  padding: 0;
  border-bottom: 1px solid var(--border);
}
.cp-as-item {
  background: var(--bg-secondary, #161616);
  padding: 10px 14px;
  text-align: center;
}
.cp-as-label {
  font-size: 10px;
  color: var(--text-secondary, #8a8f9c);
  text-transform: uppercase;
  letter-spacing: .4px;
  font-weight: 600;
  margin-bottom: 3px;
}
.cp-as-value {
  font-size: 14px;
  font-weight: 700;
  font-family: 'IBM Plex Mono', monospace;
  color: var(--text-primary, #f0f0f0);
}
.cp-as-value.up { color: #22c55e; }
.cp-as-value.down { color: #ef4444; }

@media (max-width: 1023px) {
  .cp-account-summary { grid-template-columns: repeat(4, 1fr); }
  .cp-as-item { padding: 7px 4px; }
  .cp-as-label { font-size: 9px; }
  .cp-as-value { font-size: 12px; }
}
@media (max-width: 480px) {
  .cp-as-value { font-size: 11px; }
}


/* ============================================================
   모바일 포지션 카드 뷰
   ============================================================ */
.pos-cards-mobile {
  display: none;
  padding: 8px 12px;
}
@media (max-width: 1023px) {
  .pos-cards-mobile { display: block; }
  .t-pos-table { display: none !important; }
  .t-bottom { min-height: auto !important; }
}

.pos-card {
  border: 1px solid var(--border, #2a2a2a);
  border-radius: 8px;
  padding: 10px 12px;
  margin-bottom: 8px;
  background: var(--bg-tertiary, #1a1d2a);
}
.pos-card-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}
.pos-card-sym {
  font-weight: 800;
  font-size: 14px;
}
.pos-card-side {
  font-size: 11px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 4px;
  margin-left: 6px;
}
.pos-card-side.long { background: rgba(34,197,94,.15); color: #22c55e; }
.pos-card-side.short { background: rgba(239,68,68,.15); color: #ef4444; }
.pos-card-pnl {
  font-weight: 800;
  font-size: 14px;
  font-family: 'IBM Plex Mono', monospace;
}
.pos-card-pnl.up { color: #22c55e; }
.pos-card-pnl.down { color: #ef4444; }
.pos-card-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px 12px;
  font-size: 11px;
  margin-bottom: 8px;
}
.pos-card-grid .l { color: var(--text-secondary, #8a8f9c); }
.pos-card-grid .v { color: var(--text-primary, #f0f0f0); font-family: 'IBM Plex Mono', monospace; }
.pos-card-close {
  width: 100%;
  padding: 8px;
  background: rgba(239,68,68,.15);
  border: 1px solid rgba(239,68,68,.3);
  border-radius: 6px;
  color: #ef4444;
  font-weight: 700;
  font-size: 12px;
  cursor: pointer;
}
.pos-card-close:hover { background: rgba(239,68,68,.25); }
