:root {
  --bg: #0b0b0c;
  --card: #171718;
  --card2: #1f1f21;
  --text: #f5f5f7;
  --muted: #a6a6ad;
  --border: rgba(255, 255, 255, 0.08);
  --shadow: 0 10px 30px rgba(0, 0, 0, 0.45);
  --accent: #e53935;
  --accent2: #ff5a52;
  --radius: 18px;

  --tg-vh: 100vh;
  --safe-top: 0px;
  --safe-right: 0px;
  --safe-bottom: 0px;
  --safe-left: 0px;
}

* {
  box-sizing: border-box;
}

html,
body {
  padding: 0;
  margin: 0;
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family:
    system-ui,
    -apple-system,
    Segoe UI,
    Roboto,
    Arial,
    sans-serif;
  overflow-x: hidden;
}

#app {
  min-height: var(--tg-vh);
  width: 100%;
  padding:
    calc(14px + var(--safe-top))
    calc(14px + var(--safe-right))
    calc(94px + var(--safe-bottom))
    calc(14px + var(--safe-left));
  display: flex;
  justify-content: center;
}

.shell {
  width: 100%;
  max-width: 420px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.title {
  text-align: center;
  font-size: 18px;
  margin: 8px 0 2px;
  letter-spacing: 0.3px;
}

.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 16px;
  overflow: hidden;
}

.cardHeader {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}

.cardHeader .label {
  font-size: 12px;
  letter-spacing: 1.2px;
  text-transform: uppercase;
  color: rgba(245, 245, 247, 0.9);
}

.badgeBtn {
  width: 36px;
  height: 36px;
  border: 1px solid var(--border);
  background: var(--card2);
  border-radius: 12px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--text);
  transition:
    transform 0.08s ease,
    background 0.18s ease,
    border-color 0.18s ease,
    opacity 0.18s ease;
}

.balanceValue {
  font-size: 44px;
  font-weight: 800;
  line-height: 1;
  margin: 8px 0 6px;
}

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

.btn {
  width: 100%;
  border: none;
  border-radius: 16px;
  background: var(--card2);
  color: var(--text);
  padding: 14px 14px;
  font-size: 16px;
  font-weight: 700;
  border: 1px solid var(--border);
  transition:
    transform 0.08s ease,
    background 0.18s ease,
    border-color 0.18s ease,
    opacity 0.18s ease;
  -webkit-tap-highlight-color: transparent;
}

.btnIconOnly {
  display: flex;
  align-items: center;
  justify-content: center;
}

.btnWithIcon {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
}

.btnWithIcon svg {
  width: 20px;
  height: 20px;
  flex: 0 0 auto;
}

.btnAccent {
  background: var(--accent);
  border: 1px solid rgba(0, 0, 0, 0.2);
}

.btnRow {
  display: flex;
  gap: 10px;
}

.btnRow .btn {
  width: auto;
}

.modal .btnRow {
  flex-direction: column;
}

.modal .btnRow .btn {
  width: 100%;
}

.btnSmall {
  width: 42px;
  height: 42px;
  padding: 0;
  border-radius: 14px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.connActions {
  display: flex;
  gap: 10px;
  align-items: center;
  min-width: 0;
}

.connActionsLeft {
  display: flex;
  gap: 10px;
  align-items: center;
  flex: 0 0 auto;
}

.btn:disabled,
.badgeBtn:disabled {
  opacity: 0.55;
}

.list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.row {
  background: rgba(0, 0, 0, 0.12);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 12px;
  overflow: hidden;
  transition:
    transform 0.08s ease,
    background 0.18s ease,
    border-color 0.18s ease;
}

.rowTop {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  cursor: pointer;
}

.rowLeft {
  display: flex;
  gap: 10px;
  align-items: center;
  min-width: 0;
}

.dot {
  width: 12px;
  height: 12px;
  border-radius: 999px;
  background: var(--accent);
  box-shadow: 0 0 0 4px rgba(229, 57, 53, 0.2);
}

.dotDisabled {
  background: rgba(255, 255, 255, 0.12);
  box-shadow: none;
}

.rowTitle {
  font-weight: 800;
  font-size: 15px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.rowDate {
  color: var(--muted);
  font-size: 12px;
  margin-top: 2px;
}

.chev {
  width: 32px;
  height: 32px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--card2);
  transition:
    transform 0.08s ease,
    background 0.18s ease,
    border-color 0.18s ease;
}

.rowBody {
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.kv {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  font-size: 14px;
}

.kv .k {
  color: var(--muted);
}

.kv .v {
  font-weight: 700;
}

.link {
  color: var(--accent2);
  text-decoration: none;
  font-weight: 700;
}

.topupRow {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
  flex-wrap: wrap;
}

.topupRow .btn {
  width: auto;
  flex: 0 0 140px;
}

@media (max-width: 360px) {
  .topupRow .btn {
    flex: 1 1 140px;
  }
}

.input {
  flex: 1;
  min-width: 0;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: rgba(0, 0, 0, 0.18);
  color: var(--text);
  padding: 12px 12px;
  font-size: 16px;
  outline: none;
}

.dotOnline {
  background: #3ddc84;
  box-shadow: 0 0 0 4px rgba(61, 220, 132, 0.18);
}

.mutedRight {
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.nav {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  padding:
    12px
    calc(14px + var(--safe-right))
    calc(12px + var(--safe-bottom))
    calc(14px + var(--safe-left));
  display: flex;
  justify-content: center;
  pointer-events: none;
}

.navInner {
  width: 100%;
  max-width: 420px;
  background: rgba(23, 23, 24, 0.9);
  border: 1px solid var(--border);
  border-radius: 26px;
  padding: 10px 10px;
  display: flex;
  justify-content: space-around;
  pointer-events: auto;
  backdrop-filter: blur(8px);
  overflow: hidden;
}

.navBtn {
  width: 54px;
  height: 54px;
  border-radius: 18px;
  border: none;
  background: transparent;
  color: rgba(245, 245, 247, 0.75);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition:
    transform 0.08s ease,
    background 0.18s ease,
    color 0.18s ease;
  -webkit-tap-highlight-color: transparent;
}

.navBtnActive {
  background: rgba(229, 57, 53, 0.18);
  color: var(--text);
}

.toast {
  position: fixed;
  left: 50%;
  bottom: calc(92px + var(--safe-bottom));
  transform: translateX(-50%);
  background: rgba(0, 0, 0, 0.75);
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: var(--text);
  padding: 10px 12px;
  border-radius: 14px;
  font-weight: 700;
  font-size: 13px;
  max-width: 92%;
  text-align: center;
}

.modalBack {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
  display: flex;
  justify-content: center;
  align-items: flex-end;
  padding: 12px;
  animation: fadeIn 0.12s ease-out;
}

.modalBackTop {
  align-items: flex-start;
}

.modal {
  width: 100%;
  max-width: 420px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 22px;
  box-shadow: var(--shadow);
  padding: 14px;
  animation: slideUp 0.14s ease-out;
}

.modalTall {
  max-height: calc(100vh - 24px);
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
}

.qrWrap {
  background: #fff;
  padding: 10px;
  border-radius: 14px;
}

.qrImg {
  display: block;
  width: 220px;
  height: 220px;
}

.successIcon {
  width: 56px;
  height: 56px;
}

.modalTitle {
  font-weight: 900;
  font-size: 16px;
  margin-bottom: 8px;
}

.modalText {
  color: var(--muted);
  font-size: 14px;
  line-height: 1.35;
  margin-bottom: 12px;
}

.hr {
  height: 1px;
  background: var(--border);
  margin: 8px 0;
}

.err {
  color: rgba(255, 255, 255, 0.92);
  font-size: 14px;
  background: rgba(229, 57, 53, 0.14);
  border: 1px solid rgba(229, 57, 53, 0.35);
  padding: 12px;
  border-radius: 16px;
}

.btn:active,
.badgeBtn:active,
.navBtn:active,
.chev:active {
  transform: scale(0.98);
}

.row:active {
  transform: scale(0.99);
}

@media (hover: hover) {
  .btn:hover,
  .badgeBtn:hover,
  .chev:hover {
    background: rgba(255, 255, 255, 0.06);
    border-color: rgba(255, 255, 255, 0.14);
  }
  .row:hover {
    border-color: rgba(255, 255, 255, 0.14);
  }
  .navBtn:hover {
    background: rgba(255, 255, 255, 0.05);
  }
}

@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

@keyframes slideUp {
  from {
    transform: translateY(10px);
    opacity: 0.9;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}

@media (prefers-reduced-motion: reduce) {
  .btn,
  .badgeBtn,
  .row,
  .navBtn,
  .chev,
  .modalBack,
  .modal {
    transition: none !important;
    animation: none !important;
  }
}
