:root {
  --ink: #07100d;
  --surface: #0e1a16;
  --surface-2: #14241e;
  --surface-3: #1a2d26;
  --line: #1f3a30;
  --text: #e9f2ed;
  --muted: #89a79a;
  --mint: #35e0a0;
  --mint-dim: rgba(53, 224, 160, 0.14);
  --amber: #f5b942;
  --amber-dim: rgba(245, 185, 66, 0.14);
  --down: #ff6f6f;
  --radius: 18px;
  --radius-sm: 12px;
}

* {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

html,
body {
  margin: 0;
  padding: 0;
}

body {
  background:
    radial-gradient(120% 60% at 50% 0%, #12261f 0%, rgba(18, 38, 31, 0) 60%),
    var(--ink);
  color: var(--text);
  font-family: "Inter", "Segoe UI", system-ui, -apple-system, sans-serif;
  font-size: 15px;
  line-height: 1.45;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

.wrap {
  max-width: 520px;
  margin: 0 auto;
  padding: 16px 14px 40px;
}

h1,
h2,
h3 {
  font-family: "Space Grotesk", "Inter", sans-serif;
  margin: 0;
  letter-spacing: -0.02em;
}

/* Шапка */

.top {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 4px 2px 18px;
}

.mark {
  width: 44px;
  height: 44px;
  flex: none;
  border-radius: 14px;
  background: linear-gradient(145deg, var(--mint), #14916a);
  display: grid;
  place-items: center;
  box-shadow: 0 8px 22px rgba(53, 224, 160, 0.22);
}

.top h1 {
  font-size: 20px;
}

.top p {
  margin: 2px 0 0;
  color: var(--muted);
  font-size: 12.5px;
}

.live {
  margin-left: auto;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 11.5px;
  color: var(--muted);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 5px 10px;
}

.live i {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--mint);
  box-shadow: 0 0 0 0 rgba(53, 224, 160, 0.6);
  animation: pulse 2s infinite;
}

@keyframes pulse {
  0% { box-shadow: 0 0 0 0 rgba(53, 224, 160, 0.5); }
  70% { box-shadow: 0 0 0 7px rgba(53, 224, 160, 0); }
  100% { box-shadow: 0 0 0 0 rgba(53, 224, 160, 0); }
}

/* Карточки */

.card {
  background: linear-gradient(180deg, var(--surface-2), var(--surface));
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 14px;
}

.card-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 12px;
}

.card-title h2 {
  font-size: 15px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.card-title h2 svg {
  width: 17px;
  height: 17px;
  stroke: var(--mint);
  fill: none;
  stroke-width: 1.7;
}

.muted {
  color: var(--muted);
  font-size: 12.5px;
}

/* Кнопки */

button,
.btn {
  font: inherit;
  border: 0;
  cursor: pointer;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  font-weight: 600;
  font-size: 14px;
  background: var(--surface-3);
  color: var(--text);
  border: 1px solid var(--line);
  transition: transform 0.08s ease, background 0.15s ease, opacity 0.15s ease;
}

.btn:active {
  transform: scale(0.985);
}

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

.btn svg {
  width: 16px;
  height: 16px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
}

.btn-primary {
  background: linear-gradient(140deg, var(--mint), #16a374);
  color: #04140e;
  border-color: transparent;
}

.btn-amber {
  background: var(--amber-dim);
  color: var(--amber);
  border-color: rgba(245, 185, 66, 0.32);
}

.btn-ghost {
  background: transparent;
}

.btn-row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.btn-row .btn {
  flex: 1 1 120px;
}

/* Поля */

label.field {
  display: block;
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 6px;
}

input,
select {
  width: 100%;
  font: inherit;
  font-family: "Space Grotesk", "Inter", sans-serif;
  background: var(--ink);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  color: var(--text);
  padding: 12px 13px;
  outline: none;
}

input:focus,
select:focus {
  border-color: var(--mint);
}

input::placeholder {
  color: #5d7a6e;
}

.amount-wrap {
  display: flex;
  gap: 8px;
}

.amount-wrap input {
  font-size: 17px;
}

/* Сегменты */

.seg {
  display: flex;
  background: var(--ink);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 3px;
  gap: 3px;
}

.seg button {
  flex: 1;
  background: transparent;
  color: var(--muted);
  border-radius: 9px;
  padding: 8px 6px;
  font-size: 13px;
  font-weight: 600;
}

.seg button.on {
  background: var(--surface-3);
  color: var(--text);
}

.seg button.on.buy {
  color: var(--mint);
}

.seg button.on.sell {
  color: var(--down);
}

/* Кошелёк */

.wallet-head {
  display: flex;
  align-items: center;
  gap: 12px;
}

.avatar {
  width: 42px;
  height: 42px;
  border-radius: 13px;
  background: var(--mint-dim);
  border: 1px solid rgba(53, 224, 160, 0.3);
  display: grid;
  place-items: center;
  color: var(--mint);
  font-family: "Space Grotesk", sans-serif;
  font-weight: 700;
}

.addr {
  font-family: "Space Grotesk", monospace;
  font-size: 13px;
  word-break: break-all;
}

.balance {
  display: flex;
  align-items: baseline;
  gap: 8px;
  margin-top: 14px;
}

.balance b {
  font-family: "Space Grotesk", sans-serif;
  font-size: 30px;
  font-weight: 600;
  letter-spacing: -0.02em;
}

.chips {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 12px;
}

.chip {
  border: 1px solid var(--line);
  background: var(--surface-3);
  border-radius: 10px;
  padding: 7px 10px;
  font-size: 12.5px;
  color: var(--muted);
}

.chip b {
  color: var(--text);
  font-family: "Space Grotesk", sans-serif;
  font-weight: 600;
}

/* Рынок */

.asset {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 11px 0;
  border-bottom: 1px solid rgba(31, 58, 48, 0.6);
}

.asset:last-child {
  border-bottom: 0;
}

.asset .coin {
  width: 34px;
  height: 34px;
  border-radius: 11px;
  display: grid;
  place-items: center;
  font-family: "Space Grotesk", sans-serif;
  font-weight: 700;
  font-size: 13px;
  color: #04140e;
}

.asset .meta {
  flex: 1;
  min-width: 0;
}

.asset .sym {
  font-family: "Space Grotesk", sans-serif;
  font-weight: 600;
  font-size: 14.5px;
}

.asset canvas {
  width: 74px;
  height: 30px;
  flex: none;
}

.price {
  text-align: right;
  font-family: "Space Grotesk", sans-serif;
  font-size: 14.5px;
  font-weight: 600;
}

.chg {
  font-size: 12px;
  font-weight: 600;
}

.up { color: var(--mint); }
.down { color: var(--down); }

/* График */

.chart-wrap {
  position: relative;
}

.chart-wrap canvas {
  width: 100%;
  height: 190px;
  display: block;
}

.chart-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 6px;
}

.chart-price {
  font-family: "Space Grotesk", sans-serif;
  font-size: 26px;
  font-weight: 600;
  letter-spacing: -0.02em;
}

.range {
  display: flex;
  gap: 4px;
}

.range button {
  background: transparent;
  border: 1px solid var(--line);
  color: var(--muted);
  border-radius: 9px;
  padding: 5px 10px;
  font-size: 12px;
  font-weight: 600;
}

.range button.on {
  border-color: var(--mint);
  color: var(--mint);
}

/* Итог сделки */

.summary {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  font-size: 13.5px;
  padding: 7px 0;
}

.summary span:first-child {
  color: var(--muted);
}

.summary span:last-child {
  font-family: "Space Grotesk", sans-serif;
  font-weight: 600;
}

.note {
  font-size: 12px;
  color: var(--muted);
  background: var(--ink);
  border: 1px dashed var(--line);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  margin-top: 12px;
}

/* История */

.log {
  display: flex;
  gap: 10px;
  padding: 10px 0;
  border-bottom: 1px solid rgba(31, 58, 48, 0.6);
}

.log:last-child {
  border-bottom: 0;
}

.log .dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  margin-top: 6px;
  flex: none;
  background: var(--mint);
}

.log .dot.out { background: var(--amber); }
.log .dot.trade { background: #6aa9ff; }

.log .body {
  flex: 1;
  min-width: 0;
}

.log .t {
  font-size: 13.5px;
}

.log .s {
  font-size: 11.5px;
  color: var(--muted);
  margin-top: 2px;
}

/* Тост */

.toast {
  position: fixed;
  left: 50%;
  bottom: 18px;
  transform: translate(-50%, 20px);
  background: var(--surface-3);
  border: 1px solid var(--line);
  color: var(--text);
  padding: 11px 16px;
  border-radius: 12px;
  font-size: 13.5px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease, transform 0.2s ease;
  max-width: calc(100% - 28px);
  text-align: center;
  z-index: 40;
}

.toast.show {
  opacity: 1;
  transform: translate(-50%, 0);
}

.toast.err {
  border-color: rgba(255, 111, 111, 0.5);
  color: #ffc9c9;
}

.row {
  display: flex;
  gap: 8px;
  align-items: center;
}

.spread {
  justify-content: space-between;
}

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

.hidden {
  display: none !important;
}

.spin {
  animation: spin 1s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}
