/* Monopy — design system
   ============================================================
   Monopy is not a casino app; it is a currency with games
   attached. Players come to be seen holding a number, and the
   games are how that number moves. Every decision below follows
   from that:

   - Gold is the material the currency is made of, so it is a
     milled metal ramp, never a flat swatch. Flat gold reads as
     a highlighter; milled gold reads as money.
   - The interface is severe and bank-like so the number carries
     weight. A big balance in a toy interface is worth nothing.
   - Rank is visible without reading digits, because the point
     is being recognised across a room.

   Screens live in style.css. This file owns tokens, type, the
   metal, the chrome, and the parts every screen is built from.
   Adding a section to Monopy should mean assembling from here,
   not inventing another card style. */

:root {
  /* --- ground ---------------------------------------------
     Near-black carried a few degrees toward the gold rather
     than away from it. The blue-grey this replaced was the
     "серость" — a cold neutral reads as unfinished next to a
     warm metal, however dark it is. */
  --bg: #0a0906;
  --bg-deep: #070604;
  --bg-2: #0e0c09;
  --surface: #17150f;
  --surface-2: #1f1c15;
  --surface-3: #2a261d;

  --line: rgba(255, 255, 255, 0.07);
  --line-2: rgba(255, 255, 255, 0.12);
  --line-3: rgba(255, 255, 255, 0.18);
  --line-gold: rgba(201, 152, 47, 0.32);

  --text: #f3f5f9;
  --muted: #8d95a6;
  --faint: #5c6577;

  /* --- the metal -------------------------------------------
     One ramp, used everywhere gold appears. Deeper and more
     saturated than a bright amber — antique gold, not a
     highlighter. The dark band at 52% is the bevel's shadow:
     without it the gradient is just a yellow fade and the metal
     illusion collapses. */
  --gold: #c9982f;
  --gold-hi: #ffdf9e;
  --gold-dim: #8a6420;
  --metal: linear-gradient(
    168deg,
    #ffdf9e 0%,
    #eec573 14%,
    #c9982f 34%,
    #8f6a1c 52%,
    #ac7d24 68%,
    #e2ba55 86%,
    #ffdf9e 100%
  );
  /* Flatter, for surfaces that carry dark text on top. */
  --metal-solid: linear-gradient(
    177deg,
    #f2d488 0%,
    #d6a53a 38%,
    #a87c22 62%,
    #e2b855 100%
  );

  /* --- the second metal --------------------------------------
     Sapphire: the interface's own accent — which tab, which
     screen, what's selected — kept apart from gold on purpose, so
     gold never stops meaning money. Same bevelled-ramp shape as
     the gold ramp, just shifted to a cool jewel tone. */
  --sapphire: #3d6fd6;
  --sapphire-hi: #8fb4ff;
  --sapphire-dim: #24437f;
  --line-sapphire: rgba(61, 111, 214, 0.32);
  --shadow-sapphire: 0 6px 20px rgba(61, 111, 214, 0.28);

  /* --- meaning ---------------------------------------------
     Only three hues mean anything: gold is money, green is
     alive or won, red is lost. Nothing else is allowed to. */
  --green: #1fa971;
  --green-hi: #35c98c;
  --red: #d93a45;
  --red-hi: #f0616b;

  /* The table stays green, but a deep jewel green under a gold
     edge — a felt, not a lawn. */
  --felt: #0c3527;
  --felt-2: #082418;
  --felt-3: #05170f;

  /* --- rank ------------------------------------------------
     Wealth tiers, readable at a glance. The top tier wears the
     brand's own metal on purpose: reaching it means looking
     like the app itself. */
  --rank-1: #8b97a8; /* сталь   — от 100K */
  --rank-2: #b5763a; /* бронза  — от 1M   */
  --rank-3: #c9982f; /* золото  — от 10M  */
  --rank-4: #d8dbe6; /* платина — от 100M */

  /* --- geometry --------------------------------------------
     Three steps, scaling with the element. A chip and a sheet
     sharing one radius is the tell of a generated layout. */
  --r-1: 8px;
  --r-2: 14px;
  --r-3: 20px;
  --r-pill: 999px;

  --topbar-h: 58px;
  --tabbar-h: 60px;

  --shadow-1: 0 2px 8px rgba(0, 0, 0, 0.4);
  --shadow-2: 0 12px 32px rgba(0, 0, 0, 0.55);
  --shadow-gold: 0 6px 20px rgba(180, 128, 38, 0.28);
}

/* ============================================================
   Reset
   ============================================================ */

* {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

html,
body {
  margin: 0;
  padding: 0;
  min-height: 100%;
}

body {
  /* The security hatch under everything: two hairline rulings crossing
     at a shallow angle, the way the field of a banknote is laid before
     any rosette goes on it. Far too faint to see as lines — it exists
     so the dark never reads as an empty fill, which is what made the
     old ground feel grey. */
  background-color: var(--bg);
  background-image:
    repeating-linear-gradient(
      64deg,
      rgba(201, 152, 47, 0.02) 0 1px,
      transparent 1px 7px
    ),
    repeating-linear-gradient(
      -64deg,
      rgba(201, 152, 47, 0.015) 0 1px,
      transparent 1px 9px
    );
  background-attachment: fixed;
  color: var(--text);
  font-family: "Onest", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
    sans-serif;
  font-size: 15px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
  overscroll-behavior: none;
}

/* --- the ground ------------------------------------------------------
   Two fixed layers, because a flat dark field is the one thing that
   makes an expensive interface look cheap.

   Underneath: an engraved guilloché rosette, the figure banknotes,
   share certificates and passports all carry. It is the visual grammar
   of money, it fills a dark field with structure without introducing a
   second colour, and it cannot be mistaken for a stock gradient. Kept
   faint enough to be felt rather than read.

   Over it: the warm pool of light the room is lit by, plus a vignette
   so the edges fall away instead of ending. */

body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -2;
  pointer-events: none;
  background-image: url("/img/guilloche.svg");
  background-repeat: no-repeat;
  background-position: 50% 2%;
  background-size: 104% auto;
  /* Felt, not read. Louder than this and the fine strokes start to
     look like straw laid over the screen rather than engraving in it. */
  opacity: 0.085;
}

body::after {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background:
    radial-gradient(118% 56% at 50% -10%, rgba(214, 154, 48, 0.17), transparent 60%),
    radial-gradient(88% 44% at 50% 104%, rgba(26, 88, 66, 0.11), transparent 68%),
    radial-gradient(140% 100% at 50% 42%, transparent 42%, rgba(0, 0, 0, 0.55) 100%);
}

button {
  font-family: inherit;
  font-size: inherit;
  color: inherit;
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
}

:focus-visible {
  outline: 2px solid var(--gold);
  outline-offset: 2px;
}

/* ============================================================
   Type
   ============================================================
   Onest runs the interface. Unbounded is reserved for money and
   the brand — it is wide and expensive-looking, which is wrong
   for body copy and right for a balance. */

.num,
.money,
input[type="number"] {
  font-variant-numeric: tabular-nums;
  font-feature-settings: "tnum" 1;
}

h1,
h2,
h3,
h4,
.display {
  font-family: "Unbounded", "Onest", sans-serif;
  font-weight: 800;
  letter-spacing: -0.02em;
  margin: 0;
}

/* Section headings label, they do not announce. */
.sec {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  padding: 24px 16px 10px;
}

.sec-title {
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--faint);
}

.sec-link {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--gold);
}

.sec-link:active {
  color: var(--gold-hi);
}

/* ============================================================
   The metal
   ============================================================
   Two ways to wear it: as ink (numbers, marks) and as a surface
   (the one primary action per screen). Nothing else gets it —
   spread everywhere it stops reading as precious, which defeats
   the entire point of using it. */

.metal-ink {
  background: var(--metal);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.metal-face {
  background: var(--metal-solid);
  color: #22160a;
}

/* ============================================================
   The coin
   ============================================================
   Monopy's currency mark: an M crossed by a bar, the way real
   currency symbols are built (₽ ₿ ¥ € are each a letter plus a
   stroke). Drawn as inline SVG so every sum in the product is
   marked the same way. */

/* Gold explicitly, never inherited: the mark is usually set inside a
   metal-clipped number, and those carry `color: transparent` to let the
   gradient through — an inheriting mark would vanish there. */
.coin {
  display: inline-block;
  vertical-align: -0.12em;
  width: 1em;
  height: 1em;
  flex: none;
  color: var(--gold);
  -webkit-text-fill-color: currentColor;
}

.coin svg {
  display: block;
  width: 100%;
  height: 100%;
}

/* A sum and its mark travel together and never wrap apart. */
.sum {
  display: inline-flex;
  align-items: center;
  gap: 0.32em;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

/* ============================================================
   Shell
   ============================================================ */

#app {
  max-width: 560px;
  margin: 0 auto;
  min-height: 100vh;
}

.view {
  animation: viewIn 0.28s cubic-bezier(0.2, 0.8, 0.3, 1);
  padding-bottom: calc(28px + env(safe-area-inset-bottom));
}

.view.tabbed {
  padding-bottom: calc(var(--tabbar-h) + 18px + env(safe-area-inset-bottom));
}

.view.barred {
  padding-top: var(--topbar-h);
}

/* --- top bar ---------------------------------------------
   Brand left, money right, and the money is the biggest thing
   on the bar. The deposit control sits against the number it
   changes rather than buried in a wallet tab. */

.topbar {
  height: var(--topbar-h);
  max-width: 560px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 0 14px;
  background: rgba(10, 9, 6, 0.86);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--line);
}

/* Only the app's own bar is pinned. A pushed game paints its own header
   inside its view, and pinning that one too took it out of the flow —
   the felt then started underneath it and the dealer's cards were cut
   off by it. The `header` tag is what separates them: the shared bar is
   one, a game's header is a div. */
header.topbar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 40;
}

.topbar-brand {
  display: flex;
  align-items: center;
  gap: 7px;
  font-family: "Unbounded", sans-serif;
  font-weight: 800;
  font-size: 14px;
  letter-spacing: 0.01em;
  background: var(--metal);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.topbar-title {
  font-size: 14px;
  font-weight: 700;
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: 8px;
}

.purse {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 7px 12px;
  border-radius: var(--r-1);
  background: var(--surface);
  border: 1px solid var(--line-gold);
}

/* The word "Баланс" is noise next to a coin mark and a number. */
.purse-label {
  display: none;
}

.purse-sum {
  font-family: "Unbounded", sans-serif;
  font-weight: 800;
  font-size: 14.5px;
  letter-spacing: -0.01em;
  background: var(--metal);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.purse-add {
  display: grid;
  place-items: center;
  width: 33px;
  height: 33px;
  border-radius: var(--r-1);
  background: var(--metal-solid);
  box-shadow: var(--shadow-1);
  transition: transform 0.14s;
}

.purse-add:active {
  transform: scale(0.92);
}

.purse-add svg {
  width: 16px;
  height: 16px;
  fill: none;
  stroke: #22160a;
  stroke-width: 2.6;
  stroke-linecap: round;
}

.back-btn {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 7px 12px 7px 9px;
  border-radius: var(--r-1);
  background: var(--surface);
  border: 1px solid var(--line);
  font-size: 13px;
  font-weight: 600;
  color: var(--muted);
}

.back-btn:active {
  background: var(--surface-2);
  color: var(--text);
}

/* The balance as it appears inside a pushed game screen. */
.balance {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 12px;
  border-radius: var(--r-1);
  background: var(--surface);
  border: 1px solid var(--line-gold);
  font-family: "Unbounded", sans-serif;
  font-weight: 800;
  font-size: 14px;
  font-variant-numeric: tabular-nums;
  background-clip: padding-box;
  color: var(--gold-hi);
}

/* Sized via font-size, same convention as .hero-coin/.card-coin — .coin
   itself is 1em square. Was a plain filled circle standing in for the
   mark; every other balance in the product already carries the real
   currency glyph, so a game screen's own topbar should too. */
.balance-coin {
  font-size: 13px;
}

/* --- tab bar ---------------------------------------------
   Four destinations. The active one is marked by a gold rule
   over the item and by the icon lighting up — how a shipped
   product marks a tab, not with a coloured blob. */

.tabbar {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 40;
  max-width: 560px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  height: calc(var(--tabbar-h) + env(safe-area-inset-bottom));
  /* Five destinations fit at 390px; the labels just have to stop
     asking for the letter-spacing four of them could afford. */
  padding-bottom: env(safe-area-inset-bottom);
  background: rgba(10, 9, 6, 0.93);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-top: 1px solid var(--line);
}

.tabbar-5 {
  grid-template-columns: repeat(5, minmax(0, 1fr));
}

.tab {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 0 2px;
  color: var(--faint);
  font-size: 9.5px;
  font-weight: 600;
  letter-spacing: 0.03em;
  transition: color 0.16s;
}

.tab > span {
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.tabbar-5 .tab {
  font-size: 9px;
  letter-spacing: 0;
}

.tab svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.tab::before {
  content: "";
  position: absolute;
  top: 0;
  left: 50%;
  width: 0;
  height: 2px;
  border-radius: 0 0 2px 2px;
  /* Sapphire, not gold — which tab is open is a navigation fact,
     not a money one, and gold stays reserved for the second. */
  background: linear-gradient(90deg, var(--sapphire-dim), var(--sapphire-hi));
  transform: translateX(-50%);
  transition: width 0.2s cubic-bezier(0.2, 0.8, 0.3, 1);
}

.tab.on {
  color: var(--sapphire-hi);
}

.tab.on::before {
  width: 24px;
}

/* ============================================================
   Parts
   ============================================================ */

.panel {
  margin: 0 14px;
  border-radius: var(--r-2);
  background: var(--surface);
  border: 1px solid var(--line);
  overflow: hidden;
}

/* A card that matters carries a hairline of light along its top
   edge, the way a raised surface actually catches it. */
.panel.raised {
  position: relative;
  background: linear-gradient(180deg, var(--surface-2), var(--surface));
  box-shadow: var(--shadow-1);
}

.panel.raised::before {
  content: "";
  position: absolute;
  top: 0;
  left: 14px;
  right: 14px;
  height: 1px;
  background: linear-gradient(
    90deg,
    transparent,
    rgba(255, 255, 255, 0.14),
    transparent
  );
}

.panel-note {
  padding: 10px 14px;
  font-size: 12.5px;
  line-height: 1.5;
  color: var(--faint);
}

.kv {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
}

.kv:last-child {
  border-bottom: none;
}

.kv-k {
  font-size: 13.5px;
  color: var(--muted);
}

.kv-v {
  font-size: 13.5px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

/* --- buttons --- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 14px 18px;
  border-radius: var(--r-2);
  font-size: 14.5px;
  font-weight: 700;
  line-height: 1;
  transition: transform 0.14s, opacity 0.14s, background 0.16s;
}

.btn:active:not(:disabled) {
  transform: scale(0.975);
}

.btn:disabled {
  opacity: 0.4;
  cursor: default;
}

/* The one primary action per screen, and the only surface in
   the product allowed to wear the metal. */
.btn-primary {
  position: relative;
  background: var(--metal-solid);
  color: #22160a;
  font-weight: 800;
  box-shadow: var(--shadow-gold);
  overflow: hidden;
}

/* A slow highlight crosses the face — light moving over a
   milled surface as the phone tilts. Once, on the single gold
   object on screen; anywhere else it would be decoration. */
.btn-primary:not(:disabled)::after {
  content: "";
  position: absolute;
  top: -60%;
  bottom: -60%;
  left: -50%;
  width: 38%;
  background: linear-gradient(
    100deg,
    transparent,
    rgba(255, 255, 255, 0.5),
    transparent
  );
  transform: skewX(-18deg);
  animation: sheen 4.6s ease-in-out infinite;
}

.btn-primary:disabled {
  box-shadow: none;
}

.btn-ghost {
  background: var(--surface);
  border: 1px solid var(--line-2);
  color: var(--text);
  font-weight: 600;
}

.btn-ghost:active:not(:disabled) {
  background: var(--surface-2);
}

.actions,
.bet-actions {
  display: flex;
  gap: 8px;
}

.actions .btn,
.bet-actions .btn {
  flex: 1;
  min-width: 0;
}

/* --- tags & rank --- */

.tag {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 8px;
  border-radius: var(--r-1);
  background: var(--surface-2);
  border: 1px solid var(--line);
  font-size: 11px;
  font-weight: 700;
  color: var(--muted);
}

.tag.num {
  font-variant-numeric: tabular-nums;
}

.tag-live {
  color: var(--green-hi);
  border-color: rgba(31, 169, 113, 0.3);
  background: rgba(31, 169, 113, 0.1);
}

.tag-live i {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--green-hi);
  animation: livePulse 2s ease-in-out infinite;
}

/* Rank: the product's status system in one chip. Colour alone
   carries the tier, so it stays legible at leaderboard size. */
.rank-badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 9px;
  border-radius: var(--r-pill);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--tone, var(--faint));
  border: 1px solid var(--tone, var(--faint));
  background: transparent;
}

.rank-badge.r1 { --tone: var(--rank-1); }
.rank-badge.r2 { --tone: var(--rank-2); }
.rank-badge.r3 { --tone: var(--rank-3); }

/* Top tier only: the badge stops being an outline and becomes
   the metal itself. */
.rank-badge.r4 {
  background: var(--metal-solid);
  border-color: transparent;
  color: #22160a;
}

/* --- states --- */

.empty {
  padding: 28px 20px;
  text-align: center;
  font-size: 13.5px;
  color: var(--faint);
}

.error {
  min-height: 18px;
  text-align: center;
  font-size: 13px;
  font-weight: 600;
  color: var(--red-hi);
}

.error:empty {
  display: none;
}

.gold { color: var(--gold); }
.green, .win { color: var(--green-hi); }
.red, .lose { color: var(--red-hi); }
.muted { color: var(--muted); }

/* --- boot --- */

.loader {
  display: grid;
  place-items: center;
  min-height: 100vh;
}

.spinner {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 2px solid var(--line-2);
  border-top-color: var(--gold);
  animation: spin 0.8s linear infinite;
}

/* ============================================================
   Motion
   ============================================================
   Movement is feedback: it marks what the player caused, or
   what the server just changed. Nothing animates merely because
   it is on screen. */

@keyframes viewIn {
  from {
    opacity: 0;
    transform: translateY(6px);
  }
}

@keyframes rowIn {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
}

@keyframes popIn {
  from {
    opacity: 0;
    transform: scale(0.88);
  }
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

@keyframes sheen {
  0%,
  62% {
    left: -50%;
  }
  92%,
  100% {
    left: 115%;
  }
}

@keyframes livePulse {
  50% {
    opacity: 0.35;
  }
}

/* Lists arrive row by row, which reads as loading rather than
   flickering. Capped early — a long list should not make the
   player sit through a queue. */
.stagger > * {
  animation: rowIn 0.3s cubic-bezier(0.2, 0.8, 0.3, 1) backwards;
}
.stagger > *:nth-child(1) { animation-delay: 0.02s; }
.stagger > *:nth-child(2) { animation-delay: 0.06s; }
.stagger > *:nth-child(3) { animation-delay: 0.1s; }
.stagger > *:nth-child(4) { animation-delay: 0.14s; }
.stagger > *:nth-child(5) { animation-delay: 0.18s; }
.stagger > *:nth-child(6) { animation-delay: 0.22s; }
.stagger > *:nth-child(n + 7) { animation-delay: 0.26s; }

/* A number that just changed flicks over, so money moving is
   noticed without a banner announcing it. */
.tick {
  animation: popIn 0.34s cubic-bezier(0.2, 0.9, 0.3, 1);
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* ============================================================
   Coin bursts
   ============================================================
   Fired from particles.js when money actually arrives. The layer is
   fixed and pointer-transparent, so a burst never blocks the control
   the player just pressed. */

.burst {
  position: fixed;
  z-index: 60;
  width: 0;
  height: 0;
  pointer-events: none;
}

.burst > i {
  position: absolute;
  left: -3px;
  top: -3px;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--metal-solid);
  box-shadow: 0 0 6px rgba(240, 198, 92, 0.7);
  transform: rotate(var(--a)) translateY(0) scale(var(--s));
  animation: fleck 0.78s cubic-bezier(0.16, 0.72, 0.3, 1) forwards;
}

/* Out along its own angle, then down and out — thrown coins, not a
   symmetrical firework. */
@keyframes fleck {
  0% {
    opacity: 0;
    transform: rotate(var(--a)) translateY(0) scale(0.3);
  }
  16% {
    opacity: 1;
  }
  100% {
    opacity: 0;
    transform: rotate(var(--a)) translateY(calc(var(--d) * -1))
      rotate(var(--r)) scale(var(--s));
  }
}

/* A single gold sweep across a tile that just resolved. */
.flash {
  position: relative;
  overflow: hidden;
}

.flash::after {
  content: "";
  position: absolute;
  top: -60%;
  bottom: -60%;
  left: -60%;
  width: 45%;
  background: linear-gradient(
    100deg,
    transparent,
    rgba(255, 238, 176, 0.65),
    transparent
  );
  transform: skewX(-18deg);
  animation: flashSweep 0.62s ease-out forwards;
  pointer-events: none;
}

@keyframes flashSweep {
  to {
    left: 120%;
  }
}

/* ============================================================
   Avatars
   ============================================================
   A leaderboard of names is a list; a leaderboard of faces is a
   room, and the room is the product. So the face is a primitive
   here rather than a detail of one screen.

   The initials are not a fallback bolted on afterwards — they
   are the base layer, always drawn, with the photo laid over
   them. A photo that fails removes itself and there is still
   something to look at. */

.ava {
  position: relative;
  flex: none;
  display: grid;
  place-items: center;
  border-radius: 50%;
  overflow: hidden;
  background: var(--ava-tone, var(--surface-3));
}

/* A struck hairline, the same edge the coin and the badges carry, so a
   face sits in the metalwork instead of on it. Drawn as a layer rather
   than an inset shadow because the photo is a child element and would
   paint straight over one. */
.ava::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  box-shadow:
    inset 0 0 0 1px rgba(201, 152, 47, 0.22),
    inset 0 1px 0 rgba(255, 255, 255, 0.06);
  pointer-events: none;
}

.ava > i {
  font-style: normal;
  font-weight: 700;
  letter-spacing: 0;
  line-height: 1;
  color: rgba(201, 152, 47, 0.72);
  user-select: none;
}

.ava > img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: inherit;
  /* Photos arrive after the initials are already on screen; a
     hard swap reads as a glitch, a short fade reads as loading. */
  animation: avaIn 0.22s ease-out both;
}

@keyframes avaIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.ava-xs { width: 20px; height: 20px; }
.ava-xs > i { font-size: 10px; }

.ava-sm { width: 26px; height: 26px; }
.ava-sm > i { font-size: 10px; }

.ava-md { width: 32px; height: 32px; }
.ava-md > i { font-size: 12px; }

.ava-lg { width: 58px; height: 58px; }
.ava-lg > i { font-size: 20px; }

/* First place wears the brand's own metal on its rim. */
.ava.gold {
  box-shadow: 0 0 12px rgba(201, 152, 47, 0.3);
}

.ava.gold::after {
  box-shadow: inset 0 0 0 1.5px rgba(201, 152, 47, 0.85);
}
