/*
 * BitBull / StockBull shared typography.
 * Noto Sans CJK JP: SIL Open Font License 1.1.
 * Roboto: Apache License 2.0. License copies are stored beside the font files.
 */
@font-face {
  font-family: "BitBull UI";
  src: url("/fonts/BitBullUI-Regular-v1.woff2") format("woff2");
  font-style: normal;
  font-weight: 400;
  font-display: swap;
}

@font-face {
  font-family: "BitBull UI";
  src: url("/fonts/BitBullUI-Bold-v1.woff2") format("woff2");
  font-style: normal;
  font-weight: 700;
  font-display: swap;
}

@font-face {
  font-family: "BitBull Display";
  src: url("/fonts/BitBullDisplay-Black-v1.woff2") format("woff2");
  font-style: normal;
  font-weight: 900;
  font-display: swap;
}

@font-face {
  font-family: "BitBull Display";
  src: url("/fonts/BitBullDisplay-BlackItalic-v1.woff2") format("woff2");
  font-style: italic;
  font-weight: 900;
  font-display: swap;
}

/* Demo-only, self-hosted subsets. Original designs: Archivo Black and
   Noto Sans JP Black (SIL OFL); license copies live beside these files. */
@font-face {
  font-family: "BitBull Demo Digits";
  src: url("/fonts/ArchivoBlack-Demo-v1.woff") format("woff");
  font-style: normal;
  font-weight: 900;
  font-display: swap;
  unicode-range: U+0020-0039, U+00A5, U+00B1;
}

@font-face {
  font-family: "BitBull Demo Units";
  src: url("/fonts/NotoSansJP-Units-Black-v1.woff2") format("woff2");
  font-style: normal;
  font-weight: 900;
  /* Noto's kanji are taller than Archivo's numerals at the same em size.
     64% gives approximately 80% painted height; the subset aligns the bottom.
     Canvas uses this face too, preserving accurate automatic fitting. */
  size-adjust: 64%;
  font-display: swap;
  unicode-range: U+202F, U+4E07, U+4EAC, U+5104, U+5146, U+5186, U+5793, U+FFE5;
}

/* Smaller units for the BitBull trial only: about 70% painted numeral height. */
@font-face {
  font-family: "BitBull Demo Small Units";
  src: url("/fonts/NotoSansJP-Units-Black-v1.woff2") format("woff2");
  font-style: normal;
  font-weight: 900;
  size-adjust: 56%;
  font-display: swap;
  unicode-range: U+202F, U+4E07, U+4EAC, U+5104, U+5146, U+5186, U+5793, U+FFE5;
}

/* Bowlby One SC trial: BitBull demo amounts only. */
@font-face {
  font-family: "BitBull Demo Bowlby";
  src: url("/fonts/BowlbyOneSC-Demo-v1.woff2") format("woff2");
  font-style: normal;
  font-weight: 900;
  size-adjust: 92%;
  font-display: swap;
  unicode-range: U+0020-0039, U+00B1, U+2212;
}

:root {
  --font-ui: "BitBull UI", "Noto Sans JP", "Hiragino Sans", "Yu Gothic UI", sans-serif;
  --font-display: "BitBull Display", "BitBull UI", "Arial Black", Arial, sans-serif;
  font-family: var(--font-ui);
}

html body,
button,
input,
select,
textarea,
optgroup,
option {
  font-family: var(--font-ui);
  /* Noto is slightly slimmer than the former iPad system font. */
  -webkit-text-stroke: 0.12px currentColor;
  text-rendering: optimizeLegibility;
}

/* Preserve the bold, energetic chart-card language across every device. */
html body :is(#portfolio-total,#portfolio-change,#totalValue,#performanceValue,#demoBalanceCompact,#demoBalance,#demoBestBalance,#demoEquity,#demoPnlCompact strong,#demoPnlMobile strong,#demoUnrealized strong,#stock-demo-balance-compact,#stock-demo-balance,#stock-demo-best,#stock-demo-equity,#stock-demo-pnl strong,#stock-demo-unrealized strong).demo-layered-amount {
  font-family: "BitBull Demo Bowlby", "BitBull Demo Small Units", var(--font-display);
  letter-spacing: 0;
  white-space: nowrap;
  isolation: isolate;
  -webkit-text-stroke: 0;
}
.demo-layered-amount .demo-amount-char {
  display: inline-block;
  position: relative;
  letter-spacing: 0;
  paint-order: stroke fill;
  -webkit-text-stroke: .0375em #fff;
}
/* Only neighboring digits overlap; 万 / 円 keep their existing unit spacing. */
.demo-layered-amount .demo-amount-digit + .demo-amount-digit {
  margin-left: -.075em;
}
/* Trim the large intrinsic side bearings on Bowlby's 1, including beside units.
   The fitter mirrors these em offsets so scale/glow still stays inside its box. */
.demo-layered-amount .demo-amount-one {
  margin-left: -.07em;
  margin-right: -.16em;
}
.demo-layered-amount .demo-amount-digit + .demo-amount-one {
  margin-left: -.145em;
}
.demo-layered-amount .demo-amount-unit {
  -webkit-text-stroke: .38px currentColor;
}
/* Allow the common balance size in StockBull's slightly shorter amount card. */
html body .stock-demo-balance { padding-block: 3px; }

:is(
  .coin-symbol,
  .change,
  .market-change,
  .market-price,
  .price,
  .favorite-symbol,
  .favorite-change,
  .favorite-price,
  .gainer-symbol,
  .gainer-change,
  .portfolio-total strong,
  .demo-trade-toggle-pnl strong,
  .demo-trade-toggle-balance strong
) {
  font-family: var(--font-display);
  font-weight: 900;
}

/* Primary live figures share the chart cards' bold, forward-leaning style. */
:is(
  .coin-card .change,
  .coin-card .price,
  .market-card .market-change,
  .market-card .market-price,
  .demo-trade-toggle-pnl strong,
  .demo-trade-toggle-balance strong,
  .demo-trade-summary strong,
  .demo-unrealized strong,
  .stock-demo-pnl strong,
  .stock-demo-balance strong,
  .stock-demo-summary strong,
  .stock-demo-unrealized strong,
  #stock-demo-equity,
  .total-box strong,
  #totalDelta,
  .donut strong,
  .performance strong,
  .legend-row span,
  .asset-meta b,
  .asset-meta small,
  #assetCount,
  .portfolio-total strong,
  .portfolio-total span,
  .allocation-legend b,
  .history-summary,
  #holding-count,
  .holding-copy span,
  .holding-value strong,
  .metric strong
) {
  font-family: var(--font-display);
  font-style: italic;
  font-weight: 900;
  font-variant-numeric: tabular-nums;
}

/* Keep both boards' chart-card symbols equally bold and energetic. */
html body :is(.coin-card, .market-card) h3.coin-symbol {
  font-family: var(--font-display);
  font-weight: 900;
  -webkit-text-stroke: 0.38px currentColor;
}

/* Demo amounts use the card display face, including the Japanese unit fallback.
   Match the card headings' extra ink so 万 / 円 retain the same visual impact.
   Do not scale the element: the balance animation needs its existing transform. */
html body :is(
  #demoBalanceCompact, #demoBalance, #demoBestBalance, #demoEquity,
  #demoPnlCompact strong, #demoPnlMobile strong, #demoUnrealized strong,
  #demoMarketPrice, #demoEntryPrice, #demoCurrentPrice,
  #stock-demo-balance-compact, #stock-demo-balance, #stock-demo-best,
  #stock-demo-equity, #stock-demo-pnl strong, #stock-demo-unrealized strong,
  #stock-demo-market-price, #stock-demo-entry, #stock-demo-current-price
) {
  font-family: var(--font-display);
  font-weight: 900;
  font-style: italic;
  font-variant-numeric: tabular-nums;
  -webkit-text-stroke: 0.38px currentColor;
}

/* Price-tag style for demo equity and P/L. Both faces receive the same
   synthetic italic; no element transform is used, preserving the scale/glow. */
html body :is(
  #demoBalanceCompact, #demoBalance, #demoBestBalance, #demoEquity,
  #demoPnlCompact strong, #demoPnlMobile strong, #demoUnrealized strong,
  #stock-demo-balance-compact, #stock-demo-balance, #stock-demo-best,
  #stock-demo-equity, #stock-demo-pnl strong, #stock-demo-unrealized strong
) {
  font-family: "BitBull Demo Digits", "BitBull Demo Units", var(--font-display);
  font-synthesis: style;
  letter-spacing: -0.045em;
}

:is(
  .grid-label,
  .axis-label,
  .chart-percent-label,
  .chart-price-label,
  .baseline-price,
  .bull-price-axis text,
  .pulse-node-labels text,
  .pulse-node-lens text
) {
  font-family: var(--font-display);
}

