/* NTP Market — light theme, trading layout (MINT/TRADE nav) */
:root {
  --bg: #f0f4ff;
  --bg2: #e8eeff;
  --card: #ffffff;
  --stroke: #d4dcf0;
  --stroke2: #b8c4e0;
  --text: #0f172a;
  --text-dim: #475569;
  --muted: #64748b;
  --muted2: #94a3b8;
  --primary: #6366f1;
  --primary-glow: rgba(99, 102, 241, 0.25);
  --buy: #22c55e;
  --buy-glow: rgba(34, 197, 94, 0.2);
  --sell: #dc2626;
  --sell-glow: rgba(220, 38, 38, 0.25);
  --accent: #ec4899;
  --bad: #ef4444;
  --mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
  --sans: ui-sans-serif, -apple-system, system-ui, "Segoe UI", Helvetica, Arial, sans-serif;
}

* { box-sizing: border-box; }
a, button, a:hover, a:focus, button:hover, button:focus { text-decoration: none; }
html, body { height: 100%; margin: 0; font-family: var(--sans); background: var(--bg); color: var(--text); }

.bg {
  position: fixed; inset: 0; pointer-events: none; z-index: -1;
  background:
    radial-gradient(ellipse 100% 60% at 0% 0%, rgba(99, 102, 241, 0.08), transparent 50%),
    radial-gradient(ellipse 80% 40% at 100% 100%, rgba(236, 72, 153, 0.06), transparent 50%),
    linear-gradient(180deg, var(--bg) 0%, var(--bg2) 100%);
}

.concept-banner {
  position: sticky; top: 0; z-index: 100;
  background: linear-gradient(90deg, rgba(99, 102, 241, 0.1), rgba(34, 197, 94, 0.06));
  border-bottom: 1px solid var(--stroke);
  color: var(--text-dim);
  font-size: 12px;
  font-weight: 600;
  text-align: center;
  padding: 8px 16px;
}

.hidden { display: none !important; }
.mono { font-family: var(--mono); }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.right { text-align: right; }

/* Connect screen */
.connect-screen {
  min-height: calc(100vh - 50px);
  display: grid;
  place-items: center;
  padding: 24px;
}
.connect-screen.hidden { display: none !important; }
.main-app.hidden { display: none !important; }
.connect-card {
  width: min(420px, 100%);
  padding: 28px;
  border-radius: 20px;
  border: 1px solid var(--stroke);
  background: var(--card);
  box-shadow: 0 20px 50px rgba(15, 23, 42, 0.08);
}
.connect-brand {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 24px;
}
.connect-logo { flex-shrink: 0; }
.connect-title { font-weight: 800; font-size: 20px; }
.connect-sub { font-size: 13px; color: var(--muted); margin-top: 2px; }
.connect-notice {
  margin-bottom: 14px;
  padding: 10px 14px;
  border-radius: 12px;
  background: rgba(239, 68, 68, 0.08);
  border: 1px solid rgba(239, 68, 68, 0.2);
  color: var(--bad);
  font-size: 13px;
}
.connect-form { display: flex; flex-direction: column; gap: 16px; }
.connect-form .field__label { font-size: 12px; font-weight: 700; color: var(--muted); margin-bottom: 6px; }
.connect-form .field__hint { font-size: 11px; color: var(--muted2); margin-top: 4px; }
.input--mono { font-family: var(--mono); }
.btn--block { width: 100%; }

/* Layout: header + tabs + content */
.app-wrap {
  display: flex;
  flex-direction: column;
  min-height: calc(100vh - 50px);
}
.topbar {
  padding: 12px 24px;
  background: var(--card);
  border-bottom: 1px solid var(--stroke);
  display: flex;
  align-items: center;
  gap: 24px;
  flex-wrap: wrap;
}
.topbar__brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 800;
  font-size: 18px;
  margin-right: 0;
  color: inherit;
}
.topbar__logo { flex-shrink: 0; }
.topbar__prices {
  display: flex;
  gap: 12px;
  margin-left: auto;
}
.topbar__price {
  display: flex;
  align-items: baseline;
  gap: 8px;
  padding: 8px 16px;
  border-radius: 12px;
  background: var(--bg2);
  border: 1px solid var(--stroke);
}
.topbar__price-label { font-size: 11px; color: var(--muted); font-weight: 700; text-transform: uppercase; }
.topbar__price-value { font-family: var(--mono); font-weight: 800; font-size: 18px; color: var(--primary); }
.topbar__price-unit { font-size: 11px; color: var(--muted); }
.topbar__wallet { font-size: 13px; }
.topbar__wallet-label { color: var(--muted); margin-right: 8px; font-size: 11px; text-transform: uppercase; }
.topbar__wallet-value { font-family: var(--mono); color: var(--text-dim); }
.topbar__tabs {
  display: flex;
  gap: 4px;
  margin-left: 24px;
}
.topbar__tab {
  padding: 8px 16px;
  border: none;
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
  font-weight: 700;
  font-size: 13px;
  cursor: pointer;
  transition: all 0.15s;
}
.topbar__tab:hover { color: var(--text); background: var(--bg2); }
.topbar__tab.active {
  color: var(--primary);
  background: rgba(99, 102, 241, 0.1);
}

.label { display: block; font-size: 11px; color: var(--muted); margin-bottom: 6px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.5px; }
.input, .select {
  width: 100%;
  padding: 10px 14px;
  border-radius: 10px;
  border: 1px solid var(--stroke);
  background: var(--card);
  color: var(--text);
  outline: none;
}
.input:focus, .select:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-glow);
}

.btn {
  appearance: none;
  border: none;
  cursor: pointer;
  padding: 10px 18px;
  border-radius: 10px;
  font-weight: 700;
  font-size: 13px;
  transition: all 0.15s ease;
}
.btn:hover { transform: translateY(-1px); }
.btn--primary {
  background: linear-gradient(135deg, var(--primary), #818cf8);
  color: #fff;
  box-shadow: 0 2px 12px var(--primary-glow);
}
.btn--primary:hover { box-shadow: 0 4px 20px var(--primary-glow); }
.btn--ghost {
  background: transparent;
  color: var(--muted);
  border: 1px solid var(--stroke);
}
.btn--ghost:hover { background: var(--bg2); color: var(--text); }
.btn--sm { padding: 6px 12px; font-size: 12px; }

.content { flex: 1; padding: 24px; overflow-auto; }
.content-head { margin-bottom: 20px; }
.h1 { font-size: 22px; font-weight: 800; margin: 0 0 8px; }
.trading-stats {
  margin-top: 12px;
  padding: 10px 16px;
  border-radius: 12px;
  background: var(--bg2);
  border: 1px solid var(--stroke);
  display: inline-flex;
  align-items: baseline;
  gap: 8px;
}
.trading-stats__label { font-size: 13px; color: var(--muted); font-weight: 600; }
.trading-stats__value { font-size: 18px; font-weight: 800; color: var(--primary); }
.trading-stats__unit { font-size: 12px; color: var(--muted); }

.stats-cards { display: flex; flex-wrap: wrap; gap: 18px; margin-bottom: 24px; }
.stat-card {
  flex: 1;
  min-width: 200px;
  padding: 24px;
  border-radius: 16px;
  border: 1px solid var(--stroke);
  background: var(--card);
  box-shadow: 0 2px 12px rgba(15, 23, 42, 0.04);
}
.stat-card__label { font-size: 12px; font-weight: 700; text-transform: uppercase; color: var(--muted); margin-bottom: 8px; }
.stat-card__value { font-size: 28px; font-weight: 800; color: var(--primary); }
.h2 {
  font-size: 12px;
  font-weight: 700;
  margin: 0 0 14px;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--muted);
}
.card-head-row { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 12px; margin-bottom: 14px; }
.card-head-row .h2 { margin: 0; }
.p { margin: 0 0 12px; color: var(--muted); line-height: 1.6; font-size: 14px; }

.card {
  background: var(--card);
  border: 1px solid var(--stroke);
  border-radius: 16px;
  padding: 22px;
  margin-bottom: 18px;
  box-shadow: 0 2px 12px rgba(15, 23, 42, 0.04);
}

.table-wrap { overflow: visible; border-radius: 12px; border: 1px solid var(--stroke); }
.table { width: 100%; border-collapse: collapse; font-size: 13px; }
.table th, .table td {
  padding: 12px 16px;
  text-align: left;
  border-bottom: 1px solid var(--stroke);
  word-break: break-word;
}
.table td.mono, .table .mono { word-break: break-all; }
.table th {
  color: var(--muted);
  font-weight: 700;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  background: var(--bg2);
}
.table tbody tr:hover { background: rgba(99, 102, 241, 0.04); }
.table tbody tr:last-child td { border-bottom: none; }
.table th.right, .table td.right { text-align: right; }
.table td.mono, .table .mono { font-family: var(--mono); }
.table .num-buy { color: var(--buy); font-weight: 700; }
.table .num-sell { color: var(--sell); font-weight: 700; }

.field { display: flex; flex-direction: column; gap: 4px; }
.mint-form__row { display: flex; flex-wrap: wrap; gap: 18px; align-items: flex-end; margin-bottom: 12px; }
.mint-form__row .field { flex: 1; min-width: 140px; }
.mint-form .mini { margin-top: 10px; font-size: 13px; color: var(--muted); }
.mint-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  margin-bottom: 16px;
}
.mint-filters .input--sm, .mint-filters .select--sm { width: auto; min-width: 120px; padding: 8px 12px; font-size: 13px; }

.trade-form__row { display: flex; flex-wrap: wrap; gap: 18px; align-items: flex-end; }
.trade-form__row .field { flex: 1; min-width: 100px; }

.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }

/* Order book — продажа слева, покупка справа */
.orderbook-wrap { margin-bottom: 18px; }
.orderbook {
  background: var(--card);
  border: 1px solid var(--stroke);
  border-radius: 16px;
  overflow: hidden;
  font-family: var(--mono);
  font-size: 13px;
}
.orderbook__header--two {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0;
  padding: 0;
}
.orderbook__side {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 12px;
  padding: 10px 16px;
  font-weight: 700;
  font-size: 11px;
  text-transform: uppercase;
  color: var(--muted);
  border-bottom: 1px solid var(--stroke);
}
.orderbook__side-title {
  grid-column: 1 / -1;
  margin-bottom: 4px;
}
.orderbook__side--sell {
  background: linear-gradient(135deg, rgba(220, 38, 38, 0.08) 0%, transparent 100%);
  border-right: 1px solid var(--stroke);
}
.orderbook__side--sell .orderbook__side-title { color: var(--sell); }
.orderbook__side--buy {
  background: linear-gradient(135deg, rgba(34, 197, 94, 0.06) 0%, transparent 100%);
}
.orderbook__side--buy .orderbook__side-title { color: var(--buy); }
.orderbook__asks, .orderbook__bids {
  display: flex;
  flex-direction: column;
}
.orderbook__asks { border-right: 1px solid var(--stroke); }
.orderbook__spread {
  grid-column: 1 / -1;
  padding: 12px 16px;
  background: var(--bg2);
  border-top: 1px solid var(--stroke);
  display: flex;
  justify-content: space-between;
  align-items: center;
  order: 99;
}
.orderbook__body {
  display: grid;
  grid-template-columns: 1fr 1fr;
}
.orderbook__body .orderbook__spread { grid-column: 1 / -1; }
.orderbook__row {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 12px;
  padding: 8px 16px;
  position: relative;
  align-items: center;
}
.orderbook__row--ask { background: linear-gradient(90deg, rgba(220, 38, 38, 0.1) 0%, transparent 100%); }
.orderbook__row--bid { background: linear-gradient(90deg, rgba(34, 197, 94, 0.06) 0%, transparent 100%); }
.orderbook__row:hover { background: var(--bg2); }
.orderbook__depth {
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  opacity: 0.15;
  pointer-events: none;
  min-width: 4px;
}
.orderbook__row--ask .orderbook__depth { background: var(--sell); }
.orderbook__row--bid .orderbook__depth { background: var(--buy); }
.orderbook__price--buy { color: var(--buy); font-weight: 700; }
.orderbook__price--sell { color: var(--sell); font-weight: 700; }
.orderbook__last { font-weight: 800; font-size: 16px; color: var(--primary); }
.orderbook__spread-label { font-size: 11px; color: var(--muted); }

.wallet-reveal {
  font-size: 11px;
  padding: 6px 10px;
  background: var(--bg2);
  border: 1px solid var(--stroke);
  border-radius: 8px;
  color: var(--muted);
  cursor: pointer;
  font-weight: 600;
  transition: all 0.15s ease;
}
.wallet-reveal:hover { border-color: var(--primary); color: var(--primary); }
.trade-wallet { display: inline-flex; align-items: center; gap: 6px; }
.trade-coin { font-size: 10px; font-weight: 700; color: var(--muted); text-transform: uppercase; }
.wallet-reveal.revealed {
  font-family: var(--mono);
  word-break: break-all;
  max-width: 240px;
  color: var(--text);
  font-size: 11px;
}

.badge {
  font-size: 10px;
  padding: 4px 10px;
  border-radius: 8px;
  font-weight: 700;
  text-transform: uppercase;
}
.badge.ok { background: rgba(34, 197, 94, 0.12); color: var(--buy); border: 1px solid rgba(34, 197, 94, 0.3); }

@media (max-width: 768px) {
  .topbar { flex-wrap: wrap; gap: 12px; }
  .topbar__tabs { margin-left: 0; order: 10; width: 100%; padding-top: 4px; border-top: 1px solid var(--stroke); }
  .topbar__tab { padding: 10px 14px; font-size: 13px; }
  .topbar__price { margin-left: 0; }
  .grid2 { grid-template-columns: 1fr; }
  .mint-form__row, .trade-form__row { flex-direction: column; }
  .content { padding: 16px; }
}

@media (max-width: 900px) {
  .table,
  .table thead,
  .table tbody,
  .table tr,
  .table td,
  .table th {
    display: block;
    width: 100%;
  }
  .table thead {
    display: none;
  }
  .table tr {
    border: 1px solid var(--stroke);
    border-radius: 14px;
    padding: 12px;
    margin-bottom: 12px;
    background: var(--card);
  }
  .table td {
    border: none;
    padding: 6px 0;
    display: flex;
    justify-content: space-between;
    gap: 12px;
    text-align: left;
  }
  .table td::before {
    content: attr(data-label);
    font-size: 11px;
    font-weight: 700;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: 0.4px;
  }
  .table td[colspan]::before {
    content: "";
    display: none;
  }
  .trade-wallet { flex-wrap: wrap; }
  .wallet-reveal.revealed { max-width: 100%; }
  .orderbook__header--two { grid-template-columns: 1fr; }
  .orderbook__side { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .orderbook__side--sell { border-right: none; border-bottom: 1px solid var(--stroke); }
  .orderbook__body { grid-template-columns: 1fr; }
  .orderbook__asks { border-right: none; border-bottom: 1px solid var(--stroke); }
  .orderbook__row { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
