#profile {
  padding-bottom: 112px;
}

#profile .profile-overview h1 {
  margin: 8px 0 16px;
  font-size: clamp(1.8rem, 7vw, 2.8rem);
  line-height: 0.96;
}

.profile-stat-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin-top: 14px;
}

.profile-stat-grid > div {
  display: grid;
  min-height: 72px;
  align-content: space-between;
  gap: 6px;
  padding: 10px;
  border: 1px solid var(--bf-line);
  border-radius: 12px;
  background: #111;
}

.profile-stat-grid small,
.profile-public-preview small {
  color: var(--bf-muted);
  font-size: 0.68rem;
}

.profile-stat-grid strong {
  font-size: 0.92rem;
  font-variant-numeric: tabular-nums;
}

.profile-engine-form,
.profile-section {
  display: grid;
  gap: 14px;
}

.profile-engine-form {
  margin-top: 14px;
}

.profile-section-heading {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 12px;
}

.profile-section h2 {
  margin: 4px 0 0;
}

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

.profile-section label,
.profile-section legend {
  color: var(--bf-muted);
  font-size: 0.76rem;
  font-weight: 700;
}

.profile-section label:not(.profile-check) {
  display: grid;
  gap: 6px;
}

.profile-section fieldset {
  min-width: 0;
  margin: 0;
  padding: 0;
  border: 0;
}

.profile-section legend {
  margin-bottom: 8px;
}

.profile-choice-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

.profile-choice-grid label {
  position: relative;
  display: block;
}

.profile-choice-grid input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
}

.profile-choice-grid span {
  display: grid;
  min-height: 44px;
  place-items: center;
  padding: 8px 11px;
  border: 1px solid var(--bf-line-strong);
  border-radius: 99px;
  background: #151515;
  color: #ddd;
  cursor: pointer;
}

.profile-choice-grid input:checked + span {
  border-color: #fff;
  background: #292929;
  color: #fff;
}

.profile-choice-grid input:focus-visible + span {
  outline: 2px solid #fff;
  outline-offset: 2px;
}

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

.profile-objective-list {
  display: grid;
  gap: 9px;
}

.profile-objective-row {
  display: grid;
  grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr) 82px 72px auto;
  gap: 8px;
  align-items: end;
  padding: 10px;
  border: 1px solid var(--bf-line);
  border-radius: 11px;
  background: #111;
}

.profile-objective-row button {
  min-height: 44px;
}

.profile-check {
  display: flex;
  min-height: 44px;
  align-items: center;
  gap: 9px;
  padding: 8px 10px;
  border: 1px solid var(--bf-line);
  border-radius: 10px;
  color: #ddd !important;
}

.profile-check input {
  width: 20px;
  height: 20px;
  accent-color: var(--bf-red);
}

.profile-weekly-progress {
  display: grid;
  gap: 9px;
}

.profile-weekly-progress > div {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 5px 12px;
  padding: 10px;
  border: 1px solid var(--bf-line);
  border-radius: 10px;
  background: #111;
}

.profile-weekly-progress small {
  color: var(--bf-muted);
}

.profile-progress {
  grid-column: 1 / -1;
  height: 4px;
  overflow: hidden;
  border-radius: 99px;
  background: #292929;
}

.profile-progress span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: var(--bf-red);
}

.profile-public-preview {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px;
  border: 1px solid var(--bf-line);
  border-radius: 12px;
  background: #111;
}

.profile-public-preview > img,
.profile-public-preview > span {
  width: 52px;
  height: 52px;
  border-radius: 50%;
}

.profile-public-preview > img {
  object-fit: cover;
}

.profile-public-preview > span {
  display: grid;
  place-items: center;
  background: var(--bf-red);
  color: #fff;
  font-size: 1.25rem;
  font-weight: 900;
}

.profile-public-preview > div {
  display: grid;
  min-width: 0;
  gap: 3px;
}

.profile-save-dock {
  position: sticky;
  z-index: 25;
  bottom: calc(82px + var(--safe));
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 12px;
  padding: 9px;
  border: 1px solid var(--bf-line-strong);
  border-radius: 12px;
  background: rgba(8, 9, 11, 0.97);
}

.profile-save-dock span {
  margin-right: auto;
  font-size: 0.72rem;
}

.profile-save-success {
  color: #78dc96;
}

.profile-save-error {
  color: #ff7c83;
}

@media (max-width: 430px) {
  .profile-stat-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .profile-form-grid,
  .profile-toggle-grid,
  .profile-objective-row {
    grid-template-columns: 1fr;
  }

  .profile-save-dock {
    align-items: stretch;
    flex-direction: column;
  }

  .profile-save-dock button {
    width: 100%;
    min-height: 48px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .profile-choice-grid span,
  .profile-progress span {
    transition: none;
  }
}

.profile-reduced-motion *,
.profile-reduced-motion *::before,
.profile-reduced-motion *::after {
  scroll-behavior: auto !important;
  animation-duration: 0.01ms !important;
  animation-iteration-count: 1 !important;
  transition-duration: 0.01ms !important;
}
