:root {
  --bg: #edf1f5;
  --card: #ffffff;
  --line: #d2dae5;
  --text: #12161d;
  --muted: #788596;
  --blue: #45a9ea;
  --blue-deep: #2492d9;
  --green: #31b66a;
  --red: #e15465;
  --shadow: 0 14px 38px rgba(16, 24, 34, 0.08);
  font-family: "Manrope", sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--text); }
body { min-height: 100vh; }
button, input, select { font: inherit; }
button { border: 0; cursor: pointer; }

.app-shell {
  width: min(100%, 480px);
  min-height: 100vh;
  margin: 0 auto;
  padding: max(8px, env(safe-area-inset-top)) 10px calc(102px + env(safe-area-inset-bottom));
  background: linear-gradient(180deg, #f7f9fc 0%, #edf1f5 72%);
  overflow: hidden;
}

.topbar {
  display: grid;
  grid-template-columns: minmax(82px, auto) 1fr auto;
  align-items: center;
  gap: 10px;
  padding: 8px;
  border-radius: 22px;
  background: var(--card);
  box-shadow: var(--shadow);
}
.top-action {
  justify-self: start;
  background: transparent;
  font-size: 21px;
  font-weight: 600;
}
.brand-block { text-align: center; min-width: 0; }
.brand-block strong {
  display: block;
  font-size: 27px;
  font-family: "Unbounded", sans-serif;
  letter-spacing: -0.03em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.brand-block span { color: var(--muted); font-size: 12px; font-weight: 700; }
.top-round {
  justify-self: end;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  color: #2e3640;
  background: #eef2f8;
  font-size: 24px;
  line-height: 1;
}

.page-track {
  display: flex;
  width: 100%;
  transform: translateX(0%);
  transition: transform 340ms cubic-bezier(0.2, 0.8, 0.2, 1);
}
.page {
  min-width: 100%;
  padding: 12px 4px 0;
}

.profile-banner {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px;
  border-radius: 18px;
  background: var(--card);
  box-shadow: var(--shadow);
}
.avatar {
  width: 52px;
  height: 52px;
  border-radius: 16px;
  display: grid;
  place-items: center;
  overflow: hidden;
  background: linear-gradient(135deg, #7ed7ff, #56b8f3);
  font-weight: 800;
}
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.profile-meta { min-width: 0; flex: 1; }
.profile-meta p { margin: 0; font-size: 17px; font-weight: 800; }
.profile-meta span { display: block; margin-top: 2px; font-size: 12px; color: var(--muted); font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chip-action {
  border-radius: 12px;
  padding: 8px 10px;
  background: #eef6ff;
  color: var(--blue-deep);
  font-size: 12px;
  font-weight: 800;
}

.setup-pill {
  margin-top: 12px;
  display: grid;
  grid-template-columns: 58px 1fr auto;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-radius: 18px;
  background: #eaf6ff;
  border: 1px solid #cfe9fb;
}
.ring {
  position: relative;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: conic-gradient(var(--blue) 0 100%, #c6d8ea 100% 100%);
}
.ring::before {
  content: "";
  position: absolute;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: #f8fbff;
}
.ring span { position: relative; font-weight: 800; color: #53789d; }
.setup-pill p { margin: 0; font-size: 17px; font-weight: 800; }
.setup-pill span { font-size: 13px; color: #6b8ba7; font-weight: 700; }
.setup-pill b { color: var(--blue); font-size: 34px; }

.balance-card {
  margin-top: 12px;
  padding: 18px;
  border-radius: 22px;
  background: linear-gradient(145deg, #ffffff, #eff6ff);
  border: 1px solid #dce8f7;
  text-align: center;
}
.balance-card small { color: #6f7f92; font-size: 13px; font-weight: 700; }
.balance-card h1 {
  margin: 6px 0 4px;
  display: flex;
  justify-content: center;
  align-items: baseline;
  gap: 10px;
}
.balance-card h1 span { color: #97a5b5; font-size: 40px; text-decoration: line-through; }
.balance-card h1 strong { font-family: "Unbounded", sans-serif; font-size: 56px; letter-spacing: -0.06em; }
.balance-card p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
  display: inline-block;
  background: #dbe2ec;
  border-radius: 3px;
  padding: 2px 6px;
}

.action-row {
  margin-top: 14px;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
}
.round-action {
  min-height: 62px;
  border-radius: 14px;
  background: linear-gradient(180deg, #7ed0ff, #47abea);
  color: #ffffff;
  font-size: 13px;
  font-weight: 800;
}

.panel {
  margin-top: 12px;
  border-radius: 20px;
  padding: 14px;
  background: var(--card);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
}
.panel-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  margin-bottom: 8px;
}
.panel-head h2 {
  margin: 0;
  font-size: 18px;
  letter-spacing: -0.03em;
}
.panel-head button {
  background: #eff4fb;
  color: #5f7894;
  border-radius: 10px;
  padding: 6px 8px;
  font-size: 12px;
  font-weight: 800;
}

.asset-list, .wallet-list, .history-list, .feed-list, .users-list { display: grid; gap: 8px; }
.asset-item, .wallet-item, .history-item, .feed-item, .user-item {
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 11px;
  background: #fbfdff;
}
.asset-item {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 10px;
}
.asset-icon {
  width: 36px;
  height: 36px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  color: #fff;
  font-weight: 800;
}
.asset-name p { margin: 0; font-size: 15px; font-weight: 800; }
.asset-name span { color: var(--muted); font-size: 12px; }
.asset-val { text-align: right; }
.asset-val strong { display: block; font-size: 15px; }
.asset-val span { color: var(--muted); font-size: 12px; }

.wallet-item { display: flex; justify-content: space-between; gap: 10px; }
.wallet-left p { margin: 0; font-weight: 800; }
.wallet-left span { display: block; color: var(--muted); font-size: 12px; margin-top: 2px; }
.wallet-right { text-align: right; }
.wallet-right strong { display: block; }
.wallet-right span { color: var(--muted); font-size: 12px; }

.history-item { display: flex; justify-content: space-between; gap: 10px; }
.history-item p { margin: 0; font-size: 14px; font-weight: 800; }
.history-item small { color: var(--muted); font-size: 12px; }
.history-item strong { align-self: center; }
.history-item strong.negative { color: var(--red); }
.history-item strong.positive { color: var(--green); }
.receipt-link {
  display: inline-block;
  margin-top: 4px;
  color: var(--blue-deep);
  font-size: 12px;
  font-weight: 800;
  text-decoration: none;
}
.receipt-link:hover { text-decoration: underline; }

.pair-panel .pair-select,
.pair-panel .grid-two,
.order-panel .form-grid,
.swap-panel {
  display: grid;
  gap: 8px;
}
.grid-two { grid-template-columns: repeat(2, 1fr); }
label { color: #677688; font-size: 11px; font-weight: 800; letter-spacing: 0.02em; text-transform: uppercase; }
input, select {
  width: 100%;
  min-height: 52px;
  border: 1px solid #c6d3e2;
  border-radius: 14px;
  background: #fff;
  color: var(--text);
  padding: 0 14px;
  font-size: 18px;
  font-weight: 600;
}
input:focus, select:focus {
  border-color: #72bae7;
  box-shadow: 0 0 0 4px rgba(70, 169, 233, 0.18);
  outline: 0;
}

.ticker {
  border: 1px solid #d8e7f8;
  border-radius: 12px;
  background: #f2f8ff;
  padding: 10px;
  font-size: 13px;
  font-weight: 700;
  color: #4d759c;
}
.side-toggle {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-bottom: 8px;
}
.side-toggle button {
  min-height: 46px;
  border-radius: 12px;
  background: #e8ecf1;
  color: #6c7784;
  font-weight: 800;
}
.side-toggle button.active.buy { background: #32b66b; color: #fff; }
.side-toggle button.active.sell { background: #e15465; color: #fff; }
.trade-summary, .swap-quote {
  border: 1px dashed #c6d6e8;
  border-radius: 12px;
  padding: 10px;
  color: #5d738e;
  font-size: 13px;
  font-weight: 700;
}

.two-col-trade {
  display: grid;
  grid-template-columns: 1fr 0.9fr;
  gap: 10px;
}
.orderbook {
  border: 1px solid #d7e2ef;
  border-radius: 14px;
  background: #f6f9fc;
  padding: 10px;
  display: grid;
  gap: 5px;
}
.book-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 8px;
  margin-bottom: 2px;
}
.book-head strong { font-size: 13px; }
.book-head span { font-size: 11px; color: var(--muted); }
.book-row {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  font-weight: 700;
  padding: 3px 4px;
  border-radius: 8px;
}
.book-row.ask { background: #fdeef1; color: #c33f56; }
.book-row.bid { background: #ebf8ef; color: #2a9156; }
.book-mid {
  text-align: center;
  font-size: 18px;
  font-weight: 800;
  color: #2f3a46;
  padding: 4px 0;
}

.swap-panel input#swapAmount {
  font-size: 28px;
  font-weight: 800;
}

.service-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
}
.service-grid button {
  min-height: 58px;
  border-radius: 14px;
  background: linear-gradient(135deg, #69bff0, #3f9ad9);
  color: #fff;
  font-size: 13px;
  font-weight: 800;
}

.user-item { display: flex; justify-content: space-between; gap: 10px; }
.user-item p { margin: 0; font-size: 14px; font-weight: 800; }
.user-item span { color: var(--muted); font-size: 12px; }
.user-state {
  border-radius: 999px;
  padding: 4px 8px;
  font-size: 11px;
  font-weight: 800;
}
.user-state.ok { background: #e8f8ef; color: #1e8b4f; }
.user-state.bad { background: #fdecef; color: #b03c4a; }

.primary {
  min-height: 54px;
  border-radius: 16px;
  background: linear-gradient(180deg, #66bdf0, #3599dc);
  color: #fff;
  font-size: 18px;
  font-weight: 800;
}

.bottom-nav {
  position: fixed;
  left: max(10px, calc((100vw - 480px)/2 + 10px));
  right: max(10px, calc((100vw - 480px)/2 + 10px));
  bottom: max(10px, env(safe-area-inset-bottom));
  min-height: 76px;
  border-radius: 999px;
  border: 1px solid #dce4ee;
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(12px);
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
  padding: 8px;
  box-shadow: var(--shadow);
}
.nav-btn {
  border-radius: 999px;
  background: transparent;
  color: #394655;
  font-size: 12px;
  font-weight: 800;
  display: grid;
  justify-items: center;
  gap: 3px;
}
.nav-btn span { font-size: 21px; line-height: 1; }
.nav-btn.active {
  background: #eaf5ff;
  color: var(--blue-deep);
}

.sheet { width: min(94vw, 430px); border: 0; padding: 0; background: transparent; }
.sheet::backdrop { background: rgba(15, 20, 29, 0.42); backdrop-filter: blur(7px); }
.sheet-card {
  padding: 18px;
  border-radius: 16px;
  background: #fff;
  display: grid;
  gap: 8px;
  border: 1px solid #dce4ee;
}
.sheet-card h3 { margin: 0 0 4px; font-size: 20px; }

.toast {
  position: fixed;
  left: 50%;
  transform: translate(-50%, 20px);
  bottom: 95px;
  background: rgba(20, 28, 39, 0.95);
  color: #fff;
  border-radius: 12px;
  padding: 10px 12px;
  font-size: 13px;
  font-weight: 700;
  opacity: 0;
  pointer-events: none;
  transition: 180ms ease;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

@media (max-width: 400px) {
  .brand-block strong { font-size: 24px; }
  .action-row { grid-template-columns: repeat(2, 1fr); }
  .two-col-trade { grid-template-columns: 1fr; }
}
