.tg-page {
  width: 100%;
  max-width: 480px;
  margin: 0 auto;
  padding: 16px 14px 24px;
  background: url("/icons/bg-items.webp") center / 100% 100% no-repeat !important;
}

.tg-block-banner {
  margin: 0 0 14px;
  padding: 12px 14px;
  font-size: 13px;
  font-weight: 800;
  line-height: 1.7;
  text-align: center;
  color: #ffc65c;
  background: rgba(255, 167, 38, 0.12);
  border: 1px solid rgba(255, 167, 38, 0.45);
}

.tg-form.is-disabled {
  opacity: 0.55;
}

.tg-balance-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-bottom: 18px;
  padding: 10px 16px;
  background: linear-gradient(180deg, rgba(28, 21, 48, 0.85), rgba(10, 7, 18, 0.92));
  border: 1px solid var(--p-line, rgba(224, 184, 58, 0.28));
}

.tg-balance-icon {
  width: 24px;
  height: 24px;
  object-fit: contain;
  filter: drop-shadow(0 0 6px rgba(100, 200, 255, 0.65));
}

.tg-balance-label {
  font-size: 14px;
  font-weight: 700;
  color: var(--p-text-muted, #b0a3c4);
}

.tg-balance-value {
  font-size: 18px;
  font-weight: 800;
  color: var(--p-gem, #6ec8ff);
  font-variant-numeric: tabular-nums;
}

/* ── Tabs ── */
.tg-tabs {
  display: flex;
  gap: 6px;
  margin-bottom: 16px;
}

.tg-tab {
  flex: 1;
  padding: 10px 8px;
  border: 1px solid var(--p-line, rgba(224, 184, 58, 0.28));
  background: transparent;
  color: var(--p-text-muted, #b0a3c4);
  font-family: inherit;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}

.tg-tab {
  position: relative;
}

.tg-tab-dot {
  position: absolute;
  top: 4px;
  left: 4px;
  width: 9px;
  height: 9px;
  border-radius: 50% !important;
  background: #e53935;
  box-shadow: 0 0 0 2px rgba(0, 0, 0, 0.4), 0 0 6px rgba(229, 57, 53, 0.6);
  pointer-events: none;
}

.tg-tab-dot[hidden] {
  display: none;
}

.tg-tab.is-active {
  background: linear-gradient(180deg, rgba(91, 45, 158, 0.55), rgba(36, 28, 56, 0.9));
  color: var(--p-gold-light, #ffd56a);
  border-color: rgba(224, 184, 58, 0.55);
  box-shadow: 0 0 16px rgba(91, 45, 158, 0.35);
}

/* ── Form ── */
.tg-form {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.tg-field {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.tg-field-label {
  font-size: 13px;
  font-weight: 700;
  color: var(--p-text-muted, #b0a3c4);
}

.tg-input,
.tg-textarea {
  width: 100%;
  box-sizing: border-box;
  padding: 12px 14px;
  border: 1px solid var(--p-line, rgba(224, 184, 58, 0.28));
  background: rgba(255, 255, 255, 0.04);
  color: var(--p-text, #f7f2ea);
  font-family: inherit;
  font-size: 15px;
}

.tg-input:focus,
.tg-textarea:focus {
  outline: none;
  border-color: var(--p-gold, #e0b83a);
  box-shadow: 0 0 0 2px rgba(224, 184, 58, 0.18);
}

.tg-textarea {
  resize: vertical;
  min-height: 60px;
}

.tg-char-count {
  font-size: 11px;
  color: var(--p-text-muted, #b0a3c4);
  text-align: left;
  direction: ltr;
}

.tg-warning {
  margin: 0;
  padding: 10px 14px;
  font-size: 12px;
  font-weight: 600;
  color: #ffa726;
  line-height: 1.6;
  background: rgba(255, 167, 38, 0.08);
  border: 1px solid rgba(255, 167, 38, 0.25);
}

.tg-submit-btn {
  width: 100%;
  padding: 14px 16px;
  border: 1px solid rgba(165, 110, 240, 0.55);
  background: linear-gradient(180deg, #8b52d6 0%, #5b2d9e 100%);
  color: #fff;
  font-family: inherit;
  font-size: 15px;
  font-weight: 800;
  cursor: pointer;
  box-shadow: 0 0 20px rgba(91, 45, 158, 0.35);
  transition: filter 0.12s, transform 0.1s;
}

.tg-submit-btn:hover:not(:disabled) {
  filter: brightness(1.08);
}

.tg-submit-btn:active:not(:disabled) {
  transform: scale(0.98);
}

.tg-submit-btn:disabled {
  opacity: 0.55;
  cursor: wait;
}

.tg-error {
  margin: 0;
  font-size: 13px;
  color: #e0474b;
  line-height: 1.5;
  text-align: center;
}

/* ── History ── */
.tg-history-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.tg-history-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  background: rgba(91, 45, 158, 0.12);
  border: 1px solid var(--p-line-purple, rgba(165, 110, 240, 0.28));
}

.tg-history-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50% !important;
  object-fit: cover;
  flex-shrink: 0;
  background: #000;
}

.tg-history-meta {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.tg-history-name {
  font-size: 13px;
  font-weight: 700;
  color: #f8d889;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.tg-history-id {
  font-size: 11px;
  color: var(--p-text-muted, #b0a3c4);
  direction: ltr;
  text-align: right;
}

.tg-history-date {
  font-size: 10px;
  color: var(--p-text-muted, #b0a3c4);
  direction: ltr;
  text-align: right;
}

.tg-history-msg {
  font-size: 11px;
  color: var(--p-cream, #e8dcc8);
  background: rgba(255, 255, 255, 0.06);
  padding: 4px 8px;
  border-radius: 6px;
  margin-top: 2px;
  line-height: 1.4;
  word-break: break-word;
  white-space: pre-wrap;
}

.tg-history-amount {
  font-size: 15px;
  font-weight: 800;
  flex-shrink: 0;
  font-variant-numeric: tabular-nums;
}

.tg-history-row--sent .tg-history-amount {
  color: #e0474b;
}

.tg-history-row--sent .tg-history-amount::before {
  content: "−";
}

.tg-history-row--received .tg-history-amount {
  color: #4caf50;
}

.tg-history-row--received .tg-history-amount::before {
  content: "+";
}

.tg-empty {
  text-align: center;
  color: var(--p-text-muted, #b0a3c4);
  font-size: 14px;
  padding: 24px 0;
  margin: 0;
}

/* ── Confirmation modal ── */
.tg-confirm-modal {
  max-width: 340px;
  width: 92%;
}

.tg-confirm-body {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  padding: 12px 0 16px;
}

.tg-confirm-avatar {
  width: 72px;
  height: 72px;
  border-radius: 50% !important;
  object-fit: cover;
  background: #000;
}

.tg-confirm-name {
  font-size: 16px;
  font-weight: 800;
  color: var(--p-cream, #fff4d8);
}

.tg-confirm-amount {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 20px;
  font-weight: 800;
  color: var(--p-gem, #6ec8ff);
}

.tg-confirm-amount img {
  width: 24px;
  height: 24px;
  object-fit: contain;
}

.tg-confirm-actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.tg-confirm-yes {
  width: 100%;
  padding: 12px 16px;
  border: none;
  background: linear-gradient(180deg, #2ecc71, #1a8f4a);
  color: #fff;
  font-family: inherit;
  font-size: 15px;
  font-weight: 800;
  cursor: pointer;
  box-shadow: 0 0 16px rgba(46, 204, 113, 0.35);
}

.tg-confirm-yes:disabled {
  opacity: 0.55;
  cursor: wait;
}

.tg-confirm-no {
  width: 100%;
  padding: 12px 16px;
  border: 1px solid var(--p-line, rgba(224, 184, 58, 0.28));
  background: transparent;
  color: var(--p-text-muted, #b0a3c4);
  font-family: inherit;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
}
