/* Peek stream widgets: used by the OBS overlay (widget.html) and the gallery previews (widgets.html). */
.pw {
  /*
   * --peek-* come from the saved widget's look (PeekWidget.theme). Text comes in four groups, each with a
   * colour, a font and a size factor: name (nickname), elo, stat (wins, losses, today) and label (small captions).
   * Each style sets the base sizes (--name-px, --elo-px, --stat-px, --label-px); the factor scales them.
   */
  --pw-bg: var(--peek-bg, rgba(7, 11, 18, .88));
  --pw-line: var(--peek-line, rgba(255, 255, 255, .1));
  --pw-accent: var(--peek-accent, #4FD1FF);
  --pw-good: var(--peek-win, #4ADE80);
  --pw-bad: var(--peek-loss, #F05252);
  --name-px: 22px;
  --elo-px: 34px;
  --stat-px: 20px;
  --label-px: 10.5px;
  display: inline-flex;
  align-items: center;
  gap: 12px;
  padding: 10px 16px 10px 12px;
  background: var(--pw-bg);
  border: 1px solid var(--pw-line);
  border-left: 3px solid var(--pw-accent);
  color: var(--peek-stat-color, #E4EDF5);
  font-family: "Barlow", "Roboto", "Segoe UI", system-ui, sans-serif;
  line-height: 1;
  clip-path: polygon(0 0, calc(100% - 10px) 0, 100% 10px, 100% 100%, 0 100%);
}
.pw .good { color: var(--pw-good); }
.pw .bad { color: var(--pw-bad); }
.pw-lvl { width: 38px; height: 38px; flex: none; overflow: visible; }
.pw-lvl .trk { fill: none; stroke: rgba(255, 255, 255, .12); stroke-width: 3; }
.pw-lvl .arc { fill: none; stroke: var(--c); stroke-width: 3; transform: rotate(-90deg); transform-origin: 50% 50%; }
.pw-lvl text { fill: var(--c); font: 700 13px "JetBrains Mono", ui-monospace, monospace; text-anchor: middle; }
.pw-sep { width: 1px; align-self: stretch; background: var(--pw-line); }
.pw-n svg { width: .65em; height: .65em; }
.pw-msg { font: 500 15px "JetBrains Mono", ui-monospace, monospace; color: #8898AB; }

/* The four text groups. */
.pw-nick {
  color: var(--peek-name-color, #E4EDF5);
  font-family: var(--peek-name-font, inherit);
  font-size: calc(var(--name-px) * var(--peek-name-size, 1));
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.pw-elo {
  color: var(--peek-elo-color, #E4EDF5);
  font-family: var(--peek-elo-font, "Big Shoulders Display", "Oswald", "Arial Narrow", sans-serif);
  font-size: calc(var(--elo-px) * var(--peek-elo-size, 1));
  font-weight: 800;
  letter-spacing: .02em;
}
.pw-n, .pw-grid dd {
  font-family: var(--peek-stat-font, "JetBrains Mono", ui-monospace, monospace);
  font-size: calc(var(--stat-px) * var(--peek-stat-size, 1));
  font-weight: 700;
}
.pw-n { display: inline-flex; align-items: center; gap: 4px; }
.pw-grid dt, .pw-next {
  color: var(--peek-label-color, #8898AB);
  font-family: var(--peek-label-font, "JetBrains Mono", ui-monospace, monospace);
  font-size: calc(var(--label-px) * var(--peek-label-size, 1));
  font-weight: 500;
  letter-spacing: .1em;
  text-transform: uppercase;
}

.pw-card { --stat-px: 22px; display: inline-grid; gap: 12px; padding: 14px 18px 14px 16px; width: 400px; }
.pw-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.pw-rank { display: inline-flex; align-items: center; gap: 10px; }
.pw-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin: 0; }
.pw-grid dt { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pw-grid dd { margin: 6px 0 0; white-space: nowrap; }
.pw-form { display: flex; gap: 4px; }
.pw-form i { width: 100%; height: 5px; background: var(--pw-good); }
.pw-form i.l { background: var(--pw-bad); }

/* Bar: one line for the bottom or top edge of the stream. */
.pw-bar { --name-px: 20px; --elo-px: 30px; --stat-px: 18px; gap: 14px; width: 620px; }
.pw-bar .pw-nick { flex: 1 1 auto; min-width: 0; }
.pw-bar .pw-form { width: 84px; flex: none; }

/* Tile: narrow and tall, for the side of a camera. */
.pw-tile { --elo-px: 44px; --stat-px: 18px; display: inline-grid; justify-items: center; gap: 10px; width: 160px; padding: 16px 14px; text-align: center; }
.pw-tile .pw-lvl { width: 52px; height: 52px; }
.pw-tile .pw-wl { display: flex; gap: 12px; }
.pw-tile .pw-form { width: 100%; }

/* Progress: ELO towards the next level. */
.pw-progress { --label-px: 12px; display: inline-grid; gap: 10px; width: 380px; padding: 14px 18px 14px 16px; }
.pw-meter { height: 8px; background: var(--pw-line); }
.pw-meter i { display: block; height: 100%; background: var(--pw-accent); }

/* Stats and last match: the card layout with a caption under it. */
.pw-stats .pw-next, .pw-match .pw-next { letter-spacing: .08em; }
.pw-match .pw-rank .pw-n { text-transform: uppercase; letter-spacing: .04em; }

/* Daily goal: the meter turns to the win colour once the goal is reached. */
.pw-goal.is-done .pw-meter i { background: var(--pw-good); }
