﻿/* ─── FACEIT Widget — Clean Minimal ─────────────────────────────────────── */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800;900&family=Barlow+Condensed:wght@700;800;900&display=swap');

*, *::before, *::after { margin: 0; padding: 0; box-sizing: no boder-box; }

html {
  background: transparent;
  font-family: 'Inter', system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
}

body {
  background: transparent;
  overflow: hidden;
  font-family: 'Inter', system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
  display: inline-block;
}

.hidden { display: none !important; }

/* ── VARIABLES ── */
:root {
  --bg:       #111116;
  --bg2:      #0d0d11;
  --line:     rgba(255, 255, 255, 0.07);
  --accent:   #FF5500;
  --text:     #ffffff;
  --sub:      rgba(255, 255, 255, 0.38);
  --win:      #4ADE80;
  --loss:     #F87171;
  --radius:   12px;
}

body.theme-neon {
  --bg:      #080f0d;
  --bg2:     #060c0a;
  --line:    rgba(0, 230, 150, 0.12);
  --accent:  #00e696;
  --text:    #ffffff;
  --sub:     rgba(0, 230, 150, 0.42);
  --win:     #00ff66;
  --loss:    #ff4466;
}

body.theme-glass {
  --bg:      rgba(16, 16, 24, 0.70);
  --bg2:     rgba(10, 10, 18, 0.60);
  --line:    rgba(255, 255, 255, 0.09);
}

/* ── Banner / Map background ── */
.bg-image {
  position: absolute;
  inset: 0;
  z-index: 0;
  pointer-events: none;
}
.bg-overlay {
  position: absolute;
  inset: 0;
  z-index: 1;
  pointer-events: none;
}
.widget-wrapper {
  position: relative;
  display: inline-flex;
  flex-direction: column;
  align-items: stretch;
  transition: transform 0.7s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.6s ease;
}
body.has-banner .widget-wrapper {
  overflow: hidden;
  border-radius: var(--radius);
}
body.has-banner .widget {
  background: transparent;
  position: relative;
  z-index: 2;
}
body.has-banner .player2-panel {
  background: transparent;
  position: relative;
  z-index: 2;
}
body.has-banner #p2-clip,
body.has-banner #hist-clip {
  background: transparent;
  position: relative;
  z-index: 2;
}
body.has-banner .p2-hdr,
body.has-banner .hist-hdr {
  background: transparent;
}
body.has-banner .top-row,
body.has-banner .stats-divider,
body.has-banner .stats-today,
body.has-banner .history-row,
body.has-banner .tilt-bar,
body.has-banner .elo-goal-bar {
  background: transparent;
}

body.theme-minimal {
  --bg:      #101010;
  --bg2:     #0a0a0a;
  --accent:  #e0e0e0;
  --line:    rgba(255, 255, 255, 0.07);
  --sub:     rgba(255, 255, 255, 0.32);
}

/* ── WIDGET CARD ── */
.widget {
  display: inline-flex;
  flex-direction: column;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: clip;
  min-width: 520px;
  position: relative;
}

body.theme-glass .widget {
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
}

/* ── TOP ROW ── */
.top-row {
  display: flex;
  align-items: center;
  padding: 18px 20px 14px;
  gap: 16px;
}

/* ── Level icon ── */
.level-wrap {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

#level-icon {
  width: 50px;
  height: 50px;
  object-fit: contain;
}

/* ── ELO block ── */
.elo-block {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.nick-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.elo-num-row {
  display: flex;
  align-items: baseline;
  gap: 3px;
}

.elo-value {
  font-family: 'Barlow Condensed', sans-serif;
  font-size: 28px;
  font-weight: 900;
  color: var(--accent);
  letter-spacing: -0.01em;
  font-variant-numeric: tabular-nums;
  line-height: 1;
  will-change: transform;
}

.elo-delta {
  font-family: 'Barlow Condensed', sans-serif;
  font-size: 16px;
  font-weight: 700;
  opacity: 0;
  transition: opacity 0.25s;
  padding-bottom: 1px;
}
.elo-delta.show { opacity: 1; }
.elo-delta.pos  { color: var(--win);  }
.elo-delta.neg  { color: var(--loss); }

.elo-lbl {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--sub);
  padding-bottom: 1px;
}

/* ── Peak ELO ── */
.peak-elo {
  font-size: 11px;
  font-weight: 600;
  color: #ffffff;
  opacity: 0.7;
  margin-left: 6px;
  align-self: flex-end;
  padding-bottom: 2px;
  white-space: nowrap;
}

/* ── Rank info ── */
.rank-info {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-wrap: wrap;
}
.rank-badge {
  font-size: 11px;
  font-weight: 700;
  color: #ffffff;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  white-space: nowrap;
}
.rank-badge-flag {
  height: 11px;
  width: 16px;
  object-fit: cover;
  border-radius: 1px;
  flex-shrink: 0;
}
.rank-badge--challenger {
  color: #ffd700;
  text-shadow: 0 0 6px rgba(255, 215, 0, 0.7);
}
.rank-badge-challenger-icon {
  height: 14px;
  width: 14px;
  object-fit: contain;
  flex-shrink: 0;
}

/* ── Multiwidget (player2) ── */
body.multiwidget {
  display: inline-flex;
  flex-direction: column;
  align-items: stretch;
}
body.multiwidget .widget {
  border-radius: var(--radius) var(--radius) 0 0;
  border-bottom: none;
}
/* Gdy P2 jest tymczasowo schowany (historia) — przywróć zaokrąglenie dołu */
body.multiwidget:not(.p2-visible) .widget {
  border-radius: var(--radius);
  border-bottom: 1px solid var(--line);
}
#p2-clip {
  overflow: hidden;
  max-height: 110px;
  opacity: 1;
  transition: max-height 0.5s cubic-bezier(0.4, 0, 0.2, 1),
              opacity     0.4s ease;
}
#p2-clip:has(.p2-out) {
  max-height: 0;
  opacity: 0;
}
.p2-hdr {
  padding: 5px 14px 3px;
  background: var(--bg2, var(--bg));
}
.hist-hdr {
  padding: 5px 14px 3px;
  background: var(--bg2, var(--bg));
}
.player2-panel {
  position: relative;
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--bg2, var(--bg));
  border: 1px solid var(--line);
  border-top: none;
  border-radius: 0 0 var(--radius) var(--radius);
  padding: 7px 14px;
  overflow: visible;
  transition: padding     0.5s cubic-bezier(0.4, 0, 0.2, 1),
              border-color 0.4s ease;
}
.p2-divider { display: none; }
.player2-panel.p2-out {
  padding-top: 0;
  padding-bottom: 0;
  border-color: transparent;
}
.p2-inner {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1;
}
.p2-level-wrap {
  display: flex;
  align-items: center;
  flex-shrink: 0;
}
.p2-level-wrap img { width: 28px; height: 28px; object-fit: contain; }
.p2-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
  border: 1px solid var(--line);
  background: var(--bg);
}
.p2-elo-block { display: flex; align-items: baseline; gap: 6px; }
.p2-nick-row { display: flex; align-items: center; gap: 5px; }
.p2-name {
  font-family: 'Barlow Condensed', sans-serif;
  font-size: 14px;
  font-weight: 800;
  color: var(--text);
  letter-spacing: 0.01em;
  line-height: 1;
  white-space: nowrap;
}
.p2-meta { display: flex; align-items: center; gap: 3px; }
.p2-meta .flag-img { width: 14px; height: 10px; object-fit: cover; border-radius: 2px; }
.p2-meta .region-badge { font-size: 9px; font-weight: 700; color: var(--sub); letter-spacing: .08em; }
.p2-elo-row { display: flex; align-items: baseline; gap: 4px; margin-left: auto; }
.p2-elo {
  font-family: 'Barlow Condensed', sans-serif;
  font-size: 20px;
  font-weight: 900;
  color: var(--accent);
  letter-spacing: -0.01em;
  line-height: 1;
}
.p2-elo-row .elo-lbl { font-size: 9px; }

/* ── KDR block ── */
.kdr-block {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 2px;
  padding-left: 4px;
  margin-left: auto;
}

.kdr-value {
  font-family: 'Barlow Condensed', sans-serif;
  font-size: 28px;
  font-weight: 800;
  color: var(--text);
  line-height: 1;
  letter-spacing: 0.01em;
}

.kdr-lbl {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--sub);
}

/* ── Spacer ── */
.top-spacer { flex: 1; }

/* ── Player name ── */
.player-name {
  font-size: 26px;
  font-weight: 800;
  color: var(--text);
  letter-spacing: -0.01em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 260px;
  line-height: 1;
}

/* ── Player 2 meta (multiwidget) ── */
.flag-img {
  border-radius: 3px;
  height: 20px;
  width: 30px;
  object-fit: cover;
  flex-shrink: 0;
  display: block;
  box-shadow: 0 1px 4px rgba(0,0,0,0.55);
  outline: 1px solid rgba(255,255,255,0.12);
}

.region-badge {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.10em;
  text-transform: uppercase;
  color: var(--sub);
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 2px 7px;
  white-space: nowrap;
}
.region-badge:empty { display: none; }

/* ── Online dot ── */
.online-dot {
  position: absolute;
  top: 10px;
  right: 12px;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--win);
  flex-shrink: 0;
  animation: online-pulse 2s ease-in-out infinite;
  z-index: 10;
}
@keyframes online-pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(74, 222, 128, 0.6); }
  50%       { box-shadow: 0 0 0 5px rgba(74, 222, 128, 0); }
}

/* ── DIVIDER ── */
.stats-divider {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 20px;
}

.divider-line {
  flex: 1;
  height: 1px;
  background: var(--line);
}

.divider-label {
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.20em;
  text-transform: uppercase;
  color: var(--sub);
  white-space: nowrap;
}

/* ── STATS TODAY ── */
.stats-today {
  display: flex;
  align-items: stretch;
  padding: 12px 20px 18px;
  background: var(--bg2);
}

.stat-today-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 5px;
}

.stat-today-wide { flex: 2; }

.stat-today-val {
  font-family: 'Barlow Condensed', sans-serif;
  font-size: 26px;
  font-weight: 800;
  color: var(--text);
  line-height: 1;
  letter-spacing: 0.01em;
  font-variant-numeric: tabular-nums;
}

.stat-today-val.pos { color: var(--win);  }
.stat-today-val.neg { color: var(--loss); }
.wins-val           { color: var(--win);  }
.losses-val         { color: var(--loss); }

.avg-val {
  font-size: 20px;
}

.stat-today-lbl {
  font-size: 9px;
  font-weight: 600;
  letter-spacing: 0.12em;
  color: var(--sub);
  text-transform: uppercase;
  white-space: nowrap;
}

.stat-today-sep {
  width: 1px;
  background: var(--line);
  align-self: stretch;
  margin: 2px 8px;
  flex-shrink: 0;
}

/* ── ELO ANIM ── */
@keyframes elo-up {
  0%   { transform: translateY(0); }
  40%  { transform: translateY(-5px); }
  100% { transform: translateY(0); }
}
@keyframes elo-down {
  0%   { transform: translateY(0); }
  40%  { transform: translateY(5px); }
  100% { transform: translateY(0); }
}
.elo-up   { animation: elo-up   0.5s ease both; }
.elo-down { animation: elo-down 0.5s ease both; }

/* ── ODOMETER DIGITS ── */
.elo-dw { display: inline-block; overflow: hidden; vertical-align: bottom; }
.elo-d  { display: inline-block; }
@keyframes eloDigitUp   { from { transform: translateY(80%); opacity: 0; } to { transform: translateY(0); opacity: 1; } }
@keyframes eloDigitDown { from { transform: translateY(-80%); opacity: 0; } to { transform: translateY(0); opacity: 1; } }
.elo-d-up   { animation: eloDigitUp   0.38s cubic-bezier(0.22, 1, 0.36, 1) both; }
.elo-d-down { animation: eloDigitDown 0.38s cubic-bezier(0.22, 1, 0.36, 1) both; }

/* ── WIN / LOSS CARD FLASH ── */
@keyframes win-flash {
  0%   { box-shadow: 0 0 0 0   rgba(74, 222, 128, 0);   }
  15%  { box-shadow: 0 0 0 3px rgba(74, 222, 128, 0.85); }
  100% { box-shadow: 0 0 0 3px rgba(74, 222, 128, 0);   }
}
@keyframes loss-flash {
  0%   { box-shadow: 0 0 0 0   rgba(248, 113, 113, 0);   }
  15%  { box-shadow: 0 0 0 3px rgba(248, 113, 113, 0.85); }
  100% { box-shadow: 0 0 0 3px rgba(248, 113, 113, 0);   }
}
.widget.win-flash  { animation: win-flash  2.2s ease forwards; }
.widget.loss-flash { animation: loss-flash 2.2s ease forwards; }
.player2-panel.win-flash  { animation: win-flash  2.2s ease forwards; }
.player2-panel.loss-flash { animation: loss-flash 2.2s ease forwards; }

/* ── WIN STREAK BADGE ── */
.streak-badge {
  font-size: 11px;
  font-weight: 700;
  color: #FFD700;
  background: rgba(255, 215, 0, 0.10);
  border: 1px solid rgba(255, 215, 0, 0.28);
  border-radius: 20px;
  padding: 2px 9px;
  white-space: nowrap;
  margin-left: auto;
  animation: streak-pop 0.35s cubic-bezier(0.34, 1.56, 0.64, 1) both;
}
@keyframes streak-pop {
  0%   { transform: scale(0.6); opacity: 0; }
  100% { transform: scale(1);   opacity: 1; }
}

/* ── HISTORY DOT POP-IN ── */
@keyframes dot-pop {
  0%   { transform: scale(0); opacity: 0; }
  60%  { transform: scale(1.4); opacity: 1; }
  100% { transform: scale(1);   opacity: 1; }
}
.hdot.new { animation: dot-pop 0.35s cubic-bezier(0.34, 1.56, 0.64, 1) both; }

/* ── LEVEL UP FLASH ── */
@keyframes level-flash {
  0%   { filter: drop-shadow(0 0 0px var(--accent)); transform: scale(1); }
  30%  { filter: drop-shadow(0 0 14px var(--accent)); transform: scale(1.25); }
  60%  { filter: drop-shadow(0 0 8px var(--accent)); transform: scale(1.1); }
  100% { filter: drop-shadow(0 0 0px var(--accent)); transform: scale(1); }
}
.level-flash { animation: level-flash 1.2s ease both; }

/* ── MATCH HISTORY DOTS ── */
#hist-clip {
  overflow: hidden;
  max-height: 100px;
  opacity: 1;
  transition: max-height 0.5s cubic-bezier(0.4, 0, 0.2, 1),
              opacity     0.4s ease;
}
#hist-clip:has(.hrow-out),
#hist-clip:has(#history-row.hidden) {
  max-height: 0;
  opacity: 0;
}
.history-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 20px 14px;
  background: var(--bg2);
  overflow: hidden;
}
.history-row.hrow-out {
  padding-top: 0;
  padding-bottom: 0;
}
.history-dots {
  display: flex;
  gap: 5px;
  align-items: center;
}
.hdot {
  width: 26px;
  height: 26px;
  border-radius: 5px;
  flex-shrink: 0;
  overflow: hidden;
  position: relative;
  border: 2px solid transparent;
  box-sizing: border-box;
  background: var(--line);
}
.hdot.win  { border-color: var(--win);  box-shadow: 0 0 5px rgba(74,222,128,0.3); }
.hdot.loss { border-color: var(--loss); box-shadow: 0 0 5px rgba(248,113,113,0.3); }
.hdot-map {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.hdot.hdot-nomap               { background: var(--line); }
.hdot.win.hdot-nomap           { background: rgba(74,222,128,0.15); }
.hdot.loss.hdot-nomap          { background: rgba(248,113,113,0.15); }
.hdot.oldest                   { opacity: 0.45; }
.hdot-lbl-old {
  font-size: 0.58rem;
  font-weight: 700;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--accent);
  opacity: 1;
  white-space: nowrap;
  align-self: center;
  padding-left: 4px;
  flex-shrink: 0;
}
.last-match-time {
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.20em;
  text-transform: uppercase;
  color: var(--sub);
  white-space: nowrap;
  flex-shrink: 0;
}

/* ── TILT WARNING ── */
.tilt-bar {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 8px 20px;
  background: rgba(248, 113, 113, 0.12);
  border-top: 1px solid rgba(248, 113, 113, 0.30);
}
.tilt-icon { font-size: 14px; }
.tilt-text {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--loss);
}

/* ── SESSION TIME ── */
.time-val { font-size: 20px; }

/* ── LOADING / ERROR ── */
.loading {
  padding: 10px 14px;
  color: var(--sub, rgba(255,255,255,0.38));
  font-size: 11px;
}
.loading-inner { display: flex; align-items: center; gap: 8px; }

.dots::after {
  content: '';
  animation: dots 1.4s steps(4,end) infinite;
}
@keyframes dots {
  0%  { content: '';    }
  25% { content: '.';   }
  50% { content: '..';  }
  75% { content: '...'; }
}

.error {
  padding: 10px 14px;
  color: #F87171;
  font-size: 11px;
  border: 1px solid rgba(248,113,113,0.20);
  border-radius: 8px;
  white-space: pre-wrap;
}

/* ── SLIDE ANIMATION ── */
body.slide-bottom .widget-wrapper.widget-out { transform: translateY(110%); opacity: 0; }
body.slide-top    .widget-wrapper.widget-out { transform: translateY(-110%); opacity: 0; }
body.slide-left   .widget-wrapper.widget-out { transform: translateX(-110%); opacity: 0; }
body.slide-right  .widget-wrapper.widget-out { transform: translateX(110%); opacity: 0; }

/* ── ELO GOAL BAR ── */
.elo-goal-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 20px 10px;
}
.elo-goal-label {
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--sub);
  white-space: nowrap;
}
.elo-goal-track {
  flex: 1;
  height: 4px;
  background: var(--line);
  border-radius: 99px;
  overflow: hidden;
  position: relative;
}
.elo-goal-fill {
  position: absolute;
  top: 0; left: 0;
  height: 100%;
  background: var(--accent);
  border-radius: 99px;
  width: 0%;
  transition: width 0.7s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.2);
}
.elo-goal-session {
  position: absolute;
  top: 0;
  height: 100%;
  background: rgba(255,255,255,0.28);
  border-radius: 0 99px 99px 0;
  left: 0%;
  width: 0%;
  transition: width 0.7s cubic-bezier(0.4, 0, 0.2, 1),
              left  0.7s cubic-bezier(0.4, 0, 0.2, 1);
  pointer-events: none;
}
.elo-goal-txt {
  font-size: 10px;
  font-weight: 700;
  color: var(--sub);
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
  min-width: 52px;
  text-align: right;
  transition: color 0.4s ease;
}
.elo-goal-bar.goal-reached .elo-goal-fill {
  background: var(--win);
}
.elo-goal-bar.goal-reached .elo-goal-txt {
  color: var(--win);
  font-weight: 800;
  letter-spacing: 0.04em;
}
@keyframes goal-glow {
  0%, 100% { box-shadow: 0 0 0 0 transparent; }
  50%       { box-shadow: 0 0 8px 2px var(--accent); }
}
.elo-goal-bar.goal-pulse .elo-goal-track {
  animation: goal-glow 1.6s ease-in-out infinite;
}

/* ── MATCH RESULT POPUP ── */
.match-popup {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) scale(0.6);
  opacity: 0;
  pointer-events: none;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  padding: 10px 26px 12px;
  border-radius: 12px;
  font-family: 'Barlow Condensed', 'Inter', sans-serif;
  font-size: 2.6rem;
  font-weight: 900;
  letter-spacing: .04em;
  line-height: 1;
  text-shadow: 0 2px 10px rgba(0,0,0,.6);
  transition: transform .28s cubic-bezier(0.34,1.56,0.64,1), opacity .22s ease;
  white-space: nowrap;
}
.match-popup.visible {
  transform: translate(-50%, -50%) scale(1);
  opacity: 1;
}
.match-popup.hiding {
  transform: translate(-50%, -50%) scale(0.7);
  opacity: 0;
  transition: transform .3s ease, opacity .25s ease;
}
.match-popup.win {
  color: #4ade80;
  background: rgba(20, 40, 25, 0.88);
  border: 1.5px solid rgba(74,222,128,.35);
  box-shadow: 0 0 28px rgba(74,222,128,.28), 0 8px 24px rgba(0,0,0,.5);
}
.match-popup.loss {
  color: #f87171;
  background: rgba(40, 18, 18, 0.88);
  border: 1.5px solid rgba(248,113,113,.35);
  box-shadow: 0 0 28px rgba(248,113,113,.28), 0 8px 24px rgba(0,0,0,.5);
}
.match-popup-lbl {
  display: block;
  font-size: .75rem;
  font-weight: 700;
  letter-spacing: .18em;
  opacity: .72;
  margin-top: 3px;
}
