/* International layout helpers — logical, resilient and Telegram WebView friendly */
[dir="ltr"] .flip-rtl { transform: none; }

html, body { text-rendering: optimizeLegibility; }
body { overflow-x: hidden; }
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background:
    radial-gradient(70% 34% at 12% 0%, rgba(200,242,122,.08), transparent 72%),
    radial-gradient(55% 28% at 94% 18%, rgba(94,234,212,.05), transparent 72%);
}
button, a, input, textarea, select { -webkit-tap-highlight-color: transparent; }
button, a { touch-action: manipulation; }
#connection[data-state="offline"] { border-color: color-mix(in srgb, #ff8f9c 48%, var(--line)); }
#connection[data-state="online"] { border-color: color-mix(in srgb, var(--nx-lime, #c8f27a) 48%, var(--line)); }
#connection[data-state="online"] #retryLoad { background: var(--surface); color: var(--text); }
button:focus-visible, a:focus-visible, input:focus-visible, textarea:focus-visible, select:focus-visible {
  outline: 3px solid color-mix(in srgb, var(--nx-lime, #c8f27a) 72%, transparent);
  outline-offset: 3px;
}

/* Burmese strings need more breathing room; English keeps a tighter editorial rhythm. */
html[lang="my"] body { letter-spacing: 0; }
html[lang="my"] .page-heading h1,
html[lang="my"] .section-heading h2,
html[lang="my"] .card-title,
html[lang="my"] .task-body strong { line-height: 1.55; }
html[lang="en"] body { letter-spacing: -0.005em; }

/* Never let a long translated label break the shell. */
.page, .surface, .card, .task-card, .board-row, .activity-row,
.admin-context, .admin-heading, .profile-hero, .wallet-asset { min-width: 0; }
.page *, .surface *, .card *, .task-card *, .board-row *, .activity-row * { overflow-wrap: anywhere; }

/* Comfortable controls without changing their visual icon scale. */
.close-button, #marketClose, .icon-button { min-width: 42px; min-height: 42px; }
.text-button { min-height: 40px; padding-inline: 8px; }
.bottom-nav button { min-height: 58px; }
.button, .task-card, .nx-shortcut, .nx-guide, .method-btn, .bottom-nav button {
  transition: transform .18s var(--nx-ease, cubic-bezier(.22,1,.36,1)), border-color .18s ease, background-color .18s ease, box-shadow .18s ease;
}
.button:hover, .task-card:hover, .nx-shortcut:hover, .nx-guide:hover, .method-btn:hover { transform: translateY(-1px); }
.button:active, .task-card:active, .nx-shortcut:active, .nx-guide:active, .method-btn:active { transform: scale(.985); }
.task-card[data-task-state="available"] { border-color: color-mix(in srgb, var(--nx-lime, #c8f27a) 28%, var(--line)); }

/* Calm page entry: only the active surface moves. */
.page { animation: none; }
.page.active { animation: nx-rise .32s var(--nx-ease, cubic-bezier(.22,1,.36,1)) both; }
.page.active > :not(.admin-layout):nth-child(1) { animation: nx-rise .34s var(--nx-ease, cubic-bezier(.22,1,.36,1)) .02s both; }
.page.active > :not(.admin-layout):nth-child(2) { animation: nx-rise .34s var(--nx-ease, cubic-bezier(.22,1,.36,1)) .06s both; }
.page.active > :not(.admin-layout):nth-child(3) { animation: nx-rise .34s var(--nx-ease, cubic-bezier(.22,1,.36,1)) .10s both; }
.page.active > :not(.admin-layout):nth-child(4) { animation: nx-rise .34s var(--nx-ease, cubic-bezier(.22,1,.36,1)) .14s both; }
.page.active .task-list > :nth-child(1),
.page.active .wallet-assets > :nth-child(1) { animation: nx-rise .30s var(--nx-ease, cubic-bezier(.22,1,.36,1)) .04s both; }
.page.active .task-list > :nth-child(2),
.page.active .wallet-assets > :nth-child(2) { animation: nx-rise .30s var(--nx-ease, cubic-bezier(.22,1,.36,1)) .09s both; }
.page.active .task-list > :nth-child(3),
.page.active .wallet-assets > :nth-child(3) { animation: nx-rise .30s var(--nx-ease, cubic-bezier(.22,1,.36,1)) .14s both; }

/* International-style status surfaces: visible state, quiet motion. */
.surface, .task-card, .wallet-asset, .settings-row, .pass-card, .event-card {
  box-shadow: 0 8px 26px rgba(0,0,0,.06);
}
.surface:hover, .task-card:hover, .settings-row:hover, .wallet-asset:hover {
  border-color: color-mix(in srgb, var(--nx-lime, #c8f27a) 24%, var(--line));
}
#activityList[aria-busy="true"] { opacity: .72; pointer-events: none; }
#activityList[aria-busy="false"] { opacity: 1; transition: opacity .18s ease; }
.status[data-state="success"] { color: var(--nx-lime, #c8f27a); }
.status[data-state="error"] { color: var(--danger, #ff8f9c); }
.pass-status[data-state="active"] { border: 1px solid color-mix(in srgb, var(--nx-lime, #c8f27a) 34%, transparent); }
.pass-status[data-state="pending"] { border: 1px solid color-mix(in srgb, #e7c46a 34%, transparent); color: color-mix(in srgb, var(--text) 78%, #d3a53c); }
.pass-status[data-state="available"] { border: 1px solid color-mix(in srgb, var(--nx-lime, #c8f27a) 18%, transparent); }
.withdrawal-form[aria-busy="true"] .withdraw-fields { opacity: .78; }
.withdrawal-form .status[data-state="success"] { animation: nx-confirm .5s var(--nx-ease, cubic-bezier(.22,1,.36,1)) both; }
@keyframes nx-confirm { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }
.bottom-nav button { position: relative; }
.bottom-nav button.selected::after {
  content: "";
  position: absolute;
  bottom: 3px;
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: var(--nx-lime, #c8f27a);
  box-shadow: 0 0 10px rgba(200,242,122,.7);
}
.bottom-nav button.selected [data-icon] { transform: translateY(-1px); }
dialog.sheet::backdrop { background: rgba(3,8,6,.62); backdrop-filter: blur(5px); }
dialog.sheet[open] { animation: nx-sheet-in .28s var(--nx-ease, cubic-bezier(.22,1,.36,1)) both; }
@keyframes nx-sheet-in { from { opacity: 0; transform: translateY(18px) scale(.98); } to { opacity: 1; transform: none; } }
.toast { animation: nx-toast-in .3s var(--nx-ease, cubic-bezier(.22,1,.36,1)) both; }
@keyframes nx-toast-in { from { opacity: 0; transform: translate(-50%, 12px); } to { opacity: 1; transform: translate(-50%, 0); } }

/* Narrow screens: let translated labels stack before they collide. */
@media (max-width: 460px) {
  .greeting { align-items: flex-start; }
  .greeting .pass-mini { flex: 0 0 auto; }
  #page-profile .profile-links { grid-template-columns: 1fr; }
  .withdraw-methods { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .withdraw-methods .method-btn:last-child { grid-column: 1 / -1; }
  .admin-heading { align-items: flex-start; }
  .admin-heading-actions { width: 100%; }
  .admin-heading-actions .button { flex: 1 1 0; }
}
@media (max-width: 340px) {
  .withdraw-methods { grid-template-columns: 1fr; }
  .withdraw-methods .method-btn:last-child { grid-column: auto; }
  .action-pair { display: grid; grid-template-columns: 1fr; }
  #page-wallet .wallet-assets { grid-template-columns: 1fr; }
  #page-pass .pass-plan { align-items: flex-start; padding: 14px; }
  #page-pass .pass-plan > strong { white-space: nowrap; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .001ms !important;
    animation-iteration-count: 1 !important;
    scroll-behavior: auto !important;
    transition-duration: .001ms !important;
  }
  .page.active { animation: none; }
  .withdrawal-form .status[data-state="success"] { animation: none; }
}
