/* Partner Arcade: Live stats. A raised clay panel you can drag anywhere, opened from the
   header. Load after shared.css. Same rules as the rest: one light from the upper right,
   wells for anything pressed in, cream text, colour only for polarity (profit vs loss). */

/* ---------- header toggle (desktop) + floating key (phones) ---------- */
.top__stats {
  display: inline-flex; align-items: center; gap: 8px; padding: 0; border: 0; background: none; cursor: pointer;
  font: 500 13px/1 var(--sans); color: var(--t2); transition: color .2s;
}
.top__stats svg { width: 17px; height: 17px; }
.top__stats:hover, .top__stats[aria-pressed="true"] { color: var(--cream); }
.top__stats .led { width: 6px; height: 6px; }
.top__stats:not([aria-pressed="true"]) .led { background: #0a0a0b; box-shadow: inset -1px 1px 2px rgba(0, 0, 0, .9), 0 1px 0 rgba(255, 255, 255, .06); }
.top__stats .led.is-blink, .lstats-fab .led.is-blink { animation: ledblink .6s ease-out; }
@keyframes ledblink { 0% { background: var(--cream); box-shadow: 0 0 12px rgba(242, 240, 236, 1); } }

.lstats-fab { display: none; }
@media (max-width: 620px) {
  .lstats-fab {
    position: fixed; left: 12px; bottom: 96px; z-index: 6; display: inline-flex; align-items: center; gap: 8px; height: 42px; padding: 0 16px 0 14px;
    border: 0; border-radius: 999px; cursor: pointer; color: var(--cream); font: 600 13px/1 var(--sans);
    background: linear-gradient(195deg, #222224, #19191b 60%, #141416); box-shadow: var(--clay-edge), -6px 10px 18px rgba(0, 0, 0, .6);
  }
  body:not(:has(.dock)) .lstats-fab { bottom: 16px; }
  .lstats-fab svg { width: 16px; height: 16px; }
  .lstats-fab[aria-pressed="true"] { display: none; }
}

/* ---------- the panel ---------- */
.lstats {
  --pos: 242, 240, 236; --neg: 229, 140, 125;
  position: fixed; z-index: 40; left: 0; top: 0; width: 392px; max-height: calc(100vh - 24px);
  display: flex; flex-direction: column; border-radius: 24px; color: var(--cream);
  background:
    radial-gradient(120% 60% at 100% 0%, rgba(255, 255, 255, .05), rgba(255, 255, 255, 0) 55%),
    linear-gradient(195deg, #222224, #19191b 60%, #141416);
  box-shadow: inset -1.5px 1.5px 0 rgba(255, 255, 255, .07), inset 2px -3px 0 rgba(0, 0, 0, .55), inset 0 0 0 1px rgba(255, 255, 255, .025), -22px 34px 60px rgba(0, 0, 0, .7), -5px 8px 16px rgba(0, 0, 0, .45);
  transform-origin: var(--ox, 100%) var(--oy, 0%);
  animation: lsin .38s var(--ease);
}
.lstats[hidden] { display: none; }
.lstats.is-out { animation: lsout .2s ease-in forwards; }
@keyframes lsin { from { opacity: 0; transform: scale(.92) translateY(-6px); } }
@keyframes lsout { to { opacity: 0; transform: scale(.95); } }
.lstats.is-drag { box-shadow: inset -1.5px 1.5px 0 rgba(255, 255, 255, .08), inset 2px -3px 0 rgba(0, 0, 0, .55), -34px 52px 80px rgba(0, 0, 0, .72), -8px 12px 22px rgba(0, 0, 0, .5); transition: box-shadow .2s; }
.lstats.is-drag, .lstats.is-drag * { cursor: grabbing !important; user-select: none; }

/* bar: the grip you drag by */
.lstats__bar { display: flex; align-items: center; gap: 10px; padding: 12px 12px 10px 14px; cursor: grab; touch-action: none; }
.lstats__grip {
  display: grid; grid-template-columns: repeat(2, 3px); gap: 3px; padding: 7px 5px; border: 0; border-radius: 8px; background: none; cursor: grab;
}
.lstats__grip i { width: 3px; height: 3px; border-radius: 50%; background: rgba(242, 240, 236, .35); box-shadow: -1px 1px 0 rgba(0, 0, 0, .6); }
.lstats__grip:focus-visible { outline: 2px solid var(--cream); outline-offset: 1px; }
.lstats__title { display: flex; align-items: center; gap: 9px; margin: 0; font: 850 17px/1 var(--display); font-stretch: 88%; font-variation-settings: 'wdth' 88; letter-spacing: -.01em; white-space: nowrap; }
.lstats__title .led { width: 7px; height: 7px; }
.lstats__title .led.is-blink { animation: ledblink .6s ease-out; }
.lstats__tools { display: flex; align-items: center; gap: 6px; margin-left: auto; }
.lsicon {
  display: grid; place-items: center; width: 32px; height: 32px; padding: 0; border: 0; border-radius: 11px; cursor: pointer; color: var(--t2);
  background: linear-gradient(195deg, #2a2a2c, #1e1e20 60%, #19191b); box-shadow: var(--clay-edge), -3px 5px 8px rgba(0, 0, 0, .45);
  transition: color .2s, transform .2s var(--spring), box-shadow .2s;
}
.lsicon svg { width: 15px; height: 15px; }
.lsicon:hover { color: var(--cream); transform: translate(1px, -1px); }
.lsicon:active { transform: translateY(1px); box-shadow: inset -2px 3px 5px rgba(0, 0, 0, .8); }
.lsicon.is-armed { width: auto; padding: 0 11px; color: var(--ink); font: 700 12px/1 var(--sans); background: radial-gradient(130% 140% at 75% 10%, #fbfaf7, #ecebe6 55%, #dcdbd6); box-shadow: inset 0 1.5px 0 rgba(255, 255, 255, .9), 0 3px 0 #a3a29d, -4px 7px 10px rgba(0, 0, 0, .45); }

.lstats__body { display: flex; flex-direction: column; gap: 14px; padding: 0 14px 14px; min-height: 0; overflow-y: auto; scrollbar-width: thin; scrollbar-color: rgba(242, 240, 236, .15) transparent; }
.lstats__body > * { flex-shrink: 0; }   /* when the window is short it scrolls; nothing gets squeezed */
.lstats.is-min .lstats__body > :not(.lshero) { display: none; }
.lstats.is-min .lshero { padding: 12px 16px; }
.lstats.is-min .lshero__num { font-size: 30px; }

/* a pressed-in track of keys (scope, filters, tabs): selected one stands up out of the well */
.lstrack { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 3px; padding: 4px; border-radius: 14px; background: linear-gradient(195deg, var(--well-hi), var(--well-lo)); box-shadow: var(--sh-well); }
.lstrack button {
  height: 32px; min-width: 0; padding: 0 6px; border: 0; border-radius: 10px; cursor: pointer; background: none;
  font: 500 12.5px/1 var(--sans); color: var(--t3); white-space: nowrap; transition: color .2s, background .25s, box-shadow .25s;
}
.lstrack button:hover { color: var(--cream); }
.lstrack button[aria-pressed="true"], .lstrack button[aria-selected="true"] {
  color: var(--cream); background: linear-gradient(195deg, #28282a, #1a1a1c);
  box-shadow: inset -1.5px 1.5px 0 rgba(255, 255, 255, .07), inset 2px -3px 0 rgba(0, 0, 0, .55), -4px 6px 12px rgba(0, 0, 0, .5);
}
.lstrack button:focus-visible { outline: 2px solid var(--cream); outline-offset: -2px; }
.lstrack--sm button { height: 26px; font-size: 11.5px; }
.lsrow { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.lsrow .lstrack { flex: none; }

/* hero: profit, big */
.lshero { position: relative; overflow: hidden; display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; padding: 16px 18px; border-radius: 18px; background: linear-gradient(195deg, var(--well-hi), var(--well-lo)); box-shadow: var(--sh-well); }
.lshero::before { content: ""; position: absolute; inset: auto -20% -60% 30%; height: 120%; border-radius: 50%; pointer-events: none; background: radial-gradient(closest-side, rgba(var(--tone, var(--pos)), .14), rgba(var(--tone, var(--pos)), 0)); opacity: 0; transition: opacity .6s; }
.lshero.is-up::before, .lshero.is-down::before { opacity: 1; }
.lshero.is-down { --tone: var(--neg); }
.lshero .label { margin-bottom: 10px; }
.lshero__num {
  display: block; font: 850 40px/.9 var(--display); font-stretch: 88%; font-variation-settings: 'wdth' 88; letter-spacing: -.035em; font-variant-numeric: tabular-nums;
  transition: color .3s, text-shadow .4s;
}
.lshero__num small { margin-left: 6px; font: 500 13px/1 var(--sans); letter-spacing: 0; color: var(--t3); }
.lshero.is-down .lshero__num { color: var(--error-text); }
.lshero.is-bump .lshero__num { animation: lsbump .45s var(--spring); }
@keyframes lsbump { 40% { transform: scale(1.06); } }
.lshero__num { transform-origin: left bottom; }
.lshero__side { position: relative; text-align: right; font: 400 12.5px/1.5 var(--sans); color: var(--t2); }
.lshero__side b { color: var(--cream); font-weight: 600; font-variant-numeric: tabular-nums; }

/* six readouts */
.lsgrid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); border-radius: 16px; background: linear-gradient(195deg, var(--well-hi), var(--well-lo)); box-shadow: var(--sh-well); }
.lsgrid > div { display: flex; flex-direction: column; gap: 8px; min-width: 0; padding: 13px 14px; }
.lsgrid > div:nth-child(3n + 2), .lsgrid > div:nth-child(3n + 3) { box-shadow: inset 1px 0 0 var(--hair); }
.lsgrid > div:nth-child(n + 4) { border-top: 1px solid var(--hair); }
.lsgrid .label { font-size: 10px; }
.lsgrid b { font: 700 15px/1 var(--sans); font-variant-numeric: tabular-nums; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lsgrid b small { font: 500 11px/1 var(--sans); color: var(--t3); margin-left: 3px; }
/* wins vs losses: a groove filled with cream for the share won */
.lsmeter { grid-column: 1 / -1; display: flex !important; flex-direction: row !important; align-items: center; gap: 10px !important; border-top: 1px solid var(--hair); box-shadow: none !important; }
.lsmeter__groove { position: relative; flex: 1; height: 8px; border-radius: 999px; background: #070707; box-shadow: var(--sh-groove, inset -1px 2px 3px rgba(0, 0, 0, .9), 0 1px 0 rgba(255, 255, 255, .05)); overflow: hidden; }
.lsmeter__fill { position: absolute; left: 0; top: 1px; bottom: 1px; width: 0; border-radius: 999px; background: linear-gradient(195deg, #fbfaf7, #dcdbd6); box-shadow: 0 0 10px rgba(242, 240, 236, .3); transition: width .6s var(--ease); }
.lsmeter span { font: 500 11.5px/1 var(--sans); color: var(--t2); white-space: nowrap; font-variant-numeric: tabular-nums; }

/* ---------- views ---------- */
.lsview { position: relative; min-height: 196px; }
.lsview[hidden] { display: none; }
.lschart { position: relative; height: 196px; border-radius: 16px; background: linear-gradient(195deg, var(--well-hi), var(--well-lo)); box-shadow: var(--sh-well); overflow: hidden; touch-action: pan-y; }
.lschart svg { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; }
.lschart .ax { font: 500 10px/1 var(--sans); fill: rgba(242, 240, 236, .4); font-variant-numeric: tabular-nums; }
.lschart .grid { stroke: rgba(242, 240, 236, .06); stroke-width: 1; }
.lschart .zero { stroke: rgba(242, 240, 236, .28); stroke-width: 1; stroke-dasharray: 3 4; }
.lschart .line { fill: none; stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.lschart .cross { stroke: rgba(242, 240, 236, .35); stroke-width: 1; }
.lschart .dot { stroke: #141415; stroke-width: 2; }
.lschart .live { fill: none; stroke-width: 1.5; animation: lslive 1.8s ease-out infinite; transform-box: fill-box; transform-origin: center; }
@keyframes lslive { from { transform: scale(.6); opacity: .9; } to { transform: scale(2.4); opacity: 0; } }
.lschart__empty { position: absolute; inset: 0; display: grid; place-items: center; padding: 24px; text-align: center; font: 400 13.5px/1.5 var(--sans); color: var(--t2); }
.lschart__range { position: absolute; left: 14px; top: 12px; font: 500 10px/1 var(--sans); letter-spacing: .14em; text-transform: uppercase; color: var(--t3); pointer-events: none; }

.lstip {
  position: absolute; z-index: 2; top: 10px; min-width: 150px; padding: 10px 12px; border-radius: 12px; pointer-events: none;
  background: radial-gradient(130% 140% at 75% 10%, #3a3a3d, #2a2a2c 60%, #222224);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .12), -6px 10px 14px rgba(0, 0, 0, .5);
  font: 400 12px/1.45 var(--sans); color: var(--t2); opacity: 0; transition: opacity .12s;
}
.lstip.is-on { opacity: 1; }
.lstip b { color: var(--cream); font-weight: 600; font-variant-numeric: tabular-nums; }
.lstip .lstip__head { display: flex; justify-content: space-between; gap: 12px; margin-bottom: 6px; font: 500 10px/1 var(--sans); letter-spacing: .14em; text-transform: uppercase; color: var(--t3); }
.lstip .is-neg { color: var(--error-text); }

/* per game: a diverging bar for profit, then a row per game with its own trend */
.lsgames { display: flex; flex-direction: column; gap: 8px; }
.lsgame {
  display: grid; grid-template-columns: minmax(0, 1fr) 84px auto; align-items: center; gap: 12px; width: 100%; padding: 12px 14px; border: 0; border-radius: 16px; cursor: pointer; text-align: left; color: var(--cream);
  background: linear-gradient(195deg, var(--well-hi), var(--well-lo)); box-shadow: var(--sh-well); transition: box-shadow .25s, transform .25s var(--spring);
}
.lsgame:hover { box-shadow: var(--sh-well), inset 0 0 0 1px rgba(242, 240, 236, .14); }
.lsgame:focus-visible { outline: 2px solid var(--cream); outline-offset: 2px; }
.lsgame__name { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.lsgame__name b { font: 800 14px/1 var(--display); text-transform: uppercase; font-stretch: 110%; font-variation-settings: 'wdth' 110; letter-spacing: .01em; }
.lsgame__name span { font: 400 11.5px/1.3 var(--sans); color: var(--t3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lsgame svg { width: 84px; height: 30px; overflow: visible; }
.lsgame__pl { text-align: right; font: 700 14px/1 var(--sans); font-variant-numeric: tabular-nums; white-space: nowrap; }
.lsgame__pl small { display: block; margin-top: 6px; font: 400 11px/1 var(--sans); color: var(--t3); }
.lsgame.is-neg .lsgame__pl { color: var(--error-text); }
.lsgame.is-empty { opacity: .5; }

.lsdiv { display: flex; flex-direction: column; gap: 9px; padding: 14px 14px 12px; border-radius: 16px; background: linear-gradient(195deg, var(--well-hi), var(--well-lo)); box-shadow: var(--sh-well); }
.lsdiv__row { display: grid; grid-template-columns: 64px minmax(0, 1fr); align-items: center; gap: 10px; font: 500 11.5px/1 var(--sans); color: var(--t2); }
.lsdiv__track { position: relative; height: 12px; }
.lsdiv__track::before { content: ""; position: absolute; left: 50%; top: -4px; bottom: -4px; width: 1px; background: rgba(242, 240, 236, .22); }
.lsdiv__bar { position: absolute; top: 2px; height: 8px; border-radius: 4px; transition: left .6s var(--ease), width .6s var(--ease); }
.lsdiv__bar.is-pos { background: linear-gradient(195deg, #fbfaf7, #d6d4ce); box-shadow: 0 0 10px rgba(242, 240, 236, .25); }
.lsdiv__bar.is-neg { background: linear-gradient(195deg, #f1b6ab, #c9786a); box-shadow: 0 0 10px rgba(229, 140, 125, .25); }

/* rounds: the table view of the same data */
.lstable { width: 100%; border-collapse: collapse; font: 400 12.5px/1 var(--sans); font-variant-numeric: tabular-nums; }
.lstablewrap { max-height: 260px; overflow-y: auto; border-radius: 16px; background: linear-gradient(195deg, var(--well-hi), var(--well-lo)); box-shadow: var(--sh-well); scrollbar-width: thin; scrollbar-color: rgba(242, 240, 236, .15) transparent; }
.lstable th { position: sticky; top: 0; z-index: 1; padding: 11px 10px 9px; text-align: right; font: 500 10px/1 var(--sans); letter-spacing: .14em; text-transform: uppercase; color: var(--t3); background: #0c0c0d; }
.lstable td { padding: 9px 10px; text-align: right; color: var(--t2); border-top: 1px solid rgba(242, 240, 236, .06); white-space: nowrap; }
.lstable th:first-child, .lstable td:first-child, .lstable th:nth-child(2), .lstable td:nth-child(2) { text-align: left; }
.lstable td.pl { color: var(--cream); font-weight: 600; }
.lstable td.pl.is-neg { color: var(--error-text); }
.lstable tr.is-new td { animation: lsrow 1.2s var(--ease); }
@keyframes lsrow { from { background: rgba(242, 240, 236, .08); } }
.lstable .empty td { padding: 28px 12px; text-align: center; color: var(--t2); }

.lsfoot { margin: 0; font: 400 11.5px/1.5 var(--sans); color: var(--t3); }

/* phones: a sheet from the bottom instead of a window you drag */
@media (max-width: 620px) {
  .lstats { left: 8px !important; right: 8px; top: auto !important; bottom: 8px; width: auto; max-height: 84vh; transform-origin: 50% 100%; }
  .lstats__bar { cursor: default; }
  .lstats__grip { display: none; }
  .lsgame { grid-template-columns: minmax(0, 1fr) 64px auto; }
  .lsgame svg { width: 64px; }
}
@media (prefers-reduced-motion: reduce) {
  .lstats, .lstats.is-out, .lschart .live, .lstable tr.is-new td, .lshero.is-bump .lshero__num { animation: none; }
}
