/* Compact type in the existing 390px game coordinate system.
   Tracking scales with font size: 12px × -0.025em = -0.3px per glyph.
   Keep Vietnamese accents at their natural width and preserve font choices. */
:root {
  --tracking-copy: -0.015em;
  --tracking-control: -0.02em;
  --tracking-title: -0.025em;
}

body {
  font-family: var(--font-body);
  font-kerning: normal;
  letter-spacing: var(--tracking-copy);
  word-spacing: -0.02em;
}

:is(#app, #ung-dung-ngoai-canh, .nc-modal-overlay, .nc-toast) :is(button, input, select, textarea, a, span, div, p, strong, small) {
  font-family: var(--font-body);
  font-kerning: normal;
}

:is(#app, #ung-dung-ngoai-canh, .nc-modal-overlay) :is(button, input, select, textarea) {
  letter-spacing: var(--tracking-control);
  word-spacing: -0.02em;
}

#app .thanh-tab-quay .tab-quay {
  letter-spacing: var(--tracking-control);
}

#app :is(.tab-quay__ten, .ngan-keo-gon__nut, .nut-vung-xanh, .nut-nho),
:is(#app, #ung-dung-ngoai-canh, .nc-modal-overlay) :is(
  .nc-nut-vung-xanh,
  .nc-chi-so-nut-cap,
  .nc-chi-so-nut-nho,
  .nc-chi-so-nut-dong,
  .nc-nut-nhanh-vung-do,
  .nc-nut-nhom-hang,
  .nc-ten-nhom-ngan,
  .nc-ten-mon-ke,
  .nc-nut-goc-san-khau
) {
  font-family: var(--font-body) !important;
  font-weight: 800;
  letter-spacing: var(--tracking-control);
}

#app :is(.tab-quay__nhan, .ngan-keo-gon__hoc-trong) {
  font-weight: 700;
  letter-spacing: var(--tracking-copy);
}

/* Long copy uses the text face; display faces stay on signs and headings. */
#app :is(.bong-thoai-khach, .chat-khach-loi-thoai, .loi-thoai-khach-ngan, .loi-ke-doi-tien),
:is(#app, #ung-dung-ngoai-canh, .nc-modal-overlay) .nc-bong-thoai-tren {
  font-family: var(--font-body) !important;
  font-weight: 700;
  letter-spacing: var(--tracking-copy);
  word-spacing: -0.02em;
  line-height: 1.32;
}

#app :is(.bong-thoai-khach, .chat-khach-loi-thoai, .loi-thoai-khach-ngan, .loi-ke-doi-tien) {
  text-align: left;
}

#app .chat-khach-mobile .chat-khach-loi-thoai {
  /* Two lines at 1.35em, retaining scrolling for longer dialogue. */
  max-height: min(2.7em, calc(var(--chat-zone-height) - 70px));
}

#app :is(.ten-tiem, .tieu-de-modal, h1, h2, h3),
.nc-modal-overlay :is(h1, h2, h3),
#ung-dung-ngoai-canh :is(h1, h2, h3) {
  font-family: var(--font-body);
  letter-spacing: var(--tracking-title);
  word-spacing: -0.03em;
}

/* Signboard display title keeps the retro signboard face when configured. */
#app .ten-tiem,
:is(#app, #ung-dung-ngoai-canh, .nc-modal-overlay) .nc-chu-chinh-bang-hieu {
  font-family: var(--font-signboard, var(--font-pixel)) !important;
}

/* Small monetary labels and counters need open counters and stable digit widths. */
#app :is(.gia-tri-tien-lon, .so-tien-vi-bang-nhap, .gia-tri-sao-lon, .gia-mon-ke, .ngan-keo-gon__menh-gia, .ngan-keo-gon__dem-to, .ngan-keo-gon__tom-tat, .so-luong-badge),
:is(#app, #ung-dung-ngoai-canh, .nc-modal-overlay, .nc-toast) :is(
  .nc-gia-tri-tien-lon,
  .nc-nut-cong-tien-nho,
  .nc-gia-mon-ke,
  .nc-so-luong-badge,
  .nc-badge-tab-nho,
  .nc-toast-chip
) {
  font-family: var(--font-body) !important;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  letter-spacing: var(--tracking-control);
  word-spacing: normal;
}

/* Pixel glyphs align to their designed grid when that optional theme is used. */
html[data-font-game='viet_pixel'] {
  --tracking-title: 0em;
}

/* Handwriting font for the Debt Notebook (Sổ Ghi Nợ) — overrides #app body font reset */
#app .hop-modal-so-no-viet-tay .trang-giay-so-no-lat,
#app .hop-modal-so-no-viet-tay .trang-giay-so-no-lat :is(span, div, p, strong, small, button) {
  font-family: 'Caveat', 'Patrick Hand', cursive !important;
  letter-spacing: 0.01em !important;
  word-spacing: 0.02em !important;
  line-height: 1.3 !important;
}

#app .hop-modal-so-no-viet-tay .trang-giay-so-no-lat .chu-ky-tay-duoi-phai {
  font-family: 'Dancing Script', 'Caveat', 'Patrick Hand', cursive !important;
  line-height: 1.38 !important;
}

