.profile {
  display: grid;
  gap: var(--space-5);
}

.profile__heading {
  display: grid;
  justify-items: center;
  gap: var(--space-3);
  padding-block: var(--space-4);
  text-align: center;
}

.profile__heading h2 {
  font-size: var(--font-size-heading);
}

.profile__name {
  color: #ffffff;
  font-size: var(--font-size-heading);
  line-height: var(--line-height-heading);
  overflow-wrap: anywhere;
}

.card.profile__card {
  display: grid;
  gap: var(--space-5);

  border: 1px solid #a3ff12;

  box-shadow:
    0 0 5px rgb(163 255 18 / 65%),
    0 0 14px rgb(125 255 0 / 35%),
    inset 0 0 7px rgb(163 255 18 / 12%);
}

.profile__card h3 {
  font-size: 1.25rem;
}

.profile__stats {
  display: grid;
  gap: var(--space-4);
  margin: 0;
}

.profile__stat {
  display: grid;
  gap: var(--space-2);
  padding-bottom: var(--space-4);
  border-bottom: 1px solid var(--color-border);
}

.profile__stat:last-child {
  padding-bottom: 0;
  border-bottom: 0;
}

.profile__stat dt {
  color: var(--color-text-muted);
  font-size: var(--font-size-small);
}

.profile__stat dd {
  margin: 0;
  color: var(--color-accent);
  font-size: 1.25rem;
  overflow-wrap: anywhere;
}

.profile__note {
  color: var(--color-text-muted);
  font-size: var(--font-size-small);
}

.profile__avatar {
  position: relative;

  display: grid;
  place-items: center;

  width: 112px;
  height: 112px;
  overflow: hidden;

  color: var(--color-on-accent);
  background: var(--color-accent);
  border: 2px solid #a3ff12;
  border-radius: 50%;

  box-shadow:
    0 0 5px rgb(163 255 18 / 65%),
    0 0 14px rgb(125 255 0 / 35%);

  font-size: 2.5rem;
}

.profile__avatar img {
  position: absolute;
  inset: 0;

  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* Сетка для квадратов ранга и часов */
.profile__summary {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--space-3);
}

/* Квадрат ранга */
.card.profile-rank {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);

  min-width: 0;
  aspect-ratio: 1;
  padding: var(--space-3);
  text-align: center;

  border: 1px solid #a3ff12;

  box-shadow:
    0 0 5px rgb(163 255 18 / 65%),
    0 0 14px rgb(125 255 0 / 35%);
}

.profile-rank__medal {
  width: min(96px, 100%);
}

.profile-rank__image {
  width: 100%;
  height: auto;
  object-fit: contain;
}

.profile-rank__rating {
  display: grid;
  gap: var(--space-1);
}

.profile-rank__label {
  color: var(--color-text-muted);
  font-size: var(--font-size-small);
}

.profile-rank__value {
  color: var(--color-accent);
  font-size: 1.25rem;
}

/* Квадрат часов */
.card.profile-hours {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);

  min-width: 0;
  aspect-ratio: 1;
  padding: var(--space-3);
  text-align: center;

  border: 1px solid #a3ff12;

  box-shadow:
    0 0 5px rgb(163 255 18 / 65%),
    0 0 14px rgb(125 255 0 / 35%);
}

.profile-hours__title-slot {
  display: grid;
  place-items: center;

  width: 100%;
  min-height: 96px;
}

.profile-hours__title {
  width: 100%;
  margin: 0;

  color: var(--color-accent);
  font-size: clamp(1.125rem, 5vw, 1.5rem);
  font-weight: 400;
  line-height: 1.2;
  text-align: center;
  overflow-wrap: anywhere;
  transform: translateY(6px);
}

.profile-hours__rating {
  display: grid;
  gap: var(--space-1);
}

.profile-hours__label {
  color: var(--color-text-muted);
  font-size: var(--font-size-small);
}

.profile-hours__value {
  color: var(--color-accent);
  font-size: 1.25rem;
}

.card.profile-role {
  display: grid;
  gap: var(--space-3);
  padding: var(--space-5);
  text-align: center;

  border: 1px solid #a3ff12;

  box-shadow:
    0 0 5px rgb(163 255 18 / 65%),
    0 0 14px rgb(125 255 0 / 35%);
}

.profile-role__label {
  color: var(--color-text-muted);
  font-size: var(--font-size-small);
}

.profile-role__value {
  color: var(--color-accent);
  font-size: 1.25rem;
  overflow-wrap: anywhere;
}

/* Карточки с кнопкой редактирования */
.profile-rank,
.profile-hours,
.profile-role {
  position: relative;
}

/* Карандаш в правом верхнем углу */
.profile-edit {
  position: absolute;
  top: 4px;
  right: 4px;

  display: grid;
  place-items: center;

  width: var(--touch-target-size);
  height: var(--touch-target-size);
  padding: 0;

  color: var(--color-accent);
  background: transparent;
  border: 0;
  border-radius: var(--radius-small);
}

.profile-edit svg {
  width: 18px;
  height: 18px;
}

/* Окно редактирования */
.profile-editor {
  width: min(360px, calc(100% - 32px));
  max-height: calc(100dvh - 32px);
  overflow-y: auto;
  padding: var(--space-5);

  color: var(--color-text);
  background: var(--color-surface);
  border: 1px solid #a3ff12;
  border-radius: var(--radius-large);

  box-shadow: 0 0 16px rgb(125 255 0 / 35%);
}

.profile-editor::backdrop {
  background: rgb(0 0 0 / 75%);
}

.profile-editor__form {
  display: grid;
  gap: var(--space-4);
}

.profile-editor h2 {
  font-size: 1.25rem;
}

.profile-editor__input {
  display: block;
  width: 100%;
  min-width: 0;
  min-height: var(--touch-target-size);
  padding: var(--space-3);

  color: var(--color-text);
  background: var(--color-background);
  border: 1px solid var(--color-accent);
  border-radius: var(--radius-small);
}

.profile-editor__error {
  color: var(--color-error);
  font-size: var(--font-size-small);
}

.profile-editor__error:empty {
  display: none;
}

.profile-editor__actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-3);
}

.profile-edit:focus,
.profile-edit:focus-visible {
  outline: none;
}