/* ============================================================
   BASE — reset, typography, utilities · Prototype V5
   ============================================================ */
*, *::before, *::after { box-sizing: border-box; }
* { margin: 0; padding: 0; }

html, body { height: 100%; }
body {
  font-family: var(--font);
  font-size: var(--fs-body);
  color: var(--ink);
  background: var(--bg-0);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow: hidden;
}

/* Nền tím-đen chuyển sắc + vignette (dùng cho login & app) */
.bg-cosmos {
  position: fixed; inset: 0; z-index: 0; pointer-events: none;
  background:
    radial-gradient(1200px 800px at 50% -10%, #2a1750 0%, transparent 55%),
    radial-gradient(900px 700px at 90% 110%, #1a0e33 0%, transparent 60%),
    linear-gradient(160deg, var(--bg-0) 0%, #0d0620 45%, var(--bg-1) 100%);
}
.bg-cosmos::after {
  content: ""; position: absolute; inset: 0;
  background: radial-gradient(120% 120% at 50% 40%, transparent 55%, rgba(0,0,0,.5) 100%);
}

/* Bụi vàng mờ tĩnh */
.bg-dust {
  position: fixed; inset: 0; z-index: 0; pointer-events: none; opacity: .5;
  background-image:
    radial-gradient(1px 1px at 12% 22%, rgba(243,213,118,.7), transparent),
    radial-gradient(1px 1px at 78% 14%, rgba(243,213,118,.5), transparent),
    radial-gradient(1px 1px at 34% 68%, rgba(243,213,118,.45), transparent),
    radial-gradient(1px 1px at 62% 82%, rgba(212,175,55,.4), transparent),
    radial-gradient(1px 1px at 88% 56%, rgba(243,213,118,.4), transparent),
    radial-gradient(1px 1px at 22% 88%, rgba(212,175,55,.35), transparent);
}

h1,h2,h3,h4 { font-weight: 700; line-height: 1.25; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; background: none; border: none; }
a { color: inherit; text-decoration: none; }
ul { list-style: none; }
::selection { background: rgba(212,175,55,.35); }

/* Scrollbar tinh */
::-webkit-scrollbar { width: 9px; height: 9px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(212,175,55,.18); border-radius: 8px; border: 2px solid transparent; background-clip: padding-box; }
::-webkit-scrollbar-thumb:hover { background: rgba(212,175,55,.32); background-clip: padding-box; }

/* — Utilities — */
.mono { font-family: var(--mono); }
.tabular { font-variant-numeric: tabular-nums; font-family: var(--mono); }
.num { font-family: var(--mono); font-variant-numeric: tabular-nums; letter-spacing: -.2px; }
.gold { color: var(--gold-l); }
.muted { color: var(--muted); }
.faint { color: var(--faint); }
.ok { color: var(--ok); } .warn { color: var(--warn); } .bad { color: var(--bad); }
.unit { color: var(--faint); font-size: var(--fs-label); margin-left: 3px; }
.cn { color: var(--muted); font-weight: 500; }         /* thuật ngữ Hán đi kèm */
.label {
  font-size: var(--fs-label); font-weight: 700; letter-spacing: .8px;
  text-transform: uppercase; color: var(--faint);
}
.row { display: flex; align-items: center; }
.row.gap { gap: var(--sp-3); }
.col { display: flex; flex-direction: column; }
.spacer { flex: 1; }
.hidden { display: none !important; }
.pos { color: var(--ok); } .neg { color: var(--bad); }

/* Icon helper */
.ic { width: 18px; height: 18px; flex: none; stroke: currentColor; fill: none;
      stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.ic.lg { width: 22px; height: 22px; }
.ic.xl { width: 28px; height: 28px; }
.ic.sm { width: 15px; height: 15px; }

/* Chip trạng thái */
.dot { width: 7px; height: 7px; border-radius: 50%; flex: none; display: inline-block; }
.dot.live { background: var(--ok); box-shadow: 0 0 0 3px rgba(74,222,128,.15); }
.dot.wait { background: var(--purple-l); }
.dot.pend { background: var(--warn); }
.dot.bad  { background: var(--bad); }
.dot.pulse { animation: dotPulse 1.2s var(--ease-io) infinite; }

@keyframes dotPulse { 0%,100% { opacity: .45; } 50% { opacity: 1; } }
@keyframes shimmer { 0% { background-position: -200% 0; } 100% { background-position: 200% 0; } }
@keyframes fadeUp { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
@keyframes slideInR { from { opacity: 0; transform: translateX(12px); } to { opacity: 1; transform: none; } }
@keyframes shake { 10%,90% { transform: translateX(-2px); } 30%,70% { transform: translateX(2px); } 50% { transform: translateX(-2px); } }
@keyframes goldSweep { 0% { transform: translateX(-120%); } 100% { transform: translateX(220%); } }
@keyframes breathe { 0% { transform: scale(1); } 45% { transform: scale(1.045); } 100% { transform: scale(1); } }
@keyframes goldFlash { 0% { box-shadow: 0 0 0 0 rgba(243,213,118,0); } 30% { box-shadow: 0 0 0 2px rgba(243,213,118,.5); } 100% { box-shadow: 0 0 0 0 rgba(243,213,118,0); } }

.skel {
  background: linear-gradient(90deg, rgba(255,255,255,.03) 25%, rgba(212,175,55,.10) 37%, rgba(255,255,255,.03) 63%);
  background-size: 200% 100%; animation: shimmer 1.2s linear infinite; border-radius: var(--r-sm);
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; }
}
/* Strict language boundary: legacy paired labels are marked by i18n.js.
   Exactly one copy is visible; names and other user-entered data are untouched. */
html[data-lang="vi"] [data-lang-copy="zh"] { display: none !important; }
html[data-lang="zh"] .yd-lang-primary { display: none !important; }
