/* Статистика / профиль: уровень, серия месяцев, сводка и графики. */

.stats-head {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  padding: var(--sp-2) 0 var(--sp-4);
}

.stats-head__avatar {
  display: grid;
  place-items: center;
  flex: 0 0 64px;
  width: 64px;
  height: 64px;
  overflow: hidden;
  border: 1px solid var(--border-strong);
  border-radius: 50%;
  background: linear-gradient(140deg, var(--surface-3), var(--surface));
  font-size: 22px;
  font-weight: 800;
}

.stats-head__avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.stats-head__name {
  margin-top: 2px;
  font-size: var(--fs-h1);
  font-weight: 800;
  letter-spacing: -0.01em;
  line-height: 1.1;
}

.stats-head__sub {
  margin-top: 3px;
  color: var(--text-3);
  font-size: var(--fs-xs);
}

/* В Telegram имя и аватар уже есть в клиенте: оставляем заголовок «Профиль»
   и уровень, убираем только дубли (аватар и e-mail). */
html.is-telegram .stats-head__avatar,
html.is-telegram .stats-head__sub {
  display: none;
}

/* Уровень и серия. */
.stat-hero {
  display: grid;
  gap: var(--sp-2);
}

.level-card {
  display: flex;
  align-items: center;
  gap: var(--sp-4);
  padding: var(--sp-4);
  border: 1px solid var(--border);
  border-radius: var(--r-4);
  background:
    linear-gradient(140deg, color-mix(in srgb, var(--accent) 22%, var(--surface)), var(--surface) 72%);
}

.level-card__badge {
  display: grid;
  align-content: center;
  justify-items: center;
  flex: 0 0 64px;
  width: 64px;
  height: 64px;
  border: 1px solid color-mix(in srgb, var(--accent) 50%, transparent);
  border-radius: 50%;
  background: color-mix(in srgb, var(--accent) 14%, transparent);
}

.level-card__caption {
  color: var(--text-2);
  font-size: 9px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.level-card__value {
  color: var(--accent-soft);
  font-size: 24px;
  font-weight: 800;
  line-height: 1.1;
}

.level-card__body {
  flex: 1 1 auto;
  min-width: 0;
}

.level-card__title {
  font-size: var(--fs-sm);
  font-weight: 700;
}

.level-card__hint {
  margin-top: 7px;
  color: var(--text-3);
  font-size: 11px;
}

.meter {
  height: 6px;
  margin-top: 8px;
  border-radius: 3px;
  background: rgba(255, 255, 255, 0.12);
  overflow: hidden;
}

.meter > i {
  display: block;
  height: 100%;
  border-radius: 3px;
  background: var(--accent);
}

.streak-card {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  padding: var(--sp-3) var(--sp-4);
  border: 1px solid var(--border);
  border-radius: var(--r-4);
  background: var(--surface);
}

.streak-card__icon {
  display: grid;
  place-items: center;
  flex: 0 0 40px;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: color-mix(in srgb, #f59e0b 16%, transparent);
  color: #fbbf24;
}

.streak-card__icon svg {
  width: 20px;
  height: 20px;
}

.streak-card__value {
  font-size: 22px;
  font-weight: 800;
  line-height: 1;
}

.streak-card__label {
  margin-top: 2px;
  color: var(--text-2);
  font-size: var(--fs-xs);
}

.streak-card__best {
  margin-left: auto;
  color: var(--text-3);
  font-size: var(--fs-xs);
  font-weight: 700;
}

/* Сводка 2×2. */
.stat-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--sp-2);
  margin-top: var(--sp-2);
}

.stat-card {
  display: grid;
  gap: 2px;
  padding: 13px 14px;
  border: 1px solid var(--border);
  border-radius: var(--r-3);
  background: var(--surface);
}

.stat-card__label {
  color: var(--text-2);
  font-size: var(--fs-xs);
}

.stat-card__value {
  font-size: 20px;
  font-weight: 800;
  letter-spacing: -0.01em;
  line-height: 1.2;
}

.stat-card__hint {
  color: var(--text-3);
  font-size: 10px;
}

.stat-card--wide {
  grid-column: 1 / -1;
}

.stat-card__time {
  display: grid;
  gap: 3px;
  margin-top: 2px;
}

.stat-card__time-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--sp-2);
  color: var(--text-2);
  font-size: var(--fs-xs);
}

.stat-card__time-value {
  color: var(--text);
  font-size: 14px;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.stats-section .section__head {
  margin-bottom: var(--sp-3);
}

/* Столбики по месяцам. */
.bar-chart {
  display: grid;
  gap: 6px;
  padding-top: var(--sp-2);
}

.bar-chart__bars {
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  align-items: end;
  gap: 4px;
  padding-bottom: 2px;
  border-bottom: 1px solid var(--border);
}

.bar-chart__labels {
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  gap: 4px;
}

.bar-chart__col {
  display: grid;
  justify-items: center;
  gap: 5px;
}

.bar-chart__value {
  min-height: 12px;
  color: var(--text-2);
  font-size: 10px;
  font-weight: 800;
}

.bar-chart__track {
  display: flex;
  align-items: flex-end;
  width: 100%;
  height: 92px;
}

.bar-chart__track > i {
  display: block;
  width: 100%;
  border-radius: 5px 5px 0 0;
  background: linear-gradient(180deg, var(--accent-soft), var(--accent));
}

.bar-chart__label {
  color: var(--text-3);
  font-size: 9px;
  font-weight: 700;
  text-align: center;
}

.year-list,
.type-list {
  display: grid;
  gap: 10px;
}

.year-row {
  display: grid;
  grid-template-columns: 52px 1fr 32px;
  align-items: center;
  gap: 10px;
}

.type-row {
  display: grid;
  grid-template-columns: 72px 1fr 32px;
  align-items: center;
  gap: 10px;
}

.year-row__year,
.type-row__label {
  color: var(--text-2);
  font-size: var(--fs-sm);
  font-weight: 700;
}

.year-row__track,
.type-row__track {
  height: 6px;
  border-radius: 3px;
  background: rgba(255, 255, 255, 0.08);
  overflow: hidden;
}

.year-row__track > i,
.type-row__track > i {
  display: block;
  height: 100%;
  border-radius: 3px;
  background: var(--accent);
}

.year-row__count,
.type-row__count {
  font-size: var(--fs-sm);
  font-weight: 800;
  text-align: right;
}

.stats-note {
  margin-top: var(--sp-3);
  color: var(--text-3);
  font-size: var(--fs-xs);
  line-height: 1.45;
}
