.profile-caption-editor {
  position: relative;
  padding: 1rem;
  font-size: 1rem;
  line-height: 1.35;
  overflow-wrap: anywhere;
}

.profile-caption-editor p {
  margin: 0;
}

.caption-section {
  margin-top: 1.05rem !important;
}

.caption-section strong {
  font-weight: 700;
}

.caption-section[hidden],
.add-optional-field-button[hidden] {
  display: none;
}

.optional-field-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}

.remove-optional-field-button {
  flex: 0 0 auto;
  width: 1.8rem;
  height: 1.8rem;
  display: inline-grid;
  place-items: center;
  padding: 0;
  border: 1px solid color-mix(in srgb, var(--destructive) 18%, transparent);
  border-radius: 0.5rem;
  background: color-mix(in srgb, var(--destructive) 10%, transparent);
  color: var(--destructive);
  line-height: 1;
  cursor: pointer;
}

.remove-optional-field-button svg {
  width: 1rem;
  height: 1rem;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.add-optional-field-button {
  width: 100%;
  margin-top: 1.05rem;
  padding: 0.75rem;
  border: 1px dashed color-mix(in srgb, var(--blue) 42%, transparent);
  border-radius: 0.9rem;
  background: color-mix(in srgb, var(--blue) 5%, transparent);
  color: var(--blue);
  font: inherit;
  font-weight: 650;
  cursor: pointer;
}

.editable-token {
  position: relative;
  z-index: 1;
  padding: 0.08rem 0.28rem;
  border: 0;
  border-radius: 0.48rem;
  outline: none;
  background: transparent;
}

.editable-outlines {
  position: absolute;
  z-index: 0;
  inset: 0;
  width: 100%;
  height: 100%;
  overflow: visible;
  pointer-events: none;
}

.editable-outline {
  fill: color-mix(in srgb, var(--blue) 6%, transparent);
  stroke: color-mix(in srgb, var(--blue) 24%, transparent);
  stroke-width: 1;
  vector-effect: non-scaling-stroke;
  transition: fill 150ms ease, stroke 150ms ease;
}

.editable-outline.hovered {
  stroke: color-mix(in srgb, var(--blue) 42%, transparent);
}

.editable-outline.focused {
  fill: color-mix(in srgb, var(--blue) 10%, transparent);
  stroke: color-mix(in srgb, var(--blue) 68%, transparent);
  stroke-width: 1.5;
}

.editable-outline.optional-empty {
  fill: transparent;
  stroke-dasharray: 4 3;
}

.editable-token:empty::before {
  content: attr(data-placeholder);
  color: var(--hint);
}

.city-editor-anchor {
  position: relative;
  display: inline;
}

.city-suggestions {
  position: absolute;
  z-index: 6;
  top: calc(100% + 0.55rem);
  left: 0;
  width: min(19rem, calc(100vw - 3.5rem));
  max-height: 15rem;
  overflow-y: auto;
  padding: 0.35rem;
  border: 1px solid var(--line);
  border-radius: 0.9rem;
  background: var(--card);
  box-shadow: 0 16px 38px rgba(20, 27, 52, 0.2);
}

.city-suggestion {
  width: 100%;
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.8rem;
  padding: 0.65rem 0.75rem;
  border: 0;
  border-radius: 0.65rem;
  background: transparent;
  text-align: left;
  cursor: pointer;
}

.city-suggestion:is(:hover, :focus, .active) {
  outline: none;
  background: color-mix(in srgb, var(--blue) 10%, transparent);
}

.city-suggestion small {
  color: var(--hint);
}

.profile-meta-field {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  margin-top: 1.05rem;
  color: var(--hint);
}

.goals-editor {
  position: relative;
  z-index: 2;
  margin-top: 1.05rem;
}

.goals-heading-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
}

.goals-heading-row[hidden] {
  display: none;
}

.goals-count {
  color: var(--hint);
  font-size: 0.78rem;
  font-variant-numeric: tabular-nums;
}

.goals-list {
  display: grid;
  gap: 0.5rem;
  margin-top: 0.55rem;
}

.goal-card {
  position: relative;
  padding: 0;
}

.goal-line {
  margin: 0;
  line-height: 1.65;
}

.goal-arrow,
.goal-deadline-separator {
  white-space: pre;
}

.goal-description-field {
  display: inline-block;
  min-width: 4ch;
  min-height: 1.35em;
  max-width: 100%;
  box-sizing: border-box;
  vertical-align: middle;
  line-height: 1.35;
  caret-color: currentColor;
}

.goal-description-field:focus:empty::before {
  content: '';
}

.goal-deadline-control {
  display: inline-block;
  min-height: 1.35em;
  box-sizing: border-box;
  vertical-align: middle;
  line-height: 1.35;
  color: var(--blue);
  cursor: pointer;
}

.goal-deadline-trigger {
  padding: 0;
  border: 0;
  outline: none;
  background: transparent;
  color: inherit;
  font: inherit;
  cursor: pointer;
}

.goal-deadline-parts {
  display: inline-flex;
  align-items: baseline;
  gap: 0.08rem;
  white-space: nowrap;
}

.goal-deadline-parts[hidden] {
  display: none;
}

.goal-deadline-parts input {
  width: 2.5em;
  box-sizing: border-box;
  padding: 0;
  border: 0;
  outline: none;
  background: transparent;
  color: inherit;
  font: inherit;
  text-align: center;
  caret-color: currentColor;
}

.goal-deadline-parts input[data-deadline-part="year"] {
  width: 4.7em;
}

.goal-deadline-parts input::placeholder {
  color: var(--hint);
  opacity: 0.8;
}

.remove-goal-button {
  width: 1.8rem;
  height: 1.8rem;
  vertical-align: middle;
  display: inline-grid;
  place-items: center;
  margin-left: 0.55rem;
  padding: 0;
  border: 1px solid color-mix(in srgb, var(--destructive) 18%, transparent);
  border-radius: 0.5rem;
  background: color-mix(in srgb, var(--destructive) 10%, transparent);
  color: var(--destructive);
  line-height: 1;
  cursor: pointer;
}

.remove-goal-button svg {
  width: 1rem;
  height: 1rem;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.add-goal-button {
  width: 100%;
  margin-top: 0.65rem;
  padding: 0.75rem;
  border: 1px dashed color-mix(in srgb, var(--blue) 42%, transparent);
  border-radius: 0.9rem;
  background: color-mix(in srgb, var(--blue) 5%, transparent);
  color: var(--blue);
  font: inherit;
  font-weight: 650;
  cursor: pointer;
}

.add-goal-button:active,
.remove-goal-button:active,
.add-optional-field-button:active,
.remove-optional-field-button:active {
  transform: scale(0.97);
}

.profile-meta-field select {
  padding: 0.15rem 0.45rem;
  border: 1px solid color-mix(in srgb, var(--blue) 24%, transparent);
  border-radius: 0.55rem;
  outline: none;
  background: color-mix(in srgb, var(--blue) 6%, transparent);
}

.edge-back-button {
  position: fixed;
  z-index: 8;
  top: 50dvh;
  left: max(0px, env(safe-area-inset-left));
  width: 2.75rem;
  height: 4.75rem;
  display: grid;
  place-items: center;
  padding: 0 0.35rem 0 0;
  border: 1px solid color-mix(in srgb, var(--hint) 24%, transparent);
  border-left: 0;
  border-radius: 0 1.6rem 1.6rem 0;
  transform: translateY(-50%);
  background: color-mix(in srgb, var(--card) 92%, transparent);
  color: var(--tg-theme-text-color, var(--fallback-text));
  box-shadow: 0 10px 28px rgba(20, 27, 52, 0.16);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  cursor: pointer;
}

.edge-back-button svg {
  width: 1.65rem;
  height: 1.65rem;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.edge-back-button:active {
  transform: translateY(-50%) scale(0.94);
}

@media (prefers-reduced-motion: reduce) {
  .editable-outline {
    transition: none;
  }
}
