/* VALBLOX Live Stats panel (assets/js/vb-livestats.js): the promo's LIVE STATS box (the Blender render, style B
   "Calm") as a live page part. Geometry, type roles and weights are the render's (268 x 346 css px, 10px chamfer; 374 tall with the per-game row),
   in its own coordinates: every position below is a place in that box. Colours are the site's tokens where they
   match (--green, --lilac (frost), --muted, --rim-iron, the coin); the rest are the render's own:
   - the red of the figures and the line is the render's #FF5A50 (--red lightened a touch so a big number reads on
     slate);
   - Blender blended its thin parts in linear light, a browser blends in sRGB, so the hairlines, rules, the zero dash,
     the fills and the halo are written as the colours (or the sRGB opacities) that give the render's look on the page:
     brand/viking/live-stats/tools/calib.py works them out.
   One hue family; the accents have one job each: green up, red down, gold the tick and the coin. */

.vls {
  --vls-green: var(--green, #58FFC3);
  --vls-red: #FF5A50;
  --vls-zero: #E8F1F8;
  --vls-frost: var(--lilac, #8FD4F3);
  --vls-muted: var(--muted, #96A1B6);
  --vls-white: #F2F7FB;
  position: fixed; z-index: 28; left: 0; top: 0; width: 268px; height: 374px;
  color: var(--vls-white); text-align: left; user-select: none; -webkit-user-select: none;
  contain: layout style;
}
.vls[hidden] { display: none; }
/* the frame: the iron rim, the frost hairline inside it (lit at the top, fading down), the slate face, and the soft
   drop shadow under the whole cut shape (on this layer only, so the live figures never re-run the blur) */
.vls__frame { position: absolute; inset: 0; z-index: 0; pointer-events: none; filter: drop-shadow(0 5px 16px rgba(4, 6, 10, .75)); }
.vls__frame::before, .vls__frame::after, .vls__frame > i { content: ""; position: absolute; display: block; }
.vls__frame::before {
  inset: 0; background: var(--rim-iron, #10151D);
  clip-path: polygon(10px 0, calc(100% - 10px) 0, 100% 10px, 100% calc(100% - 10px), calc(100% - 10px) 100%, 10px 100%, 0 calc(100% - 10px), 0 10px);
}
.vls__frame::after {
  inset: 1px;
  background: linear-gradient(180deg, #718F9E 0%, #708E9D 5.8%, #6C8A99 13%, #638090 23.1%, #547180 34.7%, #405A69 49.1%, #304552 63.6%, #2A3D49 75%, #293C48 100%);
  clip-path: polygon(9.59px 0, calc(100% - 9.59px) 0, 100% 9.59px, 100% calc(100% - 9.59px), calc(100% - 9.59px) 100%, 9.59px 100%, 0 calc(100% - 9.59px), 0 9.59px);
}
.vls__frame > i {
  inset: 2px; z-index: 1;
  background: linear-gradient(180deg, #212A38 0%, #202937 16.8%, #1F2734 33.5%, #1C2430 50.3%, #1A212C 67.1%, #181E28 83.8%, #171D27 100%);
  clip-path: polygon(9.17px 0, calc(100% - 9.17px) 0, 100% 9.17px, 100% calc(100% - 9.17px), calc(100% - 9.17px) 100%, 9.17px 100%, 0 calc(100% - 9.17px), 0 9.17px);
}

/* ---------------------------------------------------------------- the header: the drag handle */
.vls__head { position: absolute; z-index: 2; left: 0; top: 0; width: 100%; height: 46px; cursor: grab; touch-action: none; }
.vls.is-drag .vls__head { cursor: grabbing; }
/* "LIVE STATS": GoldenSmile 14.5px, tracked 2.2px, frost; its caps centred on y 25, the text centred on x 141 (the
   dot takes the room on its left) */
.vls__title {
  position: absolute; left: 141px; top: 16.72px; margin: 0; transform: translateX(-50%);
  font-family: "GoldenSmile", sans-serif; font-weight: 400; font-size: 14.5px; line-height: 1; letter-spacing: 2.2px;
  color: var(--vls-frost); text-transform: uppercase; white-space: nowrap; pointer-events: none;
}
.vls__tt { margin-right: -2.2px; }   /* the last letter's tracking is not part of the centred width */
/* the live dot: the render's own loop (a ring grows from the core and fades, then rests; 2 s), its centre 12px left
   of the title; a steady still under reduced motion */
.vls__dot { position: absolute; left: -27px; top: -6.72px; width: 30px; height: 30px; }
.vls__dot img { display: block; width: 30px; height: 30px; }
.vls__btn {
  position: absolute; top: 11px; width: 28px; height: 28px; display: grid; place-items: center; padding: 0; border: 0;
  background: none; color: var(--vls-muted); opacity: .6; cursor: pointer; transition: color .15s, opacity .15s;
}
.vls__btn .ic { width: 14px; height: 14px; }
.vls__btn:hover { color: var(--lilac-light, #B9E8FE); opacity: 1; }
.vls__btn:focus-visible { outline: 2px solid var(--lilac-light, #B9E8FE); outline-offset: -2px; opacity: 1; }
.vls__reset { left: 9px; }
.vls__x { right: 9px; }

/* ---------------------------------------------------------------- per game: the chip and Best under the header (the
   render's box grown by this one 28px row; everything below it keeps its place, moved down by the row) */
.vls__bar {
  position: absolute; z-index: 3; left: 12px; right: 12px; top: 44px; height: 26px;
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
}
.vls__pick, .vls__best {
  position: relative; display: inline-flex; align-items: center; min-width: 0; height: 26px; margin: 0; border: 0;
  background: none; color: var(--vls-white); cursor: pointer; font-family: "Skranji", sans-serif; font-weight: 400;
  line-height: 1; white-space: nowrap; text-transform: uppercase;
}
/* the chip: a small chamfered slot, the rim and a darker face (pseudo layers, so the focus ring is not cut) */
.vls__pick { flex: 0 1 auto; max-width: 62%; gap: 6px; padding: 0 8px 0 8px; font-size: 11.5px; letter-spacing: .9px; }
.vls__pick::before, .vls__pick::after { content: ""; position: absolute; z-index: -1; }
.vls__pick::before {
  inset: 0; background: #324857; transition: background .15s;
  clip-path: polygon(5px 0, calc(100% - 5px) 0, 100% 5px, 100% calc(100% - 5px), calc(100% - 5px) 100%, 5px 100%, 0 calc(100% - 5px), 0 5px);
}
.vls__pick::after {
  inset: 1px; background: linear-gradient(180deg, #1A212C 0%, #151B24 100%);
  clip-path: polygon(4.6px 0, calc(100% - 4.6px) 0, 100% 4.6px, 100% calc(100% - 4.6px), calc(100% - 4.6px) 100%, 4.6px 100%, 0 calc(100% - 4.6px), 0 4.6px);
}
.vls__pick:hover::before, .vls__pick[aria-expanded="true"]::before { background: #4A6878; }
.vls__pick-ic { width: 14px; height: 14px; color: var(--vls-frost); }
.vls__pick-name { min-width: 0; overflow: hidden; text-overflow: ellipsis; padding-top: 1px; margin-right: -.9px; }
.vls__pick-chev { width: 12px; height: 12px; color: var(--vls-muted); transition: transform .18s ease; }
.vls__pick[aria-expanded="true"] .vls__pick-chev { transform: rotate(180deg); }
/* Best: the game you are up most on, a quiet line on the right */
.vls__best { flex: 0 1 auto; gap: 5px; padding: 0 2px; font-size: 13px; letter-spacing: .5px; }
.vls__best[hidden] { display: none; }
.vls__best-l { font-size: 10.5px; letter-spacing: .8px; color: var(--vls-muted); padding-top: 1px; }
.vls__best-ic { width: 13px; height: 13px; color: var(--vls-frost); }
.vls__best-v { color: var(--vls-green); padding-top: 1px; -webkit-text-stroke: .3px currentColor; }
.vls__best:hover .vls__best-l { color: var(--vls-white); }
.vls__pick:focus-visible, .vls__best:focus-visible { outline: 2px solid var(--lilac-light, #B9E8FE); outline-offset: 1px; }

/* the "by game" sheet: over the figures and the line, the card's own face; All games, then best to worst */
.vls__sheet {
  position: absolute; z-index: 4; left: 8px; right: 8px; top: 76px; bottom: 9px;
  overflow-y: auto; overscroll-behavior: contain; scrollbar-width: thin; scrollbar-color: #354E5D transparent;
  background: linear-gradient(180deg, #1F2734 0%, #171D27 100%); user-select: none;
}
.vls__sheet[hidden] { display: none; }
.vls.is-sheet .vls__graph { visibility: hidden; }   /* its halo and line ends reach past the sheet's edges */
.vls__sheet-h {
  position: sticky; top: 0; z-index: 1; display: flex; justify-content: space-between; margin: 0; padding: 4px 8px 6px;
  background: #1F2734; border-bottom: 1px solid #324857;
  font-family: "Skranji", sans-serif; font-size: 10.5px; line-height: 1; letter-spacing: .8px; text-transform: uppercase; color: var(--vls-muted);
}
.vls__list { list-style: none; margin: 0; padding: 0; }
.vls__list > li { border-bottom: 1px solid #26343F; }
.vls__row {
  display: grid; grid-template-columns: 16px minmax(0, 1fr) auto; align-items: center; gap: 8px; width: 100%; min-height: 36px;
  margin: 0; padding: 4px 8px; border: 0; background: none; color: var(--vls-white); text-align: left; cursor: pointer;
  font-family: "Skranji", sans-serif; font-weight: 400; line-height: 1; transition: background .15s;
}
.vls__row:hover { background: rgba(143, 212, 243, .06); }
.vls__row[aria-pressed="true"] { background: rgba(143, 212, 243, .08); box-shadow: inset 2px 0 0 #E0AE6C; }
.vls__row:focus-visible { outline: 2px solid var(--lilac-light, #B9E8FE); outline-offset: -2px; }
.vls__row-ic { width: 16px; height: 16px; color: var(--vls-frost); }
.vls__row-name { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.vls__row-t { font-size: 13px; letter-spacing: .4px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.vls__row--all .vls__row-t { text-transform: uppercase; font-size: 11.5px; letter-spacing: .9px; color: var(--vls-frost); }
.vls__row-w { display: inline-flex; align-items: center; gap: 3px; font-size: 10.5px; letter-spacing: .4px; color: var(--vls-muted); }
.vls__row-w img { width: 10px; height: 11px; flex: none; }
.vls__row-pl { font-size: 15px; letter-spacing: .5px; color: var(--vls-zero); -webkit-text-stroke: .35px currentColor; white-space: nowrap; }
.vls__row-pl.is-up { color: var(--vls-green); }
.vls__row-pl.is-down { color: var(--vls-red); }
.vls__none { padding: 12px 8px; border: 0 !important; font-family: "Skranji", sans-serif; font-size: 11.5px; line-height: 1.35; color: var(--vls-muted); }
@media (prefers-reduced-motion: reduce) {
  .vls__pick::before, .vls__pick-chev, .vls__row { transition: none; }
}

/* ---------------------------------------------------------------- the figures (Skranji; centred columns) */
/* the render's 268 x 346 box, below the per-game row */
.vls__stats { position: absolute; z-index: 2; left: 0; right: 0; top: 28px; height: 346px; margin: 0; pointer-events: none; }
.vls__cell { display: contents; }
.vls__lbl, .vls__val { position: absolute; margin: 0; white-space: nowrap; font-family: "Skranji", sans-serif; font-weight: 400; line-height: 1; }
.vls__lbl { transform: translateX(-50%); font-size: 11.5px; letter-spacing: .9px; color: var(--vls-muted); text-transform: uppercase; }
.vls__lbl::after { content: ""; margin-right: -.9px; }
/* a value sits in a box as wide as the most it may take; a longer one is shrunk to it (vls__fit, the script) */
.vls__val { display: flex; justify-content: center; }
.vls__fit { display: inline-flex; align-items: center; gap: 4px; }
/* faux bold as the render's: each glyph edge grown by bold x size / 32 (a round stroke of twice that, in the text's own
   colour), the advance grown by the same */
.vls__val--profit {
  left: 20px; top: 74.05px; width: 228px;
  font-size: 38px; letter-spacing: 1.11px; -webkit-text-stroke: 1.43px currentColor; color: var(--vls-zero);
}
.vls__val--profit .vls__fit { margin-right: -1.11px; }
.vls__val--profit.is-up { color: var(--vls-green); }
.vls__val--profit.is-down { color: var(--vls-red); }
.vls__val--wag, .vls__val--wins, .vls__val--losses { top: 156.42px; font-size: 17px; letter-spacing: .74px; -webkit-text-stroke: .48px currentColor; }
.vls__val--wag { left: 9px; width: 118px; color: var(--vls-white); }
.vls__val--wag img { width: 15px; height: 16px; flex: none; position: relative; top: -.92px; }   /* centred on the digits, as the render */
.vls__val--wag .vls__fit > span, .vls__val--wins .vls__fit, .vls__val--losses .vls__fit { margin-right: -.74px; }
.vls__val--wins { left: 139px; width: 54px; color: var(--vls-green); }
.vls__val--losses { left: 198px; width: 54px; color: var(--vls-red); }
.vls__cell--profit .vls__lbl { left: 134px; top: 51.21px; }
.vls__cell--wag .vls__lbl { left: 66px; top: 139.21px; }
.vls__cell--wins .vls__lbl { left: 166px; top: 139.21px; }
.vls__cell--losses .vls__lbl { left: 225px; top: 139.21px; }
/* the hairline under the profit with its short gold tick, and the two column rules */
.vls__rule { position: absolute; left: 24px; top: 121px; width: 220px; height: 1px; background: #324857; }
.vls__rule > i { position: absolute; left: 100px; top: -.25px; width: 20px; height: 1.5px; background: #E0AE6C; }
.vls__stats::before, .vls__stats::after { content: ""; position: absolute; top: 138px; width: 1px; height: 40px; background: #354E5D; }
.vls__stats::before { left: 137px; }
.vls__stats::after { left: 196px; }

/* ---------------------------------------------------------------- the profit line: full bleed along the foot */
.vls__graph { position: absolute; z-index: 1; left: 2px; top: 228px; width: 264px; height: 136px; overflow: visible; pointer-events: none; }
.vls__line { fill: none; stroke-width: 2.45px; stroke-linecap: round; stroke-linejoin: round; }
.vls__line--up { stroke: var(--vls-green); }
.vls__line--down { stroke: var(--vls-red); }
.vls__zero { stroke: rgba(143, 212, 243, .52); stroke-width: 1px; stroke-dasharray: 2.75 2.25; }
.vls__halo { fill: url(#vls-hu); }
.vls__head-dot { fill: var(--vls-zero); }
.vls__core { fill: #F4FBFF; }
.vls__graph[data-side="up"] .vls__head-dot { fill: var(--vls-green); }
.vls__graph[data-side="down"] .vls__head-dot { fill: var(--vls-red); }
.vls__graph[data-side="down"] .vls__halo { fill: url(#vls-hd); }
.vls__graph[data-side=""] .vls__halo { opacity: .5; }

/* ---------------------------------------------------------------- phones: a compact card docked along the bottom.
   The same object, folded: the header, then the profit beside its line, the hairline with its tick, and the three
   counts under it. It does not drag. */
@media (max-width: 600px) {
  .vls { left: 12px !important; right: 12px; top: auto !important; bottom: calc(12px + env(safe-area-inset-bottom, 0px)); width: auto; height: 210px; }
  .vls__bar { left: 10px; right: 10px; top: 36px; height: 24px; }
  .vls__pick, .vls__best { height: 24px; }
  .vls__stats { top: 26px; height: 184px; }
  .vls__sheet { left: 6px; right: 6px; top: 64px; bottom: 7px; }
  .vls__row { min-height: 34px; }
  .vls__head { height: 36px; cursor: default; touch-action: auto; }
  .vls__title { left: calc(50% + 7px); top: 9.72px; }
  .vls__btn { top: 4px; }
  .vls__reset { left: 6px; }
  .vls__x { right: 6px; }
  .vls__lbl { font-size: 10.5px; letter-spacing: .8px; }
  .vls__cell--profit .vls__lbl { left: 25%; top: 43.28px; }
  .vls__val--profit { left: 12px; top: 62.6px; width: calc(50% - 18px); font-size: 30px; letter-spacing: .96px; -webkit-text-stroke: 1.13px currentColor; }
  .vls__val--profit .vls__fit { margin-right: -.96px; }
  .vls__rule { left: 16px; top: 128px; width: calc(100% - 32px); }
  .vls__rule > i { left: calc(50% - 10px); }
  .vls__val--wag, .vls__val--wins, .vls__val--losses { top: 156.3px; font-size: 15px; letter-spacing: .7px; -webkit-text-stroke: .42px currentColor; }
  .vls__val--wag { left: 6px; width: calc(44% - 12px); }
  .vls__val--wag img { width: 14px; height: 15px; }
  .vls__val--wins { left: calc(44% + 4px); width: calc(28% - 8px); }
  .vls__val--losses { left: calc(72% + 4px); width: calc(28% - 10px); }
  .vls__cell--wag .vls__lbl { left: 22%; top: 139.28px; }
  .vls__cell--wins .vls__lbl { left: 58%; top: 139.28px; }
  .vls__cell--losses .vls__lbl { left: 86%; top: 139.28px; }
  .vls__stats::before, .vls__stats::after { top: 137px; height: 38px; }
  .vls__stats::before { left: 44%; }
  .vls__stats::after { left: 72%; }
  .vls__graph { left: 50%; top: 66px; width: calc(50% - 8px); height: 80px; }
}

/* ---------------------------------------------------------------- the toggles in each game's tools row */
.vls-tog .ic { width: 21px; height: 21px; }
.vls-tog[aria-pressed="true"] {
  color: var(--gold); --rim: var(--gold);
  --face: linear-gradient(rgba(var(--gold-rgb), 0) 0%, rgba(var(--gold-rgb), .24) 100%), var(--raised);
}
/* Roulette: beside Fairness in the header, the same height */
.rlhead .vls-tog { flex: none; height: 44px; margin-left: 10px; }
/* Case opening: one of the round icon acts */
.co-act.vls-tog .ic { width: 18px; height: 18px; }
/* Battle: after Fairness in the top bar */
.atop__stats { order: 6; }
@container arena (width < 700px) { .atop__stats { order: 3; } }
/* Fjord Run: an icon link on the foot seam, as the sound switch */
.frun .xh--simple .fr-stats.xh-link { min-width: 44px; justify-content: center; padding: 0 6px; }
.frun .fr-stats .ic { width: 18px; height: 18px; }
.frun .xh--simple .fr-stats.xh-link[aria-pressed="true"] { color: var(--gold); }
@media (max-width: 600px) { .rlhead .vls-tog { height: 40px; width: 40px; } }

/* phones: the docked card covers the bottom 222px; while it is open the page gets that room at its end, so the
   last controls can be scrolled above it */
@media (max-width: 600px) {
  body:has(> .vls:not([hidden])) { padding-bottom: calc(222px + env(safe-area-inset-bottom, 0px)); }
}
