:root {
  --bg: var(--tg-theme-bg-color, #17212b);
  --sec: var(--tg-theme-secondary-bg-color, #0e1621);
  --txt: var(--tg-theme-text-color, #f5f7fa);
  --mut: var(--tg-theme-hint-color, #8fa3b8);
  --acc: var(--tg-theme-button-color, #3cc9db);
  --atxt: var(--tg-theme-button-text-color, #06222a);
  --ok: #4ade80;
  --err: #f87171;
  --sb: env(safe-area-inset-bottom, 0px);
}

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

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  overflow: hidden;
  overscroll-behavior: none;
}

body {
  background: var(--bg);
  color: var(--txt);
  font: 15px/1.4 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  display: flex;
  flex-direction: column;
}

.shell {
  height: 100dvh;
  max-height: var(--vh, 100dvh);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.top {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: calc(8px + env(safe-area-inset-top, 0px)) 14px 8px;
  background: var(--sec);
  border-bottom: 1px solid rgba(255, 255, 255, .07);
}

.logo { width: 32px; height: 32px; border-radius: 8px; flex: 0 0 auto; object-fit: cover; }
.ttl { flex: 1 1 auto; min-width: 0; overflow: hidden; }
.t1 { font-size: 15px; font-weight: 700; line-height: 1.15; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.t2 { font-size: 12px; color: var(--mut); line-height: 1.2; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.ico {
  flex: 0 0 auto;
  width: 34px; height: 34px;
  border: 0; border-radius: 9px;
  background: rgba(255, 255, 255, .07);
  color: var(--txt);
  font-size: 19px; line-height: 1;
  cursor: pointer;
}

.main {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 12px 14px 4px;
}

.card {
  background: var(--sec);
  border: 1px solid rgba(255, 255, 255, .07);
  border-radius: 14px;
  padding: 12px 13px;
}
.card + .card { margin-top: 10px; }

.card-h {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: .07em;
  color: var(--mut);
  margin-bottom: 9px;
}

.row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  padding: 5px 0;
  font-size: 14px;
}
.row span { color: var(--mut); flex: 0 0 auto; }
.row b { font-weight: 600; text-align: right; word-break: break-all; }

.hint { color: var(--mut); font-size: 12.5px; margin-top: 8px; }

.bar {
  height: 7px;
  border-radius: 99px;
  background: rgba(255, 255, 255, .1);
  overflow: hidden;
  margin: 7px 0 3px;
}
.bar i { display: block; height: 100%; width: 0; background: var(--acc); border-radius: 99px; }

.inp {
  width: 100%;
  background: rgba(255, 255, 255, .06);
  border: 1px solid rgba(255, 255, 255, .12);
  border-radius: 10px;
  color: var(--txt);
  font-size: 16px;
  padding: 12px;
  outline: none;
}
.inp:focus { border-color: var(--acc); }

.pay { margin-top: 9px; }
.pay:empty { display: none; }
.pay .row { border-top: 1px dashed rgba(255, 255, 255, .12); }

.spin {
  width: 22px; height: 22px;
  margin: 2px auto 10px;
  border: 2.5px solid rgba(255, 255, 255, .15);
  border-top-color: var(--acc);
  border-radius: 50%;
  animation: sp .7s linear infinite;
}
@keyframes sp { to { transform: rotate(360deg); } }

.terms p { margin: 0 0 9px; font-size: 13.5px; line-height: 1.5; }
.terms .mut { color: var(--mut); }
.terms .sign { color: var(--mut); margin-top: 12px; text-align: right; }
.terms .sign b { color: var(--txt); font-size: 15px; }

.scrollhint { color: var(--acc); font-size: 12px; text-align: center; margin-top: 6px; }
.scrollhint[hidden] { display: none; }

.check {
  display: flex;
  align-items: flex-start;
  gap: 9px;
  margin-top: 11px;
  padding: 11px;
  border-radius: 11px;
  background: rgba(255, 255, 255, .05);
  font-size: 13.5px;
  cursor: pointer;
}
.check input { width: 19px; height: 19px; margin: 0; flex: 0 0 auto; accent-color: var(--acc); }
.check.locked { opacity: .45; }

.list { display: flex; flex-direction: column; gap: 8px; }
.item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 9px;
  padding: 9px 10px;
  border-radius: 10px;
  background: rgba(255, 255, 255, .05);
  font-size: 13.5px;
}
.item .who { font-weight: 600; word-break: break-all; }
.item .st { font-size: 11px; color: var(--mut); white-space: nowrap; }
.ok { color: var(--ok); }
.err { color: var(--err); }
.wait { color: var(--acc); }
.empty { color: var(--mut); font-size: 13px; text-align: center; padding: 10px 0; }

.bottom {
  flex: 0 0 auto;
  display: flex;
  flex-direction: column;
  gap: 7px;
  padding: 9px 14px calc(9px + var(--sb));
  background: var(--sec);
  border-top: 1px solid rgba(255, 255, 255, .07);
}

.btn {
  display: block;
  width: 100%;
  border: 0;
  border-radius: 11px;
  background: var(--acc);
  color: var(--atxt);
  font-size: 15.5px;
  font-weight: 700;
  padding: 14px 12px;
  cursor: pointer;
}
.btn:active { opacity: .75; }
.btn[hidden] { display: none; }

.btn.ghost {
  background: rgba(255, 255, 255, .09);
  color: var(--txt);
  font-weight: 600;
  font-size: 14.5px;
  padding: 12px;
}
.btn.ok { background: var(--ok); }
.btn:disabled { opacity: .45; cursor: default; }

.sb {
  font-size: 11.5px;
  color: var(--mut);
  text-align: center;
  line-height: 1.3;
}
.sb:empty { display: none; }

.toast {
  position: fixed;
  left: 50%;
  bottom: calc(96px + var(--sb));
  transform: translateX(-50%);
  max-width: 88%;
  background: #000;
  color: #fff;
  font-size: 13.5px;
  padding: 10px 15px;
  border-radius: 11px;
  z-index: 50;
  box-shadow: 0 6px 22px rgba(0, 0, 0, .45);
}

@media (max-height: 620px) {
  .btn { padding: 11px 12px; font-size: 15px; }
  .sb { display: none; }
}
