/* Profilis — tik žetonai, 360 px, lietimo zonos ≥ 44 px */
.profile-page {
  display: flex;
  flex-direction: column;
  gap: var(--space-md);
  max-width: 360px;
  width: 100%;
  margin: 0 auto;
  overflow-x: hidden;
  box-sizing: border-box;
}

.profile-page *,
.profile-page *::before,
.profile-page *::after {
  box-sizing: border-box;
}

.profile-page h1,
.profile-page h2,
.profile-page h3,
.profile-page p {
  margin: 0;
}

.profile-page button {
  min-height: var(--touch-min);
  min-width: var(--touch-min);
}

.profile-section-title {
  font-weight: var(--font-weight-bold);
  font-size: var(--font-size-lg);
  letter-spacing: -0.01em;
}

.profile-hero {
  display: flex;
  gap: var(--space-md);
  align-items: center;
}

.profile-hero .ui-avatar--lg {
  width: 96px;
  height: 96px;
  flex-shrink: 0;
}

.profile-hero .ui-avatar--lg img {
  width: 96px;
  height: 96px;
}

.profile-hero__meta {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.profile-hero__name {
  font-family: var(--font-display);
  font-weight: var(--font-weight-display);
  font-size: var(--font-size-2xl);
  letter-spacing: -0.01em;
  line-height: 1;
}

.profile-hero__role {
  font-size: var(--font-size-sm);
  font-weight: var(--font-weight-bold);
  color: var(--color-text-muted);
}

.profile-hero__chips {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.profile-chip {
  padding: 4px 10px;
  border-radius: var(--radius-pill);
  font-weight: var(--font-weight-bold);
  font-size: var(--fs-sm);
}

.profile-chip--streak {
  background: var(--color-warning-soft);
  color: var(--color-warning);
}

.profile-chip--points {
  background: var(--color-points-soft);
  color: var(--color-points);
}

.profile-xp {
  background: var(--color-surface);
  border-radius: 24px;
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
}

.profile-xp__head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: var(--space-sm);
  font-weight: var(--font-weight-bold);
}

.profile-xp__level {
  color: var(--color-xp);
}

.profile-xp__meta {
  font-size: var(--fs-sm);
  color: var(--color-text-muted);
}

.profile-xp__track,
.profile-challenge__track,
.profile-board__track {
  height: 12px;
  border-radius: var(--radius-pill);
  background: var(--color-surface-2);
  overflow: hidden;
}

.profile-xp__fill {
  height: 100%;
  width: 0;
  border-radius: var(--radius-pill);
  background: var(--color-xp);
  transition: width 0.25s ease;
}

.profile-xp__hint {
  font-size: var(--fs-xs);
  color: var(--color-text-muted);
  font-weight: var(--font-weight-bold);
  line-height: 1.35;
}

.profile-badges {
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
}

.profile-badges__head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: var(--space-sm);
}

.profile-badges__count {
  font-weight: var(--font-weight-bold);
  font-size: var(--fs-sm);
  color: var(--color-text-muted);
  flex-shrink: 0;
}

.profile-badges__wall {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 10px 6px;
}

.profile-badge {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  text-align: center;
  min-width: 0;
}

.profile-badge__face {
  width: 58px;
  height: 58px;
  border-radius: var(--radius-pill);
  background: var(--color-points-soft);
  border: 3px solid var(--color-primary);
  display: grid;
  place-items: center;
  font-size: 1.75rem;
  line-height: 1;
  box-shadow: var(--shadow-sm);
  position: relative;
}

.profile-badge__face.is-locked {
  background: var(--color-surface-2);
  border: 3px dashed var(--color-border);
  box-shadow: none;
}

.profile-badge__emoji {
  line-height: 1;
}

.profile-badge.is-locked .profile-badge__emoji {
  opacity: 0.3;
  filter: grayscale(1);
}

.profile-badge__lock {
  position: absolute;
  right: -4px;
  bottom: -4px;
  font-size: 14px;
  line-height: 1;
}

.profile-badge__name {
  font-size: 10.5px;
  font-weight: var(--font-weight-bold);
  line-height: 1.15;
  word-break: break-word;
}

.profile-chart {
  background: var(--color-surface);
  border-radius: 24px;
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
}

.profile-chart__row {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: var(--space-xs);
  align-items: end;
}

.profile-chart__col {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  min-width: 0;
}

.profile-chart__bar-wrap {
  width: 100%;
  height: 72px;
  display: flex;
  align-items: flex-end;
  justify-content: center;
}

.profile-chart__bar {
  width: 100%;
  max-width: 28px;
  border-radius: 6px 6px 2px 2px;
  background: var(--color-border);
  align-self: end;
}

.profile-chart__bar.is-done {
  background: var(--color-success);
}

.profile-chart__count {
  font-size: var(--fs-xs);
  font-weight: var(--font-weight-display);
  color: var(--color-text);
  line-height: 1;
}

.profile-chart__label {
  font-size: var(--fs-xs);
  font-weight: var(--font-weight-bold);
  color: var(--color-text-muted);
}

.profile-board {
  background: var(--color-surface);
  border-radius: 24px;
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
}

.profile-board__head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: var(--space-sm);
}

.profile-board__tabs {
  display: flex;
  background: var(--color-surface-2);
  border-radius: var(--radius-pill);
  padding: 3px;
  flex-shrink: 0;
}

.profile-board__tab {
  padding: 6px 10px;
  border-radius: var(--radius-pill);
  border: none;
  background: transparent;
  font: inherit;
  font-size: var(--fs-xs);
  font-weight: var(--font-weight-bold);
  color: var(--color-text-muted);
  cursor: pointer;
  min-height: var(--touch-min);
}

.profile-board__tab.is-active {
  background: var(--color-mission);
  color: var(--color-text);
  box-shadow: var(--shadow-sm);
}

.profile-board__tab:focus-visible {
  outline: 3px solid var(--color-primary);
  outline-offset: 2px;
}

.profile-board__list {
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
}

.profile-board__item {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  min-width: 0;
}

.profile-board__item.is-me .profile-board__name {
  font-weight: var(--font-weight-display);
}

.profile-board__meta {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.profile-board__line {
  display: flex;
  justify-content: space-between;
  gap: var(--space-sm);
  font-size: var(--font-size-sm);
  font-weight: var(--font-weight-bold);
}

.profile-board__points {
  color: var(--color-text-muted);
  flex-shrink: 0;
}

.profile-board__fill {
  height: 100%;
  width: 0;
  border-radius: var(--radius-pill);
  background: var(--color-success);
  transition: width 0.25s ease;
}

.profile-board__track {
  height: 8px;
}

.profile-board__together {
  font-size: var(--fs-xs);
  font-weight: var(--font-weight-bold);
  color: var(--color-text-muted);
  line-height: 1.35;
}

.profile-challenge {
  background: var(--color-success-soft);
  border-radius: 24px;
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
}

.profile-challenge__title {
  font-weight: var(--font-weight-bold);
  color: var(--color-success);
  font-size: var(--font-size-md);
}

.profile-challenge__fill {
  height: 100%;
  width: 0;
  border-radius: var(--radius-pill);
  background: var(--color-success);
  transition: width 0.25s ease;
}

.profile-challenge__track {
  background: var(--color-mission);
}

.profile-challenge__meta {
  font-size: var(--fs-sm);
  font-weight: var(--font-weight-bold);
  line-height: 1.35;
}

.profile-challenge__done {
  color: var(--color-success);
  font-weight: var(--font-weight-bold);
}

.profile-logout {
  width: 100%;
  color: var(--color-text-muted);
}

.profile-page .ui-btn:focus-visible,
.profile-page button:focus-visible {
  outline: 3px solid var(--color-primary);
  outline-offset: 2px;
}

@media (prefers-reduced-motion: reduce) {
  .profile-xp__fill,
  .profile-challenge__fill,
  .profile-board__fill {
    transition: none !important;
  }
}

@media (max-width: 360px) {
  .profile-page {
    max-width: 100%;
  }

  .profile-badges__wall {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}
