:root {
  --sb-grad1: #002b40;
  --sb-grad2: #013d5b;
  --sb-yellow-grad1: #ffd84d;
  --sb-yellow-grad2: #efc21f;
  --sb-blue-text: #003f5f;
  --sb-cyan: #34e0df;
  --bg-page: #e1e1e1;
  --ink-soft: rgba(255, 255, 255, 0.82);
  --line-soft: rgba(255, 255, 255, 0.28);
  --radius-xl: 28px;
  --radius-lg: 22px;
  --radius-md: 16px;
  --shadow-soft: 0 14px 34px rgba(0, 22, 35, 0.26);
  --set-cell-size: 47px;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg-page);
  color: #ffffff;
  font-family: "Poppins", "Segoe UI", Roboto, Arial, sans-serif;
}

.mini-nav {
  position: sticky;
  top: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  height: 62px;
  padding: 0 clamp(12px, 2vw, 22px);
  background: linear-gradient(180deg, var(--sb-grad1), var(--sb-grad2));
  border-bottom: 2px solid var(--sb-yellow-grad2);
}

.nav-back {
  width: 36px;
  height: 36px;
  border: 1px solid rgba(255, 255, 255, 0.26);
  border-radius: 11px;
  cursor: pointer;
  color: var(--sb-blue-text);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(245, 248, 252, 0.98));
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 10px 22px rgba(0, 0, 0, 0.22);
  transition: transform 0.12s ease, box-shadow 0.12s ease;
}

.nav-back:hover {
  transform: translateY(-1px);
  box-shadow: 0 10px 22px rgba(0, 0, 0, 0.24);
}

.nav-back-icon {
  width: 17px;
  height: 17px;
  display: block;
}

.nav-logo img {
  display: block;
  height: 60px;
  width: auto;
}

.stats-page {
  min-height: calc(100dvh - 62px);
  padding: 14px 14px 28px;
}

.stats-container {
  width: min(1200px, 100%);
  margin: 0 auto;
  display: grid;
  gap: 14px;
}

.stat-header {
  position: relative;
  overflow: hidden;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(92px, 142px) minmax(0, 1fr);
  grid-template-areas:
    "left score right";
  align-items: center;
  gap: 6px 12px;
  padding: 60px clamp(14px, 2.2vw, 24px) 15px;
  min-height: 154px;
  border-radius: var(--radius-xl);
  background: linear-gradient(180deg, var(--sb-grad1), var(--sb-grad2));
  border: 1px solid rgba(255, 255, 255, 0.14);
  box-shadow: var(--shadow-soft);
}

.stat-header::before {
  display: none;
}

.sh-left {
  grid-area: left;
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
}

.sh-right {
  grid-area: right;
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
}

.sh-score {
  grid-area: score;
  justify-self: center;
  align-self: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

.sh-time {
  display: none;
}

.sh-meta-line {
  margin: 0;
  position: absolute;
  top: 12px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 2;
  pointer-events: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 7px 14px;
  border-radius: 12px;
  background: linear-gradient(180deg, var(--sb-yellow-grad1), var(--sb-yellow-grad2));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.34), 0 6px 14px rgba(0, 0, 0, 0.18);
  width: max-content;
  max-width: calc(100% - 28px);
  color: var(--sb-blue-text);
  font-size: clamp(12px, 1.2vw, 15px);
  font-weight: 700;
  line-height: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  text-align: center;
}

.sh-meta-category {
  color: var(--sb-blue-text);
  font-weight: 800;
}

.sh-meta-sep {
  margin: 0;
  opacity: 0.65;
}

.sh-meta-datetime {
  color: var(--sb-blue-text);
}

.player-name-left,
.player-name-right {
  margin: 0;
  width: 100%;
  font-size: clamp(19px, 2vw, 24px);
  line-height: 1.03;
  font-weight: 780;
  overflow: hidden;
}

.player-lastname,
.player-firstname {
  display: block;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.player-lastname {
  font-weight: 800;
}

.player-firstname {
  margin-top: 1px;
  font-size: 0.88em;
  font-weight: 720;
}

.player-sub-left,
.player-sub-right {
  margin: 0;
  width: 100%;
  color: var(--ink-soft);
  font-size: clamp(11px, 0.95vw, 12px);
  line-height: 1.2;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.player-sub-left {
  text-align: center;
}

.player-name-left {
  text-align: center;
  justify-self: center;
}

.player-name-right {
  text-align: center;
  justify-self: center;
}

.player-sub-right {
  text-align: center;
}

.player-serve-left,
.player-serve-right {
  margin: 0;
  min-height: 12px;
  line-height: 1;
  width: 100%;
  text-align: center;
}

.big-score {
  margin: 0;
  text-align: center;
}

.set-win {
  margin: 0;
  color: #ffffff;
  font-size: clamp(34px, 3.8vw, 46px);
  font-weight: 900;
  line-height: 0.95;
}

.set-score-sep {
  color: #ffffff;
}

.set-score-a.winner,
.set-score-b.winner {
  color: var(--sb-yellow-grad1);
  text-shadow: 0 0 10px rgba(255, 216, 77, 0.24);
}

.player-name-left.winner,
.player-name-right.winner {
  color: var(--sb-yellow-grad1);
  text-shadow: 0 0 12px rgba(255, 216, 77, 0.24);
}

.stat-tabs {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}

.stat-tab {
  appearance: none;
  border: 0;
  cursor: pointer;
  background: linear-gradient(180deg, var(--sb-grad1), var(--sb-grad2));
  color: #ffffff;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 999px;
  padding: 11px 20px;
  font-size: clamp(12px, 1.2vw, 14px);
  line-height: 1;
  font-weight: 800;
  letter-spacing: 0.02em;
  box-shadow: 0 8px 18px rgba(0, 0, 0, 0.16);
}

.stat-tab.active {
  color: var(--sb-blue-text);
  border-color: transparent;
  background: linear-gradient(180deg, var(--sb-yellow-grad1), var(--sb-yellow-grad2));
  box-shadow: 0 10px 22px rgba(0, 0, 0, 0.2);
}

.tab-content {
  display: none;
}

.tab-content.active {
  display: block;
}

.stat-card {
  border-radius: var(--radius-xl);
  padding: 10px;
  background: linear-gradient(180deg, var(--sb-grad1), var(--sb-grad2));
  border: 1px solid rgba(255, 255, 255, 0.14);
  box-shadow: var(--shadow-soft);
}

.stat-title {
  margin: 0 0 12px;
  text-align: center;
  color: #ffffff;
  font-size: clamp(18px, 2.2vw, 26px);
  font-weight: 800;
}

.resume-header-row,
.resume-line,
.resume-times {
  display: grid;
  grid-template-columns: minmax(0, 1fr) var(--set-cell-size) var(--set-cell-size) var(--set-cell-size) var(--set-cell-size);
  align-items: center;
  gap: 9px;
}

.resume-header-row {
  margin-bottom: 0;
}

.rh {
  text-align: center;
  color: var(--ink-soft);
  font-size: clamp(10px, 0.95vw, 12px);
  font-weight: 700;
}

.rh.name {
  text-align: left;
  padding-left: 3px;
  font-size: clamp(12px, 1.2vw, 15px);
}

.resume-line {
  padding: 6px 0;
}

.resume-line + .resume-line {
  margin-top: 4px;
  padding-top: 11px;
  border-top: 1px solid var(--line-soft);
}

.rl {
  min-height: var(--set-cell-size);
  border-radius: 10px;
  background: #175b80;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #ffffff;
  text-align: center;
  font-size: clamp(20px, 2.25vw, 31px);
  font-weight: 700;
}

.resume-line > .rl:not(.name) {
  width: var(--set-cell-size);
  height: var(--set-cell-size);
  justify-self: center;
}

.rl.name {
  min-height: auto;
  border-radius: 0;
  background: transparent;
  justify-content: flex-start;
  text-align: left;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-size: clamp(14px, 1.45vw, 19px);
  font-weight: 780;
}

.rl.name.winner {
  color: var(--sb-yellow-grad1);
}

.rl.s {
  color: #ffffff;
  background: transparent;
  border: 0;
  font-weight: 820;
}

.rl.s.winner {
  color: var(--sb-yellow-grad1);
  background: transparent;
  border: 0;
  font-weight: 900;
}

.rl.set-won {
  color: var(--sb-blue-text);
  background: linear-gradient(180deg, var(--sb-yellow-grad1), var(--sb-yellow-grad2));
  border: 0;
  font-weight: 900;
}

.rl.set-encours {
  color: #ffffff;
  background: transparent;
  border: 3px solid var(--sb-yellow-grad1);
  font-weight: 780;
}

.resume-times {
  margin-top: 0;
  color: var(--ink-soft);
}

.lbl {
  text-align: right;
  padding-left: 0;
  padding-right: 3px;
  font-size: 11px;
  font-weight: 700;
}

.val-set,
.val-s1,
.val-s2,
.val-s3 {
  text-align: center;
  font-size: 10px;
  font-weight: 600;
}

.pp-wrap {
  display: grid;
  gap: 9px;
}

.pp-set-pills {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 7px;
}

.tab-content[data-tab="jeux"] .pp-set-pills {
  margin-top: 6px;
  margin-bottom: 10px;
}

#statsPills {
  margin-top: 10px;
  margin-bottom: 10px;
}

.pp-pill {
  appearance: none;
  border: 0;
  cursor: pointer;
  border-radius: 999px;
  padding: calc(7px * 1.21550625) calc(13px * 1.21550625);
  font-size: calc(11px * 1.21550625);
  font-weight: 800;
  line-height: 1;
  color: var(--sb-blue-text);
  background: rgba(255, 255, 255, 0.92);
}

.pp-pill.active {
  color: #ffffff;
  background: linear-gradient(180deg, var(--sb-grad1), var(--sb-grad2));
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.16);
}

.pp-title {
  margin: 2px 0 0;
  font-size: 12px;
  font-weight: 700;
  color: var(--ink-soft);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.tab-content[data-tab="jeux"] .pp-title {
  display: none;
}

.pp-game {
  padding: 9px 0;
  border-top: 1px solid var(--line-soft);
}

.pp-line {
  width: min(414px, 100%);
  margin: 0 auto;
  display: grid;
  grid-template-columns: 94px minmax(0, 1fr) 94px;
  align-items: center;
  gap: 0;
}

.pp-serve {
  min-height: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.pp-line > .pp-serve:first-child {
  justify-content: flex-end;
  transform: translateX(22px);
}

.pp-line > .pp-serve:last-child {
  justify-content: flex-start;
  transform: translateX(-22px);
}

.pp-score {
  text-align: center;
  font-size: clamp(20px, 3.15vw, 31px);
  font-weight: 800;
  letter-spacing: 0.02em;
}

.pie-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 13px;
}

.pie-card {
  border-radius: var(--radius-lg);
  border: 1px solid rgba(255, 255, 255, 0.14);
  background: rgba(255, 255, 255, 0.04);
  padding: 13px 11px;
}

.pie-head {
  display: flex;
  justify-content: space-between;
  gap: 7px;
  align-items: baseline;
  margin-bottom: 7px;
}

.pie-name {
  font-size: clamp(13px, 1.35vw, 16px);
  font-weight: 760;
  color: #ffffff;
}

.pie-sub {
  font-size: clamp(11px, 0.9vw, 12px);
  font-weight: 600;
  color: var(--ink-soft);
}

.pie-wrap {
  position: relative;
  width: 189px;
  height: 189px;
  margin: 0 auto 7px;
}

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

.pie-svg circle:first-child {
  stroke: rgba(255, 255, 255, 0.2) !important;
}

.pie-svg circle:nth-child(2) {
  stroke: var(--sb-yellow-grad1) !important;
}

.pie-center {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  text-align: center;
  width: 117px;
}

.pie-center-top {
  font-size: clamp(23px, 2.7vw, 31px);
  line-height: 1;
  font-weight: 900;
  color: #ffffff;
}

.pie-center-sub {
  margin-top: 3px;
  font-size: 11px;
  line-height: 1.25;
  font-weight: 600;
  color: var(--ink-soft);
}

.pie-legend {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 0;
  color: var(--ink-soft);
  font-size: 11px;
  font-weight: 700;
  line-height: 1;
}

.dot {
  width: 9px;
  height: 9px;
  display: inline-block;
  border-radius: 50%;
  margin-right: 4px;
  transform: translateY(1px);
}

.dot-win {
  background: var(--sb-yellow-grad1);
}

.dot-loss {
  background: rgba(255, 255, 255, 0.26);
  margin-left: 14px;
}

.pp-serve-icon {
  width: 19px;
  height: 19px;
  object-fit: contain;
}

.pp-serve-icon-grid {
  width: 13px;
  height: 13px;
  object-fit: contain;
  vertical-align: middle;
}

.pp-serve-trophy-grid {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  line-height: 1;
}

.pp-serve-icon-summary {
  width: 14px;
  height: 14px;
  object-fit: contain;
  vertical-align: middle;
}

.stat-note {
  display: none;
}

@media (max-width: 1200px) {
  .stats-container {
    width: min(1100px, 100%);
  }

  .player-name-left,
  .player-name-right {
    font-size: clamp(19px, 2.1vw, 28px);
  }

  :root {
    --set-cell-size: 43px;
  }
}

@media (max-width: 980px) {
  :root {
    --set-cell-size: 40px;
  }

  .stat-header {
    grid-template-columns: minmax(0, 1fr) 104px minmax(0, 1fr);
    padding: 56px 11px 12px;
    min-height: 140px;
    gap: 6px 8px;
  }

  .player-name-left,
  .player-name-right {
    font-size: clamp(15px, 2vw, 18px);
  }

  .player-sub-left,
  .player-sub-right {
    font-size: 11px;
  }

  .set-win {
    font-size: clamp(29px, 4.2vw, 34px);
  }

  .pie-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 768px) {
  .mini-nav {
    height: 56px;
  }

  .nav-logo img {
    height: 52px;
  }

  .stats-page {
    min-height: calc(100dvh - 56px);
    padding: 10px 10px 20px;
  }

  .stat-header,
  .stat-card {
    border-radius: var(--radius-lg);
  }

  .stat-header {
    grid-template-columns: minmax(0, 1fr) 92px minmax(0, 1fr);
    padding: 54px 10px 11px;
    min-height: 132px;
    gap: 6px;
  }

  .stat-tabs {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 7px;
  }

  .stat-tab {
    border-radius: 12px;
    padding: 10px 8px;
    font-size: 11px;
  }

  :root {
    --set-cell-size: 36px;
  }

  .rl {
    border-radius: 10px;
    font-size: 19px;
  }

  .rl.name {
    font-size: 14px;
  }

  .pp-line {
    grid-template-columns: 68px minmax(0, 1fr) 68px;
  }

  .pp-line > .pp-serve:first-child {
    transform: translateX(14px);
  }

  .pp-line > .pp-serve:last-child {
    transform: translateX(-14px);
  }

  .pp-score {
    font-size: 22px;
  }

  .pie-wrap {
    width: 162px;
    height: 162px;
  }
}

@media (max-width: 560px) {
  .stat-header {
    grid-template-columns: minmax(0, 1fr) 86px minmax(0, 1fr);
    grid-template-areas: "left score right";
    padding: 52px 10px 11px;
    gap: 5px 6px;
  }

  .sh-left,
  .sh-right {
    align-items: center;
  }

  .player-name-left,
  .player-name-right {
    font-size: 15px;
  }

  .player-sub-left,
  .player-sub-right {
    font-size: 10px;
  }

  .set-win {
    font-size: 27px;
  }

  :root {
    --set-cell-size: 34px;
  }
}

@media (max-width: 420px) {
  .nav-back {
    width: 32px;
    height: 32px;
    border-radius: 9px;
  }

  .nav-back-icon {
    width: 15px;
    height: 15px;
  }

  .nav-logo img {
    height: 46px;
  }

  .stat-card {
    padding: 14px 12px;
  }

  .stat-header {
    padding: 52px 12px 14px;
  }

  :root {
    --set-cell-size: 32px;
  }
}
