/* ================================================
   STATS PAGE STYLES
   ================================================ */

.stats-wrapper {
  max-width: 600px;
  margin: 0 auto;
  padding: 2rem 1.5rem;
}

.stats-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.5rem;
}

.stats-subtitle {
  font-size: .85rem;
  color: var(--muted);
  margin-bottom: 2rem;
}

/* ── Accordion ────────────────────────────────── */

.stats-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  padding: 12px 16px;
  background: none;
  border: none;
  cursor: pointer;
  font-family: inherit;
  text-align: left;
  transition: background .15s;
}
.stats-panel-header:hover { background: #eee; }

.stats-panel-left {
  display: flex;
  align-items: center;
  gap: .65rem;
}

.city-flag-sm {
  width: 28px;
  height: 18px;
  border-radius: 2px;
  background-size: cover;
  background-position: center;
  flex-shrink: 0;
  border: 1px solid var(--border);
}

.stats-panel-city {
  font-size: .95rem;
  font-weight: 600;
  color: var(--text);
}

.stats-panel-right {
  display: flex;
  align-items: center;
  gap: .6rem;
}

.stats-panel-badge {
  font-size: .75rem;
  font-weight: 700;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.stats-panel-badge.won  { background: var(--green); color: #fff; }
.stats-panel-badge.lost { background: var(--alert); color: #fff; }

.stats-panel-unplayed {
  font-size: .75rem;
  color: var(--muted);
}

.stats-chevron {
  width: 14px;
  height: 14px;
  color: var(--muted);
  transition: transform .2s;
  flex-shrink: 0;
}
.stats-panel.active .stats-chevron { transform: rotate(180deg); }



/* ── Today's result ───────────────────────────── */
.stats-today {
  padding: .85rem 0;
  border-bottom: 1px solid var(--border);
  margin-bottom: 1rem;
}

.stats-today-result {
  display: flex;
  align-items: center;
  gap: .5rem;
  margin-bottom: .4rem;
}

.stats-today-icon { font-size: 1.2rem; }

.stats-today-text {
  font-size: .9rem;
  color: var(--muted);
}
.stats-today-text strong { color: var(--text); }

.stats-squares {
  font-size: 1.1rem;
  letter-spacing: .1em;
  margin-top: .4rem;
}

.stats-today.unplayed {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: .75rem;
}

.stats-unplayed-msg {
  font-size: .88rem;
  color: var(--muted);
}

.stats-play-btn {
  font-size: .82rem;
  padding: .45rem 1rem;
  border-radius: 8px;
  background: var(--accent);
  color: #fff;
  text-decoration: none;
  font-weight: 600;
  transition: opacity .15s;
}
.stats-play-btn:hover { opacity: .85; }

/* ── Stat pills ───────────────────────────────── */
.stats-pills {
  display: flex;
  justify-content: center;
  margin: .75rem 0;
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
}

.stats-pill {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: .65rem .5rem;
  border-right: 1px solid var(--border);
}
.stats-pill:last-child { border-right: none; }

.stats-pill-val {
  font-size: 1.3rem;
  font-weight: 700;
  color: var(--text);
  line-height: 1;
}

.stats-pill-lbl {
  font-size: .65rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: .04em;
  margin-top: 3px;
  white-space: nowrap;
}

/* ── Shared layout ────────────────────────────────────────────────────────── */
.stats-container {
  display: flex;
  gap: 2rem;
  align-items: flex-start;
}

.stats-detail-heading {
  display: flex;
  align-items: center;
  gap: .75rem;
  margin-bottom: 1.25rem;
  padding-bottom: 1rem;
}

.stats-detail-city {
  font-size: 1.2rem;
  font-weight: 600;
  color: var(--text);
  margin: 0;
}

.stats-detail-container {
  display: flex;
  gap: 40px;
}

.stat-lbl {
  font-size: .6rem;
  font-weight: 600;
  letter-spacing: .04em;
  color: var(--muted);
  text-transform: uppercase;
  line-height: 1.3;
  margin-bottom: .4rem;
}

.stat-lbl br {
  display: none;
}

.stat-val {
  font-size: 1.5rem;
  font-weight: 600;
  color: var(--accent);
  line-height: 1;
}

.stat-summary-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}

.stats-summary {
  display: flex;
  flex-direction: column;
  gap: 30px;
}

.stat-items-container {
  display: flex;
  justify-content: center;
  flex: 1;
}

/* ── Mobile first — accordion visible, detail panel hidden ───────────────── */
#stats-accordion {
  /*width: 100%;*/
  flex-basis: 100%;
}

#stats-detail {
  display: none;
}

.stats-panel {
  margin-bottom: 12px;
  overflow: hidden;
  background: var(--surface);
}



.stats-panel.active .stats-panel-body { display: block; }

.stats-panel-body {
  display: none;
}

/* ── Desktop two-column layout ───────────────────────────────────────────── */
@media (min-width: 900px) {
  #stats-accordion {
    /*width: 20%;*/
    flex-basis: 350px;
    flex-shrink: 0;
  }

  #stats-detail {
    display: block;
    flex: 1;
    background: var(--surface);
    padding: 30px 40px;
  }

  /* On desktop hide inline body and chevron */
  .stats-panel-body {
    display: none !important;
  }

  .stats-chevron {
    display: none;
  }

  /* Active panel highlight */
  .stats-panel {
    border-left: 6px solid var(--border);
    margin-bottom: 6px;
  }

  .stats-panel.active {
    border-color: var(--accent);
    background: #eee;
  }

  /* Distribution Chart */
  .dist-chart-container {
    flex-basis: 80%;
  }

  .stat-items-container {
    border-left: 1px solid var(--border);
    padding-left: 40px;
  }
}

/* ── Distribution chart ───────────────────────────────────────────────────── */
.dist-chart {
  display: flex;
  align-items: flex-end;
  gap: 20px;
  height: 350px;
  padding-bottom: .25rem;
  margin-bottom: .5rem;
}

.dist-col {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  height: 100%;
}

.dist-pct {
  font-size: .8rem;
  color: var(--muted);
  position: absolute;
  top: -20px;
  left: 50%;
  transform: translateX(-50%);
}

.dist-bar-wrap {
  flex: 1;
  display: flex;
  align-items: flex-end;
  width: 100%;
}

.dist-bar {
  position: relative;
  width: 100%;
  background: var(--border);
  border-radius: 3px 3px 0 0;
  min-height: 3px;
  transition: height .4s ease;
}
.dist-bar.mine      { background: var(--accent); }
.dist-bar.mine.lost { background: var(--alert); }

.dist-label {
  font-size: .7rem;
  color: var(--muted);
  margin-top: 4px;
}

/* ── Unplayed prompt ─────────────────────────────────────────────────────── */
.stats-unplayed {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: .75rem;
  margin-top: 30px;
  padding-top: 20px;
  border-top: 1px solid var(--border);
  font-size: .88rem;
  color: var(--muted);
}

.stats-play-btn {
  font-size: .82rem;
  padding: .45rem 1rem;
  border-radius: 8px;
  background: var(--accent);
  color: #fff;
  text-decoration: none;
  font-weight: 600;
  transition: opacity .15s;
}
.stats-play-btn:hover { opacity: .85; }


@media (max-width:1400px) {

  .dist-chart {
    gap: 10px;
  }

}


@media (max-width:899px) {

  .stats-container {
    gap: 0;
  }
  
  .stats-panel.active .stats-panel-body {
    display: block; 
    padding: 0 16px 16px 16px;
  }

  .stats-chevron {
    display: block;
  }

  .stats-panel {
    border-left: 0;
    margin-bottom: 6px;
  }

  #stats-detail {
    display: none;
  }

  .stats-detail-container {
    flex-direction: column;
    gap: 0;
  }

  .dist-chart-container {
    flex-basis: 100%;
  }

  .dist-chart {
    height: 200px;
  }

  .dist-col {
    padding-top: 30px;
  }

  .stats-detail-heading {
    display: none;
  }

  .stat-val {
    font-size: 1.15em;
  }

  .stat-items-container {
    border: 0;
    padding: 0;
  }

  .stats-summary {
    flex-direction: row;
    flex: 1;
    justify-content: space-between;
    gap: 0;
    border-top: 1px solid var(--border);
    padding-top: 20px;
  }

  .stat-lbl br {
    display: block;
  }

  .stats-unplayed {
    margin-top: 15px;
    padding-top: 15px;
  }

}
